Jump to content

Static pre-placed crates patch! (proof of concept)


Recommended Posts

Hello, so thanks to big help from tomsons26 and his decompiled Dune2000 source code, I was able to quite easily achieve something we always wanted to have in Dune2000: Static pre-placed crates in a campaign map!

obrazek.png.5dfdc13f3d27d455ce9b63a2adbcf887.png

I patched the Dune2000 executable with assembly editing in OllyDebugger and replaced all 5 spice bloom types (specials 41-45) with cash, map reveal, bonus unit and stealth crate, as well as static one-time spice bloom. Technically it is possible to place crate of any of 6 types, with any of 4 color schemes, either non-disappearing or disappearing after some time, via a special value placed on map. The meanings of special values 1,2,3,23,41,42,43,44,45 are hard-coded in executable, so it would need a customized patching for a specific crate type you want, unless a more sophisticated mechanism is implemented.

Here is the exe + demonstration map for download: Static Crates test.7z

This is just a proof of concept where I'm trying to show that this is technically possible, but not practically usable in this form. Some proper patching (i.e. adding support without ovrewriting spice bloom special values) will be needed, probably with help from tomsons26. The executable I used as base for modification was the exe distributed within Gruntmod's edition, we'd need to clarify which is the most appropriate exe to use as base for further modifications.

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

we always wanted

Yes. Thank you!

3 hours ago, Klofkac said:

via a special value

Can't this be configured in the tiledata.bin? There are some special values that are pretty much unused, like the extremely thick Spice. I think that one is on value 3. We could replace that with something, could we not?

Maybe we can bug Gruntlord about an exe update in his installer to get more options in. :P

Link to post
Share on other sites
Posted (edited)
On 4/4/2021 at 1:49 AM, Fey said:

Can't this be configured in the tiledata.bin? There are some special values that are pretty much unused, like the extremely thick Spice. I think that one is on value 3. We could replace that with something, could we not?

Nope, it is only possible to configure buildings and units through tiledata.bin. Other special values (thin spice, thick spice, superdense spice error, player start flag, spice blooms) are special cases which are handled in specific way in the executable, or in other words, the behavior of those special values is hardcoded in executable. And crate placement is implemented in pretty much same way as spice bloom placement.

Edited by Klofkac
Link to post
Share on other sites

Just for info. I managed to patch the game, so that you can pre-place more than 1000 structures (buildings, units) in total in a map. The limitation of 1000 structures per side remains, but this will definitely help.

After I finish release of D2kEditor 2.0, I will concentrate on game patching in order to add some new features (like static crates) and further versions of D2kEditor will reflect these changes.

Thanks to The Code Conquerors group for their activities, which help me significantly with this.

  • Like 1
Link to post
Share on other sites
4 hours ago, Klofkac said:

Just for info. I managed to patch the game, so that you can pre-place more than 1000 structures (buildings, units) in total in a map. The limitation of 1000 structures per side remains, but this will definitely help.

Just want to point that even if you could place 999 structures per side, the game may not handle that too well.

On my Coalition of Nobles I was nearby the 1000 total structure/unit limit, and when loading the game I found out that the AIs were getting their building side bar grey, which means that they couldn't rebuild any structure, even if I started selling building after building. It just happens, 3-5 seconds into the game and bam, grey side bar.

I went over the top with that mission, Ais used to have 5 heavy factories, 3 Ix centre, 9 refineries... But after I was spying on the enemy Ais using debug mode I realize what was happening to them. I kept restarting the mission and using debug but every single time at least 1 enemy AI (most the time, 2 enemy ais) got the building list in grey.

Only after I removed lots of buildings, getting rid of those extra copies (3 Heavy factories instead of 5 and so on), with the game having 900 total structures that bug doesn't seems to appear anymore. And this is 900 total structures considering that there are 6 ais into the game, so the amount of buildings is splitted bewteen 6; much less than "900" per side and the Ais already were bugged, I cannot imagine what happens if you actually give them 900 structures to one side, and 900 to another side.

So careful with the structure limit patch because it may have side effects in game, even if it seems to run fine.
 

Even recently (and I mean during the creation of the Coalition of nobles) I discovered that if an AI doesn't have enough money to do an order on the Starport it will try to do one anyway, game will trigger the "not enough funds" dialogue and the starport selections units got in grey, which means that this Ai's starport is disabled, unless a delivery is scripted, the AI cannot order anything for the rest of the game.

After all these years of playing and doing campaigns and I still found new bugs and issues I wasn't aware of. And this happen on vanilla missions too. The AI may not try to do an order at all because usually (usually) waits until the "silos needed", but if you get a vanilla mission running, and start wasting money quickly, it can trigger too.

So, if you patch the game, you need to actually try it, using debug and check what happens with the AI. Their structure list may get in grey, but it could even affect the unit side bar too, you will never know.

Edited by Cm_blast
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...