This post is mostly an idea.
Reasons
1) Tile Type
2) Index [minor]
3) Map edges
1) Tile Type
Look at the current field tile types:
Code: Select all
0 = walkable block
1 = non-walkable block
2 = non-walkable water (not snipable)
3 = walkable water
4 = non-walkable water (snipable)
5 = cliff (snipable)
6 = cliff (not snipable)
Everything else = unknown
Proposed bit flags for type:
Code: Select all
0 = Unwalkable
1 = Walkable
2 = Snipable
4 = Water
8 = Cliff
16,32,64,128 = Reserved
It's slightly less human readable as a file format, but the code becomes simpler and easier to read. Especially if you do defines like this:
Code: Select all
#define TILE_NOWALK 0
#define TILE_WALK 1
#define TILE_SNIPE 2
#define TILE_WATER 4
#define TILE_CLIFF 8
#define TILE_LOS 3
#define TILE_HASWATER 5
The index size is not currently stored in the file. While it can be calculated on the fly, I think we might as well store it in the v2 fld file.
Pseudo code (not much has changed):
Code: Select all
struct FLD2 {
unsigned int index;
unsigned short x;
unsigned short y;
unsigned char type[index];
};
In gat files the top edge and the right edge of the map are defined as walkable. I am pretty sure OpenKore's code compensates for this currently by ignoring those tiles, but the fld file format itself does not. We could easily convert all existing fields to ignore this and not need a version update, but for the v2 specification we should remove this. There is no need to code exceptions for something that serves no purpose.
If we really wanted to we could do 4 bits per tile instead of the current 8 and halve map size, but there's not much of a point.
Please leave any feedback or suggested modifications to the fld2 specification. I don't expect this to be put in to use by... anyone. When/if I (or someone else) decides to finish rewriting the pathing this might be a change worth considering. If you think this is a stupid idea tell me that, too.
[EDIT: Technology -> change of title + sticky]