XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Wed Dec 13, 2017 11:50 am

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: NexusTK .epf Tile Palette
PostPosted: Wed Aug 30, 2017 3:12 am 
Offline
n00b

Joined: Wed Aug 30, 2017 1:20 am
Posts: 16
Has thanked: 4 times
Have thanks: 5 times

Hi all,

I actually stumbled onto this forum trying to figure out this format from this post: viewtopic.php?f=11&t=1726:)

NexusTK is a 2D MMORPG.

There is a Map Editor for the game:
http://www.mediafire.com/file/zxsuz45jv ... Editor.zip

This editor will use the provided /Data/ to allow a user to create .MAP files

I am interested in converting the EPF/PAL/TBL format to some sort of spritesheet.
I wanted to use graphics from a game I use to play years ago for a hobby project 2D game :D

I believe that the relevant files are:

Code:
TileA0.pal
TileA1.pal
TileA2.pal
TileA3.pal
TileA4.pal
TileA5.pal
TileA6.pal
TileA7.pal
TileA.epf
TileA.tbl


In the other thread (link above), Omnilord suggested the following for each image type:

Quote:
.tbl - describes the structure
.pal - describes the pallette
.epf - stores tile data as described in the .tbl and .pal files.


Tiles are 24x24 (in the editor program)

I am assuming the actual data for the images is stored in the EPF files, which gets the colors from the PAL (palette file)
I further presume that the variants of TileA{0-9} is the "shades" of lightness/darkness as the game goes from night to day.
Maybe all that is needed is: 1 PAL file, 1 EPF file, and 1 TBL file (TileA0.pal, TileA.epf, TileA.tbl) -- further simplifying my end goal (I only need the brightest version, 0 or 9).

Diffing hex versions of: TileA0.pal and TileA1.pal show very small differences, so maybe it's variations of itself (shades).
Diffing hex versions of: TileA.epf and TileB.epf shows many differences, which smells like the actual data.

I'm uncertain how the TBL file fits into all of this though.
"describes the structure". I would think that the EPF file was doing the description of how to present the PAL colors, but that doesn't include the TBL file.

Any help would be appreciated, thanks!!

You can make the ads go away by registering



Top
 Profile  
 
 Post subject: Re: NexusTK .epf Tile Palette
PostPosted: Wed Aug 30, 2017 10:13 pm 
Offline
veteran

Joined: Wed Jun 02, 2010 4:53 am
Posts: 128
Has thanked: 13 times
Have thanks: 127 times
This should be the file format (In C-like syntax).
Convert the files to bmp shouldn't be a big deal but I don't have the time for this right now.
Maybe someone else can work with this information.


Tile*.tbl:
Code:
int numTiles;
int numbPalettes;
byte[3] unknown;
short[numTiles] paletteIndex;

Tile*.pal:
Code:
byte[20] header; // "DLPalette"
color[256] palette;

typedef struct {
  byte blue;
  byte green;
  byte red;
  byte padding; // usually 0x04
} color;

Tile*.epf:
Code:
short numTiles;
short width;
short height;
short unknown; // always 0
int pixelDataLength;
byte[pixelDataLength] pixelData;
tableEntry[numTiles] table;

typedef struct {
  int unknown;
  short width;
  short height;
  int offsetPixelData;
  int offsetUnknown;
} tableEntry;

// additional info about the pixelData:
typedef struct {
  byte[width * height] paletteIndex;
  byte[height] unknown; // usually 0x98
} tile;



I haven't figured out what's going on in SObj.tbl. Apparently the tiles from TileC are put together to bigger objects in this file.


Top
 Profile  
 
 Post subject: Re: NexusTK .epf Tile Palette
PostPosted: Thu Aug 31, 2017 12:15 am 
Offline
n00b

Joined: Wed Aug 30, 2017 1:20 am
Posts: 16
Has thanked: 4 times
Have thanks: 5 times
Thank you so much herbert3000 for taking the time to look into this!!

I should be able to piece together the headers in a script to create the bmps, no worries there :)

I am extremely curious on your process here..

What tools did you use to analyze these files? Was it file extension knowledge, or was something obvious in the hex that gave the structure away?

Thank you again! :D :D


Top
 Profile  
 
 Post subject: Re: NexusTK .epf Tile Palette
PostPosted: Thu Aug 31, 2017 12:21 am 
Offline
n00b

Joined: Wed Aug 30, 2017 1:20 am
Posts: 16
Has thanked: 4 times
Have thanks: 5 times
Also, I'll post a Python viewer/bmp exporter when I finish it up :)


Top
 Profile  
 
 Post subject: Re: NexusTK .epf Tile Palette
PostPosted: Thu Aug 31, 2017 5:27 pm 
Offline
n00b

Joined: Wed Aug 30, 2017 1:20 am
Posts: 16
Has thanked: 4 times
Have thanks: 5 times
TileA*.pal Format:
Code:
byte[32] header; // "DLPalette"
color[256] palette;

typedef struct {
  byte blue;
  byte green;
  byte red;
  byte padding; // usually 0x04
} color;


The header for the PAL files may be byte[32] (or byte[0x20]).

This adds up to the files size:

4 bytes * 256 colors + 32 bytes = 1056

$ du -b TileA0.pal
>> 1056

The TBL syntax should be correct though (I wrote a Python class to store it for now)


Top
 Profile  
 
 Post subject: Re: NexusTK .epf Tile Palette
PostPosted: Sat Sep 02, 2017 7:15 am 
Offline
n00b

Joined: Wed Aug 30, 2017 1:20 am
Posts: 16
Has thanked: 4 times
Have thanks: 5 times
Image

Success!

I'm gonna write a simple PyQt5 interface to export individual tiles (or all tiles - bulk). :wink:


Top
 Profile  
 
 Post subject: EPFViewer
PostPosted: Mon Sep 04, 2017 3:04 am 
Offline
n00b

Joined: Wed Aug 30, 2017 1:20 am
Posts: 16
Has thanked: 4 times
Have thanks: 5 times
It's rough, but it's functional: https://github.com/DizzyThermal/EPFViewer

Cheers!


Top
 Profile  
 
 Post subject: Re: NexusTK .epf Tile Palette
PostPosted: Tue Sep 05, 2017 9:56 pm 
Offline
n00b

Joined: Wed Aug 30, 2017 1:20 am
Posts: 16
Has thanked: 4 times
Have thanks: 5 times
I added MAP file handling to the EPFViewer Github repo as well. I am starting to understand how the SObj.tbl incorporates. This appears to be "Static Objects", where groups of 10 Tiles are arranged vertically.

MAPHandler is not complete. MAP files appear to have full integers dedicated to storing an ID (short -- bytes). The other short appeared to be unused, but I am now beginning to think Tile C are for the other 2 bytes (short). This allows walls to "mix/blend" with ground tiles


Top
 Profile  
 
 Post subject: Re: NexusTK .epf Tile Palette
PostPosted: Thu Sep 14, 2017 9:27 pm 
Offline
n00b

Joined: Wed Aug 30, 2017 1:20 am
Posts: 16
Has thanked: 4 times
Have thanks: 5 times
I am getting really close. I also have incorporated much of the SObj.tbl (grouping TileC tiles).

What I'm struggling with is the alpha layer, and it appears that there may be compression some sort of cipher to mix pixels around?

Anyone have any ideas?:
Image
left: Map Maker (no source available) | right: EPFViewer

Thanks in advance!


Top
 Profile  
 
 Post subject: Re: NexusTK .epf Tile Palette
PostPosted: Fri Sep 15, 2017 12:45 am 
Offline
n00b

Joined: Wed Aug 30, 2017 1:20 am
Posts: 16
Has thanked: 4 times
Have thanks: 5 times
Counting the pixel padding (top and left) of alpha layer, I'm recognizing a pattern:

08 00 06 00 18 00 18 00 00 00 00 00 20 01 00 00

Using our structure for a tile_entry:

Code:
typedef struct {
  int unknown
  short width
  short height
  int pixel_data_offset
  int unknown_offset
} tile_entry


I think the first unknown int is the "top" and "left" pad for alpha

08 00 and 06 00 (8-top, 6-left):
Image

This is usually 00 00 00 00 for TileA and TileB, but those don't appear to have alpha layers.

Getting closer!


Top
 Profile  
 
 Post subject: Re: NexusTK .epf Tile Palette
PostPosted: Fri Sep 15, 2017 2:33 am 
Offline
n00b

Joined: Wed Aug 30, 2017 1:20 am
Posts: 16
Has thanked: 4 times
Have thanks: 5 times
Added some logic to put the cropped images in 24x24 blocks for rendering. Looking better:

Image

The 10th block in doesn't look right, but its tile_entry is:

[08 00] [00 00] [18 00] [0E 00] [EA 11 00 00] [CA 12 00 00]

pad_top = 0x08
pad_left = 0x00
width = 0x18 (24 pixels)
height = 0x0E (14 pixels)

Image

Looks like the assumed height and width are swapped :)

Here's another odd one:

[13 00] [00 00] [18 00] [03 00] [16 E8 01 00] [25 E8 01 00]

pad_top = 0x13 (19 pixels)
pad_left = 0x00
width = 0x18 (24 pixels)
height = 0x03 (3 pixels)

Image

Appears to check out.. :D


Top
 Profile  
 
 Post subject: Re: NexusTK .epf Tile Palette
PostPosted: Fri Sep 15, 2017 3:08 am 
Offline
n00b

Joined: Wed Aug 30, 2017 1:20 am
Posts: 16
Has thanked: 4 times
Have thanks: 5 times
Fixed and commited!

Image


Top
 Profile  
 
 Post subject: Re: NexusTK .epf Tile Palette
PostPosted: Sat Sep 16, 2017 11:44 pm 
Offline
n00b

Joined: Wed Aug 30, 2017 1:20 am
Posts: 16
Has thanked: 4 times
Have thanks: 5 times
Figured out the "Static Objects" (SObj.tbl) file and incorporated a viewer scroll area for it as well:
Image

This is to mimic the Map Editor functionality:
Image

Roadmap:

* Add functionality to read in *.MAP files and view/export to BMP
* EPF tile injection/deletion
* Map creator? X-by-Y maps


Top
 Profile  
 
 Post subject: Re: NexusTK .epf Tile Palette
PostPosted: Tue Sep 19, 2017 10:55 pm 
Offline
n00b

Joined: Wed Aug 30, 2017 1:20 am
Posts: 16
Has thanked: 4 times
Have thanks: 5 times
Added MAP Viewer functionality (Open > Map File (*.map)).

This reads in and displays MAP files made with the Map Editor Program (not EPF Viewer).

Map Editor
Image

EPF Viewer
Image

https://github.com/DizzyThermal/EPFViewer

Cheers!


Top
 Profile  
 
 Post subject: Re: NexusTK .epf Tile Palette
PostPosted: Wed Sep 20, 2017 4:57 pm 
Offline
n00b

Joined: Wed Aug 30, 2017 1:20 am
Posts: 16
Has thanked: 4 times
Have thanks: 5 times
Github's @DDeokk generously provided more information pertaining to EPF and PAL file structures in the EPFViewer Issues section.

Planning on implementing soon - stay tuned :)



Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group