Jump to content
lovalmidas

Templates.bin research

Recommended Posts

Posted (edited)

I am looking at one of the big .bin files. This is currently a very preliminary research, as at this stage all I can do is to recreate the past discoveries by TibEd and other people, before I can break new ground.

As such, this is a very preliminary research. I hope to share this here so in the future, other people can read and save on the discovery (I can also put my research on GitHub or something, but I have not put my mind into that)

 

Here is what I guess the game executable reads the Templates.bin file and splits it into different areas. These structural divisions is fundamental to how the game interprets the bin file. For instance, the game will reserve a block of memory for Unit data, and a different memory block for Building data.

UjoewkT.png

With the help of TibEd and running the game, these are my guesses on what each section belongs to.

gZsADr5.png

------------------------------------------------------

Text copy of above image

Spoiler

 

Templates.bin
    Units                    up to 0x3c (60) possible? 0x1e (30) used
    UnitBehaviours            
    Buildings                up to 0x64 (100) possible? 0x3e (62) used
    BuildingBehaviours        
    Weapons                    up to 0x40 (64) possible? 0x22 (34) used
    Explosions                up to 0x40 (64) possible? 0x3c (60) used


Allocations:
    
    Size(h)    Size(d)    Offset(h)        Section                                Comment
    0x3c00    15360    000000            Unit definitions                    0x3c instances x 0x100 bytes each            0x1E instances used
    0x68b0    26800    003c00            Building definitions                0x64 instances x 0x10c bytes each            0x3E instances used
    0x0700     1792    00a4b0            Weapon definitions                    0x40 instances x 0x1c bytes each            0x22 instances used
    0x0200      512    00abb0            Explosion definitions                0x40 instances x 0x08 bytes each            0x3C instances used
    0x0168      360    00adb0            ???                                    
    0x0168      360    00af18            ???                                    
    0x0004        4    00b080            ???                                    Value = 1D (unit count related?)
    0x0001        1    00b084            Unit count                            Value = 1E
    0x0004        4    00b085            ???                                    Value = 3C -> qty of next section (explosion count related?)
    0x0100      256    00b089            ???                                    0x3C int values
    0x0001        1    00b189            ???                                    Value = 3C (explosion count related?)
    0x0004        4    00b18a            ???                                    Value = 22 -> qty of next section (weapon count related?)
    0x0100      256    00b18e            ???                                    0x22 int values
    0x0001        1    00b28e            ???                                    Value = 22 (weapon count related?)
    0x0004        4    00b28f            ???                                    Value = 41 -> qty of next section (building count related?)
    0x01e0      480    00b293            ???                                    0x41 int values
    0x0001        1    00b473            Building count                        Value = 3E 
    0xAFC8    45000    00b484            Building name strings                0x64 instances x 0x1c2 bytes each
    0x0c80     3200    01643c            Weapon strings                        0x40 instances x 0x32 bytes each
    0x0c80     3200    0170bc            Explosion strings                    0x40 instances x 0x32 bytes each
    0x6978    27000    017d3c            Unit name strings                    0x3c instances x 0x1c2 bytes each
    0x0BB8     3000    01e6b4            Unit behaviour strings                0x3c instances x 0x32 bytes each
    0x1388     5000    01f26c            Building behaviour strings            0x64 instances x 0x32 bytes each
    0x0056       86    0205f4            ???                                    
    0x0100      256    02064a            ???                                    
    0x0064      100    02074a            ???                                    
    0x0064      100    0207ae            ???                                    
    0x0001        1    020812            ???                                    18
    0x0001        1    020813            ???                                    1A
    END                020814
   

------------------------------------------------------

At a glance, the game appears to support up to 60 unit types, 100 building types, 64 weapon types and 64 explosion types.

I attempted to change what I suspect to be the Unit and Building Count, and I have some varied responses:

  • Decreasing the values and loading a mission where such a value is needed leads to crash on mission load.
    • Setting Unit Count to 0x00 up to 0x19, and loading A1V1 leads to crash at mission load with error "MyVersionOfUnit didn't find a unit".
      ndQT9bj.png
       
    • Setting Unit Count to 0x1A just below the Sandworm ID (25), leads to crash to desktop (no error message)
       
    • Setting Unit Count to 0x1B just equal to the Sandworm ID (25), and loading A1V1 leads to working game, with graphically maimed animations and offset build icons
      DyYMK2G.png2i3iIFK.png 
      Haha, Construction Wind Trap
       
    • Setting Building Count to 0x3B (59), and loading O9V1 leads to crash with error related to the Imperial Palace (ID 59, or the 50thbuilding in the list).
      I2IjhCz.png
       
    • Setting Building Count to 0x3C (60), and loading H5V1 leads to crash with error related to the Harkonnen Special Outpost (ID 60, or the 61st building in the list).
      17nQx0A.png
       
    • Setting Building Count to 0x3D (61), and loading O4V1 doesn't lead to crash, but the player loses instantly (since the Ordos Special Outpost (ID 61, or the 62nd building in the list)... does not exist??). This happens on both the -spawn and normal launches of the game. I am not sure why this behavior is different from the Harkonnen version.

       
  • Changing other values in the surrounding region may lead to lead to very damaging graphical glitches.
    • Clicking on the building queue (to construct a building) may lead to crash due to 'BlitErrors'

 

Hypothesis: Unit Count and Building Count works like what I think they do, but their DATA.r8/.r16 folders may be arranged specifically to the exact number of items. Either this could be controlled by the .bin file, or it is hardcoded and any modder working on adjusting the counts need to also pad their DATA files so that the image sequences are aligned correctly.

This is the extent of my current research. More to come. 

 

 

Edited by lovalmidas
  • Upvote 2

Share this post


Link to post
Share on other sites

Looking great so far, loval. I look forward to when you check out unit sounds, because I need to be able to mod those unit reporting sounds! :P

Share this post


Link to post
Share on other sites
On 6/30/2020 at 10:30 AM, lovalmidas said:

I am looking at one of the big .bin files. This is currently a very preliminary research, as at this stage all I can do is to recreate the past discoveries by TibEd and other people, before I can break new ground.

As such, this is a very preliminary research. I hope to share this here so in the future, other people can read and save on the discovery (I can also put my research on GitHub or something, but I have not put my mind into that)

 

Here is what I guess the game executable reads the Templates.bin file and splits it into different areas. These structural divisions is fundamental to how the game interprets the bin file. For instance, the game will reserve a block of memory for Unit data, and a different memory block for Building data.

Good to see someone is taking a deep look into this.

I personally wanted to do some research of templates.bin file on my own, but I am quite busy with editor development, so did not really get into this much more than taking a quick look into it in a hex editor. I was thinking of loading this file in editor directly and reading some data from it, like the building and unit names, so editor would display them in UI without need to have building and unit names stored in separate editor's configuration files. But the names in templates.bin are not very appropriate, like Sietch is called as Fremen Barracks and other things like that, so I scrapped that idea.

I can see you are using some good tool for decompiling the code, which looks really nice and useful. I tried to use OllyDebugger and tried to read the assembly instructions directly, when I was examining the possibility to push the limits of events and conditions number. Ended up figuring out the game does not load .MIS file as a whole into continuous segment of memory, but it reads individual sections of file into randomly arranged segments of memory. Some editing of game exe would be definitely needed to increase limit of events and conditions number, and the hardest part is keeping the compatibility.

Adding the amount of building and unit types (without replacing existing) is one thing I wanted to see being possible. There are 100 building and 60 unit entries in templates.bin, so the game designers left really huge reserved space for much more stuff to be potentially added in future. Hopefully we can find a way how to take advantage of it. Thumbs up for your further research.

Share this post


Link to post
Share on other sites
Posted (edited)

Alright, I managed to look into how the game loads the Data.r8 / Data.r16 file, since previous tests determine that playing with unit counts messes with animations, and animations are images, and images come from the data resource files.

 

Here are the results, thus far:

unknown.png

* I suspect UnitTypes and BuildingTypes are simply indices, since they don't appear to carry more data than a name reference. I suspect those two to be relevant to how the sidebar icons are arranged. (e.g. why Wall appears before Refinery)

 

I am not very good at reading assembly, so having Ghidra IDA (it's open source) to decompile to a C-like flow helps a lot. This research has also been made much faster by MVI's old repository where the functions for processing images / BMP / TAR had been discovered, making it much easier to analyze the function loading the data resource file. 

 

Some major findings:

  • In analyzing the Data.R16 file, I discovered an issue with the existing Resource Editor. The editor consumes null bytes so the user does not see them. 
    On the contrary, the game does read the null byte as an empty entry (i.e. nothing is rendered). This is critical, as the game performs precise counting of the number of image frames an object has and read the same number of images in the data resource file to assign to that object. The empty entries act as 'padding', and are very important if we want not to replace entries, but to add to them and modify their ordering.

    For example, Templates.bin specifics 34 image frames for each of the 8 directions for Light Infantry, making a total of 272 images. There are 20 empty entries (situated around the death animations), so the existing editor sees only 252 entries.
     
  • Unit art is different from Unit. TibEd seems to be already aware of this.
     
  • The sections in the middle are all numbers instructing the game how many images are to be loaded for each unit art, building art, projectile art, animation (including explosions) etc. All these are used when the game loads the data resource file.

 

I attach a set of my findings below, in three files (within one zip):

 - A dataR16 folder, which contains the extracted images from the Data.R16 resource file. Each entry is named "test_xxxx_yyyyyy", where xxxx is the image entry ID, and yyyyy is the hexadecimal address of its starting location. Empty entries are represented by 1x1 transparent pixel (actually 0x0 to the game).

 - sym_addenum.txt, which carries my findings for the game loading Data.R16 file, including memory addresses of where each image is sent to. I consider the Data.R16 loading mechanism to be almost fully discovered.

 - Template_bin_sections.txt, which carriers my findings for the templates.bin file (seen in above image). 

dataR16.rar

 

I have also added some code that is able to parse the resource file and include the empty entries: https://github.com/nguoiyoujie/Spice2k/commit/1f3f8ace4f88eaa60ff42473b642da2f0ac9c63d . Credits to mvi, funkyfr3sh and co. for the original resource editor which allowed me to speed up other discoveries. This code was used to generate of the dataR16 folder as attached. (I should make some kind of test suite with the v1.06 files so I don't test on Program.Main()) :D

 

Edited by lovalmidas

Share this post


Link to post
Share on other sites
On 7/1/2020 at 5:43 AM, Fey said:

Looking great so far, loval. I look forward to when you check out unit sounds, because I need to be able to mod those unit reporting sounds! :P

On the unit sounds, if you are using TibEd to edit them, there is a bug:

unknown.png

The true sounds are:

  • AtreidesReporting1 = Reporting1
  • AtreidesReporting2 = Reporting2
  • AtreidesReporting3 = Reporting3
  • HarkonnenReporting1 = Reporting4
  • HarkonnenReporting2, (absent in TibEd)
  • HarkonnenReporting3, (absent in TibEd)
  • OrdosReporting1, (absent in TibEd)
  • OrdosReporting2, (absent in TibEd)
  • OrdosReporting3 = Reporting5

Each values takes an integer represent the sound ID.

 

The highlighted region to the right (hex 0x6C to 0x7B) are not seen in TibEd.

That could be the reason why you were unable to edit some reporting sounds.

At this time, while there is no template editor yet, you can use a hex editor to fix those values: 

  • HarkonnenReporting2 location = N * 0x100 + 0x6C, 
  • HarkonnenReporting3 location = N * 0x100 + 0x70, 
  • OrdosReporting1 location = N * 0x100 + 0x74, 
  • OrdosReporting2 location = N * 0x100 + 0x78, 

where N is the UnitID

 

Share this post


Link to post
Share on other sites
2 hours ago, lovalmidas said:

The highlighted region to the right (hex 0x6C to 0x7B) are not seen in TibEd.

That could be the reason why you were unable to edit some reporting sounds.

At this time, while there is no template editor yet, you can use a hex editor to fix those values: 

  • HarkonnenReporting2 location = N * 0x100 + 0x6C, 
  • HarkonnenReporting3 location = N * 0x100 + 0x70, 
  • OrdosReporting1 location = N * 0x100 + 0x74, 
  • OrdosReporting2 location = N * 0x100 + 0x78, 

where N is the UnitID

Awesome!! I'm so glad to know this is possible. I'm gonna have to contact my VAs and ask for more lines. Man, they're gonna hate me. 😅 But this is gonna be so worth it!!

Share this post


Link to post
Share on other sites

So I was doing some research of Building Template data, the meaning of all the byte values. Some values are already covered by TibEd, all the others are available on the Unknown tab in TibEd. I concentrated on meaning of those unknown values.

Here is my research do far. Letter B means a single-byte value, D means "Doubleword", a 4-byte value (marked as Long in TibEd).

Spoiler

D   0 Strength (hit points)
B   4 ?? (side bitfield)
B   5 ?? (various values 1 - 8)
B   6 ?? (only zeros)
B   7 Range of fire (by TibEd)
B   8 Crewed (by TibEd)
B   9 ?? (only zeros)
B  10 ?? (only zeros)
B  11 ?? (only zeros)
B  12 Primary weapon (weapon type)
B  13 Secondary weapon?? (by TibEd) (weapon type, 255 on everything)
B  14 Armor type (by TibEd)
B  15 ?? (1 on turrets, 0 on everything else)
B  16 Tech level required for build
B  17 Tech level required for upgrade
B  18 ?? (255 on everything)
B  19 ?? (5 on heavy factories except mercenary, 255 on everything else)
D  20 Building art index
D  24 Barrell art Index
D  28 Build cost
D  32 Upgrade cost
D  36 ?? (only zeros)
D  40 ?? (200 on heavy factories except mercenary, 0 on everything else)
D  44 Build speed (by TibEd)
D  48 Upgrade speed
D  52 ?? (50 on heavy factories except mercenary, 0 on everything else)
D  56 ?? (50 on heavy factories except mercenary, 0 on everything else)
D  60 Power consumption/production
D  64 Prerequesite building 1 (building type index)
B  68 ?? (side bitfield)
B  69 Prerequesite building 1 upgrade needed (1 = yes, 0 = no)
B  70 ?? (only zeros)
B  71 ?? (only zeros)
D  72 Prerequesite building 2 (building type index)
B  76 ?? (side bitfield?)
B  77 ?? (only zeros)
B  78 ?? (1 only on LARGE GUN TURRET, 0 all other)
B  79 Destruction explosion (explosion index)
D  80 Tiles occupied by building - all tiles (tile bitfield)
D  84 Tiles occupied by building - solid tiles (tile bitfield)
B  88 Animation flags (64 = has animation, 16 = continuous animation)
B  89 Flags? (1 = ??, 2 = building is selectable, repairable, will be set on fire when damaged and will release infantry when destroyed , 4 = ??)
B  90 Flags (32 = draw building bottom, 64 = do not decay without concrete + do not create concrete (used on Sietch), 128 = ?? (used on light, heavy and hi-tech factory))
B  91 ?? (only zeros)
B  92 ?? (various values)
B  93 ?? (various values)
B  94 ?? (only zeros)
B  95 Sight (by TibEd)
B  96 Building exit point 1 X coordinate (MEDIUM GUN TURRET, LARGE GUN TURRET has strange value 248)
B  97 Building exit point 1 Y coordinate
B  98 Building exit point 2 X coordinate (HARKONNEN PALACE has strange value 60)
B  99 Building exit point 2 Y coordinate (HARKONNEN PALACE has strange value 247)
A 100-131 Direction frame mapping
B 132 ?? (only zeros)
B 133 ?? (various values)
B 134 Width (pixels)
B 135 Height (pixels)
B 136 Building type index
B 137 ?? (flags?)
B 138 Buildup animation index
B 139 Animation index
B 140 ?? (explosion index? - 46 = MUZ_GTUR on MEDIUM GUN TURRET, 255 on everything else)

 

I was playing around with these values:
D  80 Tiles occupied by building - all tiles (tile bitfield)
D  84 Tiles occupied by building - solid tiles (tile bitfield)
and there are very interesting and funny results:

Any crazy shape concrete:

s5OOQa7.png

Yay, a 4x4 concrete, very useful:

kg8RNEw.png

A compact 2x2 windtrap. More Retro-Dune2 style, isn't it?

j0LoHDT.png

Then I took advantage of this:
B  90 Flags (32 = draw building bottom, 64 = do not decay without concrete + do not create concrete (used on Sietch), 128 = ?? (used on light, heavy and hi-tech factory))

Using value 64, I was able to made a building that won't decay without concrete. So we can finally screw concrete on other planets where it does not make sense, a la Red Alert!

8nwgVv5.png

Probably someone of you ( @lovalmidas? @Fey? @Cm_blast? @Feda? ) already know meaning of some of the unknown values. For example I noticed you were able to make wall selectible with health bar and shift the selection frame. If you have such knowledge, I would appreciate if you share it here.

I also made a complete table of buildings and all the values, which helped me a lot to discover meaning of those values. Here it is, it might be helpful for you too:

buildings.txt

One thing that I cannot still figure out is, how the game determines specific house's version of building, meaning, if you play as Harkonnen, you can build Harkonnen-style buildings. It looks it has something to do with the "Owner" bitfield, but there's some logic behind this I still don't understand.

Share this post


Link to post
Share on other sites

The "+" or 4x4 concrete shape it's interesting indeed.

I did the windtrap being a 2x2 once, really long long time ago when I was trying to replicate dune 2; In Tibed there is a "Width-Heigh" values so the 2x2 windtrap was not something hard to do.

About the building without concrete and no decay + 100% health that's something that I figure it out when I made my Dune Emperor: final assault; the enemy Construction Yard you are to destroy have these conditions, the same as with the "tleilaxu turret", although if today you ask me how I did I forgot already (I know that are part of some bytes, but since that was an edition from like years ago hard to remember all the details on Tibed).

1 hour ago, Klofkac said:

One thing that I cannot still figure out is, how the game determines specific house's version of building, meaning, if you play as Harkonnen, you can build Harkonnen-style buildings. It looks it has something to do with the "Owner" bitfield, but there's some logic behind this I still don't understand.

Something that I see happening (if I remember well); if you have the harkonnen light factory not owned by anybody and you place into the editor, I think the game will give you the Ordos instead (or Atreides, just one of the other two).

In tibed you can see the ownership of all the buildings in the program, but even it's a bit mess up.
The Imperial Construction Yard, separated for the Harkonnen version, it's owned by the Emperor only, but the Harkonnen construction yard it's also owned by the Emperor.

If using an editor, if you place an Imperial CY, it will deploy all the buildings except the High Tech (as it ask for his specific CY, which it's the Harkonnen one, not being the same) and the Harkonnen Palace, same deal.

However, if you deploy a MCV, the game pick the Harkonnen CY version instead, meaning that you can deploy those buildings.

At least on Tibed, there are two requirements, the first ask for the generic building (it needs "whatever" Construction Yard), and the second an specific building (it needs "Certain" Construction Yard).
windraps have the CY as first requirement; doesn't matter which CY you captured, you only need the building "generic" to produce it, but you will deploy the one you are owned with.
but the Atreides High Tech Fact have it as secondary requirement, so it means it requires the Atreides Construction Yard, not any construction yard.

But it happens something similar with the sardaukar and his multiplayer version, because it is a bit messy, any side but Harkonnen will produce the campaign Sardaukar one (120 credits), while the Harkonnen will train the 200 credits one, even if this is a campaign mission; and it is all because the MP sardaukar it's owned by Harkonnen only.


Overall, all the ATreides kind of buildings are owned by both Atreides and Fremen
all the Harkonnen buildings are owned by Harkonnen/emperor (except the heavy fact)
and the Ordos kind of building are owned by the other three factions, even the heavy fact, but the game picks the "mercenary" version, but tecnically both are owned by the mercs, it's just that the game picks the other first, I guess because the order that the buildings are indexed? <-- same with the starport and smugglers, Smugglers have the Ordos one owner too, but the game still picks the smuggler version first.

The sandworm it's the deal that I first wrote; they don't own a single building in the game (although it is called "other"), yet they can still build everything as the Atreides with the exception of deploying a MCV, as the game try to search for that building and crash since he don't own that building.

But if the CY it's on the spot... well, he will deploy the windtraps and everything else just fine, probably programmed to be "Atreides" and as Atreides are the owner of that tree of buildings he will build them all, it's just with the CY that the game totally try to search the CY owner by "Other" and fail to do.

But if you actually give ownership you can mix tech; nothing crazy, just adding the "other" into whatever building, just as I did here:
275049909_IxMixedtech.png.18671ef8c88a057e8d4e4d90b5c15d46.png

It is not a heavy edition or a mission based, I just tried to do that, and simply picking "onwer by other" all those buildings all worked fine. Except the HTF maybe, either I forgot or I have problems to know how to make it work since this "faction" cannot build carryalls from the Atreides HTF; it gets stuck trying to build (grey queue), no idea what it happens (but only on the Atreides version), so who knows.

To summarize, the buildings have those 2 requirements, first it's the "generic" building, and the second it's the "specific version of the building".
the HTF and the palaces are the ones that changes based on which version of the Construction yard you have.
Ix and Rocket turrets tecnically depends on the kind of outpost, but since the three versions all look the same in the game it doesn't matter.

I hope anything of this help you.

The other parts with the walls being selectable, I leave that to Fey; at some point he told me, but I cannot remember exactly all that he did.

Edited by Cm_blast

Share this post


Link to post
Share on other sites

Well I would like to know how to make the Windtraps like Dune2. I tried in Tibed to adjust the height and that didn't work, I also tried the unknown settings same thing it didn't work. I can't find the exact change needed to make a 2x2 square without some sort of issue. The setting to 64x64 pushes the windtrap up and removing the 3 from unknown 81 makes a 2x2 square but the when placing the windtrap it still shows the third row as used on the ground but you can place another building in that spot. I would prefer to have a clean 2x2 placement just like the normal 2x3 placement.

Share this post


Link to post
Share on other sites
6 hours ago, Cm_blast said:

Something that I see happening (if I remember well); if you have the harkonnen light factory not owned by anybody and you place into the editor, I think the game will give you the Ordos instead (or Atreides, just one of the other two).

In tibed you can see the ownership of all the buildings in the program, but even it's a bit mess up.
The Imperial Construction Yard, separated for the Harkonnen version, it's owned by the Emperor only, but the Harkonnen construction yard it's also owned by the Emperor.

........

Yeah, I'm confused from this as well. But I did not do yet any experimenting changing the owner values and testing in-game, I was just looking at the values. Thanks for sharing your experience, these are indeed useful information for me, which make the ideas more clear to me. For example the information about first prerequisite being whatever type but second prerequisite being specific type, is really interesting. I hope I will manage to decipher the game's logic behind selecting the proper "version" of building when placed in editor, primarily I need this for editor to be able to draw buildings correctly without telling it explixitly "for this side use this version for building". But knowing how that exactly works, will move us ahead in the modding possibilities as well.

1 hour ago, firefly101 said:

Well I would like to know how to make the Windtraps like Dune2. I tried in Tibed to adjust the height and that didn't work, I also tried the unknown settings same thing it didn't work. I can't find the exact change needed to make a 2x2 square without some sort of issue. The setting to 64x64 pushes the windtrap up and removing the 3 from unknown 81 makes a 2x2 square but the when placing the windtrap it still shows the third row as used on the ground but you can place another building in that spot. I would prefer to have a clean 2x2 placement just like the normal 2x3 placement.

Well, you need to do one more change in addition what you did: change Unknown 90 from 32 to 0 and you should get done.

Share this post


Link to post
Share on other sites

@Klofkac My power will be out for a while due to major storm damage in my area, so I may be a bit inactive, but I got the ping and I'll post some junk I know about the unknown bytes in TibEd here. All IIRC:
 - Bytes 10 and 11 have something to do with buildup animation.

 - 138 and 139 have something to do with animations, like the glow of a Wind Trap or the spinning of an Outpost dish. There's another byte that controls if it's always there or only there if the building is performing an action, like how Research Centres always glow and Heavy Factories only glow if they're building a unit. I think that byte is 90 - byte 32 is passive animation, +128 (160) makes the animation play only when the structure is doing something.

 - Byte88 is a bitmask of some sort. For those unfamiliar, it means the bytes form some kind of formation of 1s and 0s and the 1s determine what settings are switched on in the bitmask. For instance, 80 in binary is 10100000, so 64 says there's an animation and 16 says the animation always plays. 80 is 16 and 64 combined. There might also be some other animation-related behavior in Byte90...

 - Byte5 is armor. It refers to the index of armor under armor types. For instance, if Byte5 is 2, 2=BUILDING in the armor index, so it would give the structure "BUILDING" armor.

 - Long48 is upgrade speed. To get the time in in-game seconds, take 922 divided by the value in Long48. For example, if the Barracks has a Long48 of 54, that would be just over 17 seconds in in-game time to fully upgrade the Barracks, or ~427 tics.

 - Bytes 80 and 81 have to do with the space a structure needs, while 84 and 85 have to do with the actual space the structure takes up. I'll give an example involving the Heavy Factory:
114
119
114
7

Are the values for Heavy Factories. In binary, the game reads them like this:
0 1 0 0
1 1 1 0
1 1 1 0
1 1 1 0

0 1 0 0
1 1 1 0
1 1 1 0
0 0 0 0

The first formation is how much space the structure requires. The second formation is how much it obstructs, and also where the concrete beneath the structure will apply protection from the environment. So if you want to make the tile just in front of the factory walkable and remove its concrete requirement, you would change byte 85 to 6 and get this:

0 1 0 0
1 1 1 0
0 1 1 0
0 0 0 0

See how that works? :P

 - Bytes 96, 97, 98, and 99 are related to where the unit spawns in a structure and where it goes after it's spawned. If they bytes for a Barracks are 1,1 and 1,2, the infantry will spawn here:

0 0 0 0
0 1 0 0
0 0 0 0
0 0 0 0

And will walk here:
0 0 0 0
0 0 0 0
0 1 0 0
0 0 0 0

 - Byte92 is a value that has something to do with the kind of structure it is. A Barracks doesn't just train infantry because its behavior is a Barracks. Its Byte92 is related somehow.

 - Byte89 is another bitmask controlling some other behavior. 1 controls if the structure takes environmental damage, 2 controls a bunch of other stuff like selection, sabotage capability, and repairs, 4 controls if the structure can be captured, and presumably some other stuff too.

That's all I remember off the top of my head. Hopefully correctly! This was all through experimentation, no digging through the files, so I hope my own findings are, uhh... I hope they sync up with your findings too, or whatever. :)

Edit: Oh, you asked about the walls specifically. Yeah, that involved turning walls' Byte89's bit 2 on. It also took a bit of graphical work to get the selection boxes perfectly aligned on every frame.

Edited by Fey

Share this post


Link to post
Share on other sites
10 hours ago, Klofkac said:

Well, you need to do one more change in addition what you did: change Unknown 90 from 32 to 0 and you should get done.

Thank you, I tried that and it worked. I knew it was possible as I seen a video somewhere where it was done. But I wasn't sure on the work around. I know editing the 64x96 to 64x64 does nothing but raise the image up out of its footprint. But the Unknown bytes were the key I just looked at the Fremen Barracks and noticed 51x51 but 81 had 0 instead of 3 like the windmill. I changed to 0 and then seen the 2x2 footprint, but the graphic for the 3rd row was still popping up. Changing byte 90 to 8 or 0 worked. Thanks a bunch.

I'm still trying to work out how to move the menu box in the UI so I can make a 1024x768 image for the main screen.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...