Jump to content

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


Klofkac

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.

  • Upvote 1
Link to comment
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 comment
Share on other sites

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 comment
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
  • Upvote 1
Link to comment
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 comment
Share on other sites

  • 2 weeks later...
On 4/3/2021 at 1:20 PM, Klofkac said:

proper patching

Ayyo Klof, Funky said he'd integrate an exe patch to C&Cnet for the static crates. We should come up with an exe using those crates ASAP!

I see you have an exe in the download there, but it's impractically designed, yeah? Only there for demonstration purposes. Well, I hit up some folks and the consensus is that we utilize the five available spaces (there are only five, right?) for the following specials (all permanent, non-expiring):
 - Spice bloom
 - Cash crate
 - Reveal map
 - Random unit
 - Stealth pickup

Having asked about colors, it seems we like green crate for cash, blue for reveal map, red for random unit, and purple for stealth. Could I trouble you to set this up in the exe for implementation?

Given that we have C&Cnet and Gruntmods implementation, we now have support for an exe mod like this. :) How exciting! There are, however, a couple of lingering questions: If crates are implemented, do they contribute towards the 30 bloom limit? Will overwriting the existing special values for temporary Spice blooms (which no one uses lol) break maps that have used them (for some reason)? Could these be implemented without overwriting anything with a new system like the one you described, adding more special values? Also, what determines what the "random unit" crate will give? Obviously, certain units like the Starport Frigate don't spawn from such a crate. So can the units that spawn from the crate be changed?

Thanks very much, Klof. I'll relay the finished exe to Funky and gruntlord whenever you find the time to fix that up real quick. :D

Edited by Fey
Link to comment
Share on other sites

Hi, sorry, I can't really manage this during this weekend (maybe next week). There's more stuff I wanted to add into the patch than only the static crates. Why to hurry so much with this? And you somehow managed to contact Funky? How? I'd probably like to talk to him myself, if possible.

Here are some answers from me:
- There's not any strict limit on how much crate types you can impmement. With deeper exe patching you can give any number of special values any meaning (any combination of crate behavior and graphics). So you can have all 6 basic crate types + I got idea for an "invisible mine" (exploding crate with no image) + you can place also static spice blooms, because crates and spice blooms are done in same way in game.
- Yes the static crates would contribute 30 spice blooms limit (or at least I believe so, did not test that yet)
- We do not need (and should not) overwrite any existing special value because it would break vanilla missions which use limited spice blooms
- Dunno about the "random unit" implementation, there's some game logic behind this which we would need to examine and modify if needed

Link to comment
Share on other sites

29 minutes ago, Klofkac said:

hurry

Well, Funky said he wanted to look at it tomorrow, but also I'm just excited about this concept. :D Sorry, take the time you need.

Funky is on the multiplayer Discord server. I directed him towards this thread, and he took an interest in it, but I'll add that you'd like to speak with him personally. tomsons also wants to speak with him, so, uhh, yep.

Thanks for answering those questions! I was very curious about all that, as were some others.

Edit: Here lol in case it helps
stuff.thumb.png.bae43d52b964790098d0b7b40872b702.png

So I linked him to your reply here in this thread and mentioned that you're busy at the moment, but have been made aware that Funky has been made aware of the crates thing. Here's the full post down there:
255417135_myreply.png.e4463dfb49f348d6e925b88d1ae0f2a7.png

I'm sure you understand what tomsons said there too, so, uhh, hopefully that gets everyone on the same page lol

Edited by Fey
Link to comment
Share on other sites

@Klofkac I could probably give you access to the source code but I have to talk with all the cncnet regulars first to see if they're ok with it. Most work was done for the multiplayer community so they have to be ok with it. There should be no cheats or any kind of automated gameplay, nothing that would have any negative impact on competitive multiplayer. You would have to stay in contact with the multiplayer regulars to ensure there are no changes made that would turn into their disadvantage, ideally you would actually start to play some multiplayer with them to get to know them and get a understanding of how they're playing the game and what it's all about.

Link to comment
Share on other sites

8 hours ago, FunkyFr3sh said:

no cheats

That sounds pretty fair. But hey, if it's literally only going so far as to add the ability to place crates on a map, isn't that pretty innocuous already? :P

:D I'm excited to see where this goes!

Link to comment
Share on other sites

16 hours ago, FunkyFr3sh said:

@Klofkac I could probably give you access to the source code but I have to talk with all the cncnet regulars first to see if they're ok with it. Most work was done for the multiplayer community so they have to be ok with it. There should be no cheats or any kind of automated gameplay, nothing that would have any negative impact on competitive multiplayer. You would have to stay in contact with the multiplayer regulars to ensure there are no changes made that would turn into their disadvantage, ideally you would actually start to play some multiplayer with them to get to know them and get a understanding of how they're playing the game and what it's all about.

Oh nice to see you again @FunkyFr3sh, we all thought you were gone for good. Thanks for showing up here and offering me the source code.

If you're on Discord, maybe we could discuss it further there?

Edited by Klofkac
Link to comment
Share on other sites

11 hours ago, Klofkac said:

Oh nice to see you again @FunkyFr3sh, we all thought you were gone for good. Thanks for showing up here and offering me the source code.

If you're on Discord, maybe we could discuss it further there?

 

I've been online pretty much every day, also been working on some patches recently. We're all in dato's discord server: 

https://forum.dune2k.com/topic/28089-dune2000-discord-server

 

Edited by FunkyFr3sh
Link to comment
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...