Mechanized Assault & eXploration Reloaded



#41 Sep 29, 2008 1:37 am
shaktazuki Offline
Mitglied
Registered since: Apr 30, 2008
Posts: 123


Subject: Re: max file formats
Artlav, that's great stuff!

I did find .FON file info - here: http://www.teamx.ru/rus/bd/fon_format.shtml , but it is in russian and therefore not very understandable to me - I would love an english translation of that and the RES file format, if you would. Babelfish leaves a lot to be desired.

I also am interested in whatever you know about the savegame file format. I was hex editing a DTA file today and noticed that it had at least two separate map save states - I could tell because the data section lengths were 112*112, and 2*112*112 - I assume one is for resources, and the other for units, but I don't know.

This post has been edited 1 times. Last edit on Sep 29, 2008 1:44 am by shaktazuki. ↑  ↓

#42 Sep 29, 2008 2:04 am
Sal Sal Offline
, G-Mod
Registered since: Jun 07, 2004
Posts: 1,525


Subject: Re: max file formats
Max Hex SAVE DTA stuff...
Turns @

000000C0 - 0100 0000 0000 0000 FF03 0000 0300 0000 = 1023 turn
000000C0 - 0100 0000 0000 0000 0100 0000 0300 0000 = 1

1023 turns =

000000C0 - 0100 0000 0000 0000 FF03 0000 0300 0000 = 1023 turn
FF = 255
03 = 3 * 256
01 = 256 ( 256 * 1 )

Hex FF + 03 = 1023
Hex 255 + 3 * 256 = 1023


Playmode@

000000C0 - 0000 0000 0000 0000 0100 0000 0300 0000 = Turn based
000000C0 - 0100 0000 0000 0000 0100 0000 0300 0000 = Simultanous moves

Turn time

000000A0 - 0008 0508 0800 B97D D23E 053C 0000 0001 = Turn time 60

Hex 5C = 60

000000A0 - 0008 0508 0800 B97D D23E 0568 0100 0001 = Turn time 360

Hex 68 = 104
Hex 01 = 256

End turn time

000000A0 - 0008 0508 0800 B97D D23E 0568 013C 00 01 = End turn time 60
Hex 3C = 60
Hex 00 = 0 * 256


looks better in the doc file ...
http://www.zshare.net/download/19605201885d7382/

dont blame me for anything there.. I put the informations down , how I could understand it myself.. so..hope it helps in someway..

A.H.
- easy logic -
This post has been edited 2 times. Last edit on Sep 29, 2008 2:13 am by Sal. ↑  ↓

#43 Sep 29, 2008 2:12 am
shaktazuki Offline
Mitglied
Registered since: Apr 30, 2008
Posts: 123


Subject: Re: max file formats
What is that?
↑  ↓

#44 Sep 29, 2008 2:15 am
Sal Sal Offline
, G-Mod
Registered since: Jun 07, 2004
Posts: 1,525


Subject: Re: max file formats
if you open the DTA files with the hex editor..
and change some variables
yes..thats might be usefull..probably not
A.H.
- easy logic -
↑  ↓

#45 Sep 29, 2008 2:30 am
shaktazuki Offline
Mitglied
Registered since: Apr 30, 2008
Posts: 123


Subject: Re: max file formats
I am about to do that with the map overlays I found in the DTA files...
Quote:
In save10.dta, from offset 224 - 12767 (decimal) inclusive, that is a map overlay - possibly the resources, one byte each entry; observed values: 1, 2, 4, 8 .

I think that's the map resource data.

Quote:

From 12768 - 37855 (decimal) inclusive, that is another map overlay - two bytes per entry, second byte is almost always 0 (3 observed exceptions, which appear to come in groups of 3, value (hex) 10), first byte observed values (hex) 80 (vast majority), 40, 90, 83, 84, 22, 23, 2A, 00, 82, 29, 28, 2B, 24, 88, 85, 47, 46, 41, 42, 8B, 49, 43, 8C, 27, can't be sure about the rest.

I suspect that's the unit data.

I'm about to start poking around - I have responsibilities that prevent me from doing as much as I would like (kids).

[edit] Offset 12768 - 37855 contain the resource data. 0x80 means no resource in that particular square. 0x81-0x90 are the amount of raw resources there, 0x41-0x50 is the amount of gold, 0x21-0x30 is the amount of fuel. I have no idea what the second (usually 0x00) byte is for. The original game does not use range checking; 0x91 is still 16 raw, and so forth.

[edit] Sal, you rock. If we could figure out where the units were being stored, and their statistics, and the victory conditions, then we might be able to use the scenario savegames for the single player missions.
This post has been edited 6 times. Last edit on Sep 29, 2008 6:46 am by shaktazuki. ↑  ↓

#46 Sep 29, 2008 5:47 am
beko beko Offline
Developer, Administrator
Registered since: Jun 04, 2004
Posts: 2,279


Subject: Re: max file formats
oh, this is such a nice example of people working together from all over the world Respect
Bernd Kosmahl
"Sir, we are surrounded!" - "Great - we can attack in any direction."
↑  ↓

#47 Sep 29, 2008 8:07 am
Artlav Artlav Offline
Approved Member
Registered since: Jul 16, 2008
Posts: 22


Subject: Re: max file formats
Quote by shaktazuki:
I did find .FON file info - here: http://www.teamx.ru/rus/bd/fon_format.shtml , but it is in russian and therefore not very understandable to me - I would love an english translation of that and the RES file format, if you would.
Right, the program there seems to work nicely, althrough the result is less than i expected - just a bitmap font?

Here are the details in english:
DownloadSource code (Text):
  1. Offset  Size    Type                    Meaning
  2. Header:
  3. 0x0000  4       int                     Number of glyphs in file. Designated as num below
  4. Caution: Some glyphs may be absent.
  5.  
  6. 0x0004  4       int                     Font height in pixels
  7. 0x0008  4       int                     Distance between two neighbored glyphs in pixels.
  8.  
  9. 0x000C  4       FontInfo*               Pointer to symbol descriptions array
  10. 0x0010  4       unsigned char*  Pointer to symbol images array
  11. Caution: These two fields are not defined in actual file and are filled in memory.
  12.  
  13. Symbol description array:
  14. 0x0014  4       int                     Width of glyph 0
  15. 0x0018  4       int                     Position of glyph 0
  16. 0x001!  4       int                     Width of glyph 1
  17. 0x0020  4       int                     Position of glyph 1
  18. ...     ...     ...     ...
  19. 0x0014 + 8 * num        1       unsigned char           Glyph image data
I hope the code fills the rest.

max.res file basis and image formats:
DownloadSource code (Text):
  1. max.res
  2. Header:
  3. Offset  Length  Description
  4. 0               4               `RES0` - File ID
  5. 4               4               Directory offset
  6. 8               4               Directory length
  7.  
  8. Directory consists of a sequence of file elements:
  9. Offset  Length  Description
  10. 0               8               ASCII File name trimmed by 0's
  11. 8               4               File start offset
  12. 12              4               File size
  13.  
  14. --------------------------
  15.  
  16. Simple palette graphics file
  17. (max.res:\a_*; max.res:\p_*; max.res:\e_*; max.res:\endgame*; etc)
  18.  
  19. Header:
  20. Offset  Length  Description
  21. 0               4               Undefined, commonly 0
  22. 4               2               Image width in pixels
  23. 6               2               Image height in pixels
  24. 8               768             Image pallette
  25. Followed by compressed data in form:
  26. SWORD - byte count
  27. If negative, repeat next byte WORD times
  28. If positive, copy next WORD of bytes
...More to come later...

Quote by shaktazuki:
I also am interested in whatever you know about the savegame file format. I was hex editing a DTA file today and noticed that it had at least two separate map save states - I could tell because the data section lengths were 112*112, and 2*112*112 - I assume one is for resources, and the other for units, but I don't know.
Quote by Sal:
looks better in the doc file ...
http://www.zshare.net/download/19605201885d7382/
It's an order of magnitude more complex than that.

The basic scheme is map header, followed by two maps - passage map and resource map.
Then, four records about four respective players.
That ends the static part of the file, starting a dynamic part.

In the dynamic part there are objects, identified by a word-sized object id, the format is somewhat cryptic in terms of generation, but quite straight-forward in reading.

At the start of dynamic part is a set of unit parameters descriptions for 4 players, one by one, averagely 32 bytes per unit - 2 for object id, 30 for info. If id is 0 or a repeat, then the record (30 bytes part) is empty.

After descriptions there goes unit positions and dynamics table, in similar format of object id followed by info. There are also size-looking bytes in the middle of the stream whose origin i don't understand yet, but they are detectable. The units dynamics are in no way fixed format, and still have blind spots.

After unit dynamics there goes some rather cryptic piece, having something to do with units, or maybe storage, then goes the scan maps and event log&statistics, latter undecoded completely.

I can give you the approximate schemes for the static part - the header and maps are 100% clear, the player infos have blind spots in less important parts, but dynamic part algorithms are better to be left for until they will be more certain.
Artyom Litvinovich
↑  ↓

#48 Sep 29, 2008 11:38 pm
shaktazuki Offline
Mitglied
Registered since: Apr 30, 2008
Posts: 123


Subject: Re: max file formats
Thanks! Happy
↑  ↓

#49 Sep 30, 2008 7:15 am
beko beko Offline
Developer, Administrator
Registered since: Jun 04, 2004
Posts: 2,279


Subject: Re: max file formats
well, I have two cents about MVE: ffplay (part of http://ffmpeg.mplayerhq.hu/) plays mve from interplay very good (also not perfect here. There are sometimes glitches during a scene change and somehow it doesn't get the EOF). Perhaps you want to poke around in the source a little bit.
Bernd Kosmahl
"Sir, we are surrounded!" - "Great - we can attack in any direction."
↑  ↓

#50 Sep 30, 2008 11:04 pm
shaktazuki Offline
Mitglied
Registered since: Apr 30, 2008
Posts: 123


Subject: Re: max file formats
I have been talking to the guy who implemented the MVE playback in FFmpeg. I can't get FFmpeg to compile on my Win32 VC++ 2008 system, so I'm going to have to reimplement it. The problem is stripping out the MVE specific stuff from the FFmpeg specific stuff.

Since nobody's paying me, I kind of jump from topic to topic. Right now, I'm trying to figure out how to write the map resource data into a 16-color PCX for easier comparison to my resource allocation algorithm - I just don't know what to do with the palette information in the header (such as how to create it, what it means, and so on). These sites don't help much with that: http://www.fileformat.info/...a2/PCX.TXT
and
http://www.fileformat.info/format/pcx/#PCX-DMYID.2

And forget about writing it as a bitmap...
This post has been edited 1 times. Last edit on Sep 30, 2008 11:05 pm by shaktazuki. ↑  ↓

Pages (6): 1, 2, 3, 4, 5, 6


All times are GMT +02:00. Current time: 8:08 am.