Need a bit of help on map modding

User avatar
Hob_Gadling
Captain
Posts: 1623
Joined: Tue 14 Feb 2012 00:15
Contact:

Need a bit of help on map modding

Postby Hob_Gadling » Fri 26 Jun 2015 18:14

Hi there. We're knee deep in hex again, and would like a hint from someone who knows this sort of thing.

We're looking at objective zone locations (for Wonsan in this example). There's some NDF that looks like this:

Image

There's a bunch of hex that starts like this (more available on request, there's five parts in all):

Code: Select all

2B 00 00 00 FF 7F 00 00 19 65 75 73 FF 7F D3 09 15 6B 00 00 DC 01 95 73 00 00 34 02 89 1F 00 00 E6 1A F0 7A 00 00 12 4F 63 74 56 55 8B 7F 0D 68 00 00 A1 7B 9A 74 00 00 61 0A F7 7B 00 00 E4 06 CB 71 00 00 37 02 19 78 55 15 4D 0B CC 66 00 00 71 6E 3D 05 00 00 D6 00 97 02 00 00 90 0E BF 0A 00 00 C4 7A 93 05 00 00 8B 0A 9A 7F 00 00 10 49 3F 35 56 55 48 6C EC 1A 00 00 D1 11 CB 00 00 00 CD 7E 58 79 00 00 CE 7E 57 79 00 00 7D 67 4A 00 00 00 33 01 A9 06 00 00 21 09 50 50 AA 6A 50 07 D0 15 00 00 61 00 62 71 00 00 16 6D B5 78 00 00 96 79 FC 05 00 00 72 6D A9 28 56 55 74 0E C1 0B 00 00 62 00 CA 7E 00 00 57 10 85 0F 00 00 72 79 4D 0C 00 00 F5 64 7F 04 00 00 5F 77 1B 09 00 00 DE 7F 2D 08 00 00 F8 7E A7 7C 00 00 85 50 E8 11 55 15 FB 7F 9C 22 00 00 49 06 EC 72 00 00 1A 70 3E 03 00 00 81 75 D9 00 00 00 80 02 80 02 80 04 00 00 80 02 80 03 00 00 00 00 80 02 00 00 80 05 00 00 00 80 02 00 80 05 00 00 00 00 80 02 80 03 00 00 00 80 02 80 03 80 04 80 03 80 04 80 05 00 00 00 80 03 80 03


(probably big-endian, and 2 bytes at start are something odd)

The name of the files suggest that this stuff is organized into KD trees for rapid lookup.

The problem: there is no list of vertexes anywhere to be found. If there are no vertexes, there can't be any objects.

The question: if there are no vertexes, what other sort of data structure could plausibly be used for marking areas on the map?

Do keep in mind that the coder probably wanted to use descriptive names, the structure is a standard one and parts of the code are probably recycled in map meshes somehow.

My guess for the time being is that there's a bunch of 2D "coordinates" (for lack of better word) that mark a part of the map mesh as objective. It's not a very good guess though. I'd like some better ones.

There's all sorts of fun things that become possible if this one is cracked. Surely someone has worked on a game before? And as always, if the people at Eugen want to give us a hand it is heartily welcomed.

deserteagle
Corporal
Posts: 24
Joined: Thu 18 Sep 2014 21:33
Contact:

Re: Need a bit of help on map modding

Postby deserteagle » Fri 26 Jun 2015 18:59

I have been trying to figure that out aswell, recently. I think what you really need to focus on is th main node offset. Althought then we need to know the structure the the nodes, read them.
Also keep in mind, that the hex you are looking at, is probably compressed AND packed as flags say. So before everything we need to figure out how to decode it. Zlib in WG Suite tells that it is an unknown encoding (so maybe we need to unpack it and then decode?).
My thoughts of this - the structure seems to be of this kind: 1 Main top node ( Whole Map ) with tree of triangles underneath. Each zone (node?) is a composition of triangles, that defined by vertexes (2 or 3 dimensional).
Something like that, I think. Although I have a very little experience with KD-trees.
Last edited by deserteagle on Fri 26 Jun 2015 19:06, edited 1 time in total.

User avatar
realfakealex
Lieutenant
Posts: 1259
Joined: Mon 18 Feb 2013 11:59
Location: Kerbin
Contact:

Re: Need a bit of help on map modding

Postby realfakealex » Fri 26 Jun 2015 19:04

The numbers, the numbers, what do they mean hob???

User avatar
Gronank
Colonel
Posts: 2516
Joined: Tue 8 Nov 2011 23:40
Contact:

Re: Need a bit of help on map modding

Postby Gronank » Fri 26 Jun 2015 21:18

This is as good a place as any to post this.

https://www.dropbox.com/s/rkbaqtp1fl6wwsu/modTool.rar?dl=0
This is the latest version of the mod tool I've been tinkering with. It includes some tools for viewing the blob structure that defines the zone logic. Open the file DataMap.Dat located in Wargame Red Dragon\Data\WARGAME\PC\430000210. This file contains everything that defines the zones of the maps. The kdt-files we're currently interested in are the <mapname>\commandzone\leveldesign.kdt ones. Inside this file, the bottom property named "Storage" with the type "Blob" can be exported by clicking where it says System.Byte[] until a menu appears and then selecting "Export Kd tree data".

Choosing this option will export to your selected export part the uncompressed data parts of that file together with a log detailing the positions of the parts in the file. The original blob data can be viewed by exporting the blob raw.

This represents about everything we (I, at any rate) know about this object. We don't know for example what parts remain the same and what parts are different for different maps.

As a bonus, I suppose, this version also contains what so far is the zone editor. This is used by opening a .scenario file (also in DataMap.dat) and then selecting the jigsaw puzzle piece named zone editor. You can use this to edit starting zones, moving and adding spawn points and changing starting zone. It can't be used to change the shapes of the zones though. Changes are saved by clicking the disk icon on the panel with the jigsaw puzzle pieces. As usual, all players needs to have the same version in order to play.
Image

User avatar
Hob_Gadling
Captain
Posts: 1623
Joined: Tue 14 Feb 2012 00:15
Contact:

Re: Need a bit of help on map modding

Postby Hob_Gadling » Mon 29 Jun 2015 19:28

Is anyone else working on this? I figured a teensy bit out but won't bother to write it down here unless someone benefits from it.

AJE
Sergeant Major of the Army
Posts: 384
Joined: Sat 7 Sep 2013 07:22
Contact:

Re: Need a bit of help on map modding

Postby AJE » Mon 29 Jun 2015 23:15

I'm afraid that most of the big modders, like enhoka, Vasto, rogers, or Power Crystals, are either gone or dormant for now. If you want though, you can post it on the Modding Development Group on steam. (There hasn't been much going on there :( )

deserteagle
Corporal
Posts: 24
Joined: Thu 18 Sep 2014 21:33
Contact:

Re: Need a bit of help on map modding

Postby deserteagle » Mon 29 Jun 2015 23:47

I figured a teensy bit out but won't bother to write it down here unless someone benefits from it.

I`m interested (if this can be a motivation for you to write things down)

User avatar
Hob_Gadling
Captain
Posts: 1623
Joined: Tue 14 Feb 2012 00:15
Contact:

Re: Need a bit of help on map modding

Postby Hob_Gadling » Tue 30 Jun 2015 00:27

Might as well.

If you look at the first part of data I think you can split it like this (from first post):

Code: Select all

2B 00 00 00 FF 7F 00 00  // headers

// The next part is probably zone locations. 6 bytes of something (maybe the first corner point, maybe a name for the zone, maybe something else) followed by 3x2 bytes of triangle corners.

19 65 75 73 FF 7F
   D3 09 15 6B 00 00
   DC 01 95 73 00 00
   34 02 89 1F 00 00
   E6 1A F0 7A 00 00
12 4F 63 74 56 55
   8B 7F 0D 68 00 00
   A1 7B 9A 74 00 00
   61 0A F7 7B 00 00
   E4 06 CB 71 00 00
37 02 19 78 55 15
   4D 0B CC 66 00 00
   71 6E 3D 05 00 00
   D6 00 97 02 00 00
   90 0E BF 0A 00 00
   C4 7A 93 05 00 00
   8B 0A 9A 7F 00 00
10 49 3F 35 56 55
   48 6C EC 1A 00 00
   D1 11 CB 00 00 00
   CD 7E 58 79 00 00
   CE 7E 57 79 00 00
   7D 67 4A 00 00 00
   33 01 A9 06 00 00
21 09 50 50 AA 6A
   50 07 D0 15 00 00
   61 00 62 71 00 00
   16 6D B5 78 00 00
   96 79 FC 05 00 00
72 6D A9 28 56 55
   74 0E C1 0B 00 00
   62 00 CA 7E 00 00
   57 10 85 0F 00 00
   72 79 4D 0C 00 00
   F5 64 7F 04 00 00
   5F 77 1B 09 00 00
   DE 7F 2D 08 00 00
   F8 7E A7 7C 00 00
85 50 E8 11 55 15
   FB 7F 9C 22 00 00
   49 06 EC 72 00 00
   1A 70 3E 03 00 00
   81 75 D9 00 00 00

// don't know what the rest of this means. edit: actually, it might just be one more zone. Very odd looking zone, though.

80 02 80 02 80 04
   00 00 80 02 80 03
   00 00 00 00 80 02
   00 00 80 05 00 00
   00 80 02 00 80 05
   00 00 00 00 80 02
   80 03 00 00 00 80
   02 80 03 80 04 80
   03 80 04 80 05 00
   00 00 80 03 80 03



The odd things with that are:

- 2 bytes is very little for coordinate value. Maybe they're relative? Relative to what?
- are zones 2 or 3-dimensional? If 2d, the amount of coordinates per zone is odd (it could be a human thing also, someone dropping more vertexes than absolutely required). If 3d, why is one of the values 00 00 all the time?
- what's that last part? How should you split it? What sort of structure uses data that looks like that, and how does it relate to what we have here?

Or maybe they're not coordinates at all. There's not much stuff in the compressed files, so if this isn't it, where is the data hiding? Thus far all data strucures have been self-contained.

User avatar
The W:AB Noob
Lieutenant General
Posts: 4568
Joined: Fri 12 Jul 2013 22:29
Location: United States, Central Time Zone
Contact:

Re: Need a bit of help on map modding

Postby The W:AB Noob » Tue 30 Jun 2015 03:30

Hob, can you get some hex from A Maze in Japan? You ask that if the hex indicates 3d values, why would "00 00"s be included. My standing theory is that Wonsan is a relatively flat map, and no zones have a difference of y-values in their shape. A Maze in Japan has many 3d shapes.

Also, I'm suspecting that some information included in those 5 parts is for amphibious vehicles. Eugen mentioned that they had to redo all of their maps for amphibious vehicles to work. From what I have found with modding maps, the shapes, locations, and vertexes of zones on the map are not in the .scenario. Any module (starting zone, income zone, reinforcement zone) applies it self to the predesignated shape of the zone if the module is placed within the zone's boundaries.

However, I have never worked with hex before and you guys probably already thought of this.
W:RD Sandbox Mod 5.4.3 Click -> Image

User avatar
Gronank
Colonel
Posts: 2516
Joined: Tue 8 Nov 2011 23:40
Contact:

Re: Need a bit of help on map modding

Postby Gronank » Tue 30 Jun 2015 04:16

Hob_Gadling wrote:Might as well.

If you look at the first part of data I think you can split it like this (from first post):

Spoiler : stuff :

Code: Select all

2B 00 00 00 FF 7F 00 00  // headers

// The next part is probably zone locations. 6 bytes of something (maybe the first corner point, maybe a name for the zone, maybe something else) followed by 3x2 bytes of triangle corners.

19 65 75 73 FF 7F
   D3 09 15 6B 00 00
   DC 01 95 73 00 00
   34 02 89 1F 00 00
   E6 1A F0 7A 00 00
12 4F 63 74 56 55
   8B 7F 0D 68 00 00
   A1 7B 9A 74 00 00
   61 0A F7 7B 00 00
   E4 06 CB 71 00 00
37 02 19 78 55 15
   4D 0B CC 66 00 00
   71 6E 3D 05 00 00
   D6 00 97 02 00 00
   90 0E BF 0A 00 00
   C4 7A 93 05 00 00
   8B 0A 9A 7F 00 00
10 49 3F 35 56 55
   48 6C EC 1A 00 00
   D1 11 CB 00 00 00
   CD 7E 58 79 00 00
   CE 7E 57 79 00 00
   7D 67 4A 00 00 00
   33 01 A9 06 00 00
21 09 50 50 AA 6A
   50 07 D0 15 00 00
   61 00 62 71 00 00
   16 6D B5 78 00 00
   96 79 FC 05 00 00
72 6D A9 28 56 55
   74 0E C1 0B 00 00
   62 00 CA 7E 00 00
   57 10 85 0F 00 00
   72 79 4D 0C 00 00
   F5 64 7F 04 00 00
   5F 77 1B 09 00 00
   DE 7F 2D 08 00 00
   F8 7E A7 7C 00 00
85 50 E8 11 55 15
   FB 7F 9C 22 00 00
   49 06 EC 72 00 00
   1A 70 3E 03 00 00
   81 75 D9 00 00 00

// don't know what the rest of this means. edit: actually, it might just be one more zone. Very odd looking zone, though.

80 02 80 02 80 04
   00 00 80 02 80 03
   00 00 00 00 80 02
   00 00 80 05 00 00
   00 80 02 00 80 05
   00 00 00 00 80 02
   80 03 00 00 00 80
   02 80 03 80 04 80
   03 80 04 80 05 00
   00 00 80 03 80 03



The odd things with that are:

- 2 bytes is very little for coordinate value. Maybe they're relative? Relative to what?
- are zones 2 or 3-dimensional? If 2d, the amount of coordinates per zone is odd (it could be a human thing also, someone dropping more vertexes than absolutely required). If 3d, why is one of the values 00 00 all the time?
- what's that last part? How should you split it? What sort of structure uses data that looks like that, and how does it relate to what we have here?

Or maybe they're not coordinates at all. There's not much stuff in the compressed files, so if this isn't it, where is the data hiding? Thus far all data strucures have been self-contained.

Right, so port wonsan has 7 zones. one zone with 9 vetexies, two zones with 7,and 4 zones with 5. The zone which looks like it only has 4 corners is actually defined by 7 vertexes.

If you count the number of lines there are ending in 00 00 after each 6 byte block you get:
4 4 6 6 4 8 4
Which is a bit too convenient to be a coincident. Presumably the 6 byte header is also a 3*2byte vertex but unlike the others with a non-zero z value for some special Eugen reason. Also, if you sum the numbers of all the vertexes counted like that, you get the number 43 which incidentally is the first number of the header.
Image

Return to “Modding”

Who is online

Users browsing this forum: Bing [Bot] and 4 guests