Guide Explanation of W3M and W3X Files

martix

There is no spoon
Reaction score
49
Yea, right. If you put it here you gotta be able to answer a few questions.
I got one.
Whats a block and whats the exact structure of the (attributes). How are files stored and what are those "file slots" I've seen mentioned.
 

Chocobo

White-Flower
Reaction score
409
>replays

I don't specialize in replays. I redirected in a .txt file.

2.09 The W3G file (replays)

Read there : Explanation on Replays


>block

Called "Statement block". It's a whole section of code that are together, and can consist in statements increasing readability.

About "Attributes", it's an Archive.


>how are file stored?

Each file has it's own # (number), it's hash number [#], and 2 codenames (Codename1 and Codename2). It has also a Seed if the file can not be named for unknown reasons, and it's extension (xxx if unknown file). Each file has also a filename.


>file slots?

A cycling redundancy check (CRC32 Conversion Algorithm) and a Filetime.
 

martix

There is no spoon
Reaction score
49
When I asked about the (atrributes) file I expected you to tell me more than the format description, not less...
 
D

deerchao

Guest
I've read that, and I've written a w3g file parser already.

This is what I'm curious:
In a replay file, there is a field called "Map checksum", following the map file path field, which should be used to determine if the map you've got at the specify path of your local computer is the map with which the replay is made(for instance, if I made a replay with losttemple.w3m, and then delete losttemple.w3m, and rename legends.w3m to losttemple.w3m, War3 will tell me I don't have the proper map file losttemple.w3m if I want to watch that replay).

I wonder what's the algorithm to generate that checksum for use in replay from the map file. What I already know is that it's not a hash to the map file content(If I modify the war3map.wts, I can still use that map to watch replay). In ReplayInfomation.txt, it says nothing but:
0x0009 | 4Byte | Map Checksum //TODO: find algorithm
For LostTemple.w3m(comes with TFT 1.21), the checksum is 0x5043FB53.

Do you have any hint for me?

And, another question: If I export the war3map.w3i(or some other stuff, but not war3map.wts) from a war3 map, modify it, and then import it back(with mpq tools), the map can't be use for play any more, it says "file war3map.w3i corrupt", do you know how can I edit the inner files while not breaking the map?
 

martix

There is no spoon
Reaction score
49
Try CRC32 or MD5, we know WC3 can make use of them both.
The second question is somewhat connected to mine - it says its broken because it doesn't match the checksum in the attributes file. Deleting it would allow the map to work, but for updating it - I don't know. You just have to find out on what exactly the CRC32 is performed.
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
wow...chocobo...u work as a programer? @.@
How come u can investigated all of these thing ....
Though i dont need it...just + rep for the effort :D
 
D

deerchao

Guest
Value Variable Type Value Format
0 Integer int
1 Real float (single precision)
2 Unreal (0 <= val <= 1) float (single Precision)
3 String string (null terminated)

What are Unreals?
If I treat them as normal float, I get values like 0, 3, 200, 9999. How am I supposed to get the "real" value of it?
Thanks!
 
D

deerchao

Guest
Thanks, Chocobo.
I know what unreal numbers are in math, but I don't know how and why they're stored inside w3a/w3u/... files.
Is that because wc3 have to store two relative numbers in together(like point.x, point.y or something)?
I read these unreal values from war3map.w3a of DotA 6.52 map:
Code:
Hex				as int					as float(single)
0					0						0
3ea8f5c3	1051260355	0.33
3ee66666	1055286886	0.45
3f000000	1056964608	0.5
3f800000	1065353216	1
40b00000	1085276160	5.5
43a28000	1134723072	325
43c80000	1137180672	400
461c3c00	1176255488	9999
How can I get the real part and image part of a unreal number from 4 bytes data(well, if it means unreal number takes 4 bytes by saying "Unreal (0 <= val <= 1) float (single Precision)")?
And more,
remove imaginary number (so you have only between 0 and 1)
If I remove the image part from 2+3i, I get real number 2, but it's not between 0 and 1, what's wrong?
Thanks again!
 
D

deerchao

Guest
After studying the slks I think I should treat unreal float just like float in my program, though I still don't understand what 0<=val<=1 mean.

However I have another question. In section 1.23(w3u/w3a... files):
*Object definition structure:
char[4]: original object ID (see table at the bottom where you can get the object IDs*)
char[4]: new object ID. (if it is on original table, this is 0, since it isn't used)
If the new object id is not 0(which is true for the second table), what does the old object id in the same structure mean? Is there any relationship between these two ids? Can I treat them just like the old id is not threre when writing a program to display information about all the items in a map?
Thanks again!
 

d07.RiV

New Member
Reaction score
0
I know that someone knows how the checksum is computed (at least for replay blocks). Any info?
 

PitzerMike

poo kaka
Reaction score
38
After studying the slks I think I should treat unreal float just like float in my program, though I still don't understand what 0<=val<=1 mean.

However I have another question. In section 1.23(w3u/w3a... files):

If the new object id is not 0(which is true for the second table), what does the old object id in the same structure mean? Is there any relationship between these two ids? Can I treat them just like the old id is not threre when writing a program to display information about all the items in a map?
Thanks again!

Imagine you make a copy of the peasant unit which has the original id 'hpea'.
The new id will be generated by the WE and be something like 'h000' whereas the original id will be 'hpea'. The new h000 unit will inherit all base stats from hpea + apply its own changes.
Unreals can be treated like any other real.
 
O

Ozzapoo

Guest
Does anyone know how the war3map.wtg file is compressed? I really need to know. Thanks!

P.S. Sorry for bumping the topic ><
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top