Jump to content

CnCNet Forums

Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Blade

Map format

Recommended Posts

Anyone know how the map data is stored in the bin file for sole survivor? I take it its not a one to one mapping of two bytes to every cell like C&C maps since the files are all different sizes?

Share this post


Link to post
Share on other sites

No clue... there's a converter out there though, so someone seems to have cracked it, at some point.

Share this post


Link to post
Share on other sites

I think it was every 4 bytes, two byes position, two bytes cell info.

Share this post


Link to post
Share on other sites

Do not hold me to this, but from my old notes (that is seriously outdated, Dec 2010...), it should be;

 

I used "short" as the game handles pretty much everything as a byte, though that might have been a compiler optimization and I'm sure they coded it as a "int".

 

struct CoordStruct{

  short X;

  short Y;

};

 

struct MapPackStruct{

  CoordStruct Coord;

  TemplateType Template;

  short TemplateTileIndex;

};

 

Also, SS can load C&C95 maps when you set a internal integer "INIFormat to "0", its +0x28 from the static MapClass Map.

Share this post


Link to post
Share on other sites

Looking at an actual file, Myg's explanation looks closest to what I see, short containing x*y pos, byte identifying tileset, byte identifying tile.

 

struct MapPackStruct {

short CellNumber;

byte Template;

byte TemplateTileIndex;

};

 

This also explains why the files are different sizes, clear tiles aren't recorded.

Share this post


Link to post
Share on other sites

OK, so I was on the right track, just needed to change the "short"' to "byte". The game handles the first two bytes as a struct, and the basic common format for coords or position in C&C games is CoordStruct, weather the data be byte, short or int.

 

EDIT: All BIN's are formatted as if the map is 128x128. So 0xFF/255 means ignore/skip, while anything less that 128 means a valid cell coord and thus loads the data into the internal hardcoded map struct. So CoordStruct should be CellCoordStruct and the entry's represent the XY location of the cell in the internal 128x128 map structure.

 

Correct me if I am wrong as I'm new to the map formats of Pre-TS games...

Share this post


Link to post
Share on other sites

That sounds about right, but the Sole Survivor bin files don't appear to record the 0xFF, 0x00 pairs in the file itself, preferring the record the coords of the none clear tiles only unlike the TD ones that record an entry for all cells and rely on the position in the file to dictate what coord the entry pertains to.

Share this post


Link to post
Share on other sites

So, it's basically just like a C&C map, but prefixed with the size? Interesting.

Share this post


Link to post
Share on other sites

.bin for C&C95 is two bytes per cell, first byte is the template and the second byte is the tile of the template. For sole survivor you can use a hex editor and modify the maps. Try changing the first few bytes of the file and check what happens to the top north west of the map.

 

 

Share this post


Link to post
Share on other sites

uh, Iran, they already figured it out... editing the first few bytes will just mess up the map dimensions.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...