UnofficialCrusaderPatch / UnofficialCrusaderPatch2

Unofficial balancing patch installer for Stronghold Crusader 1
MIT License
430 stars 59 forks source link

Extend maximum number of troops #993

Open DavidJ75 opened 2 years ago

DavidJ75 commented 2 years ago

Hello, when you start a game with 7 opponents the maximum number of troops (I find) is severely limited by this. If the feature would be desired, could someone implement it?

The calculation of the maximum troop count is at 0x059E50: B8 60 09 00 00 99 F7 FE 5F 5E 83 E8 28

and is currently composed as follows: [2400] / [number of players left] - [40] B8 [60 09] 00 00 99 [F7 FE] 5F 5E 83 E8 [28]

If you just want to set the maximum troop count to 2400 for ALL players (no matter how many players are still alive) replace the part as follows: B8 60 09 00 00 99 90 90 5F 5E 90 90 90

Greetings DavidJ75

gynt commented 2 years ago

Hi David,

That is a fun idea. Have you tested what happens if you apply the patch? Do players spam slaves or other units in order to claim the largest portion of units?

Maybe it is an idea to make the portion stricter and fixed per map: 1 v 1 should then play with the same size armies as 1 vs 7.

J-T-de commented 2 years ago

Without checking, I guess that this only affects the human player (probably not even for online play). I got the impression AI will recruit more than their "fair share", one would need to check.

So I see this more as making the game less challenging by removing the human unit cap, or better, more challenging by making it even more challenging by letting a human only have, idk, 150 units. Skirmish trail with only so much units sounds extremely fun.

But yeah, one could implement this if it is the full story.

J-T-de commented 2 years ago

I can confirm my suspicions: At address 0x00459E10 in Crusader 1.41 Steam edition, we can change the maximum army size for the human lord. The opposing snake didn't care about the army limit, though. We would need to check if the same mechanic is actually active in multiplayer (from the code I saw it does not look like it) or if we could enable this in multiplayer (if people care)...

Ah, und falls du (@DavidJ75) kein englisch verstehst würde ich das geschriebene auch übersetzen. LG.

DavidJ75 commented 2 years ago

I tried a 1vs7 match against AIs. So I build my castle and hold it, to see what's happening. The AI is attacking normaly with bigger and bigger armies, like in an 1vs1 match.

BUT now there are around 100-200 troops created by the AI and I've createt 500. It seems now the cyrcle at the campfire is always filling, but there is not always a farmer spawning in there. So the game could have declared a maximum value/array of humans (farmer/soldier/...).

I will try to figure out where to increase the declaration-value (if it is possible) and edit the main post.

J-T-de commented 2 years ago

This sounds like you hit the global unit limit of normal crusader, which is 2000? like 500 + 7 * (100 to 200) sounds like it. Your proposed solution will only change the limit you are allowed to recruit, not the total 2000 unit limit. This I can safely say... The game structure really does not allow for more...

DavidJ75 commented 2 years ago

By default 2400. In Extreme it is set by 9900 (at 0x05A040). So there must be a part where the memory is reserved for the human entities.

I don't know why they didn't increased it in the HD-Update. I understand why they limited it in the v1.0, because most computers in time where Crusader came out wouldn't have handled that.

J-T-de commented 2 years ago

There is no part reserved for entities for the human players. The game has allocated space for 2500 Unit in Crusader, including all NPCs and such. Before you recruit, the game checks if you hit that hard 2500 unit cap and afterwards checks if you hit the maximum army size. The units are saved in an array at 0x0138854c with entries of length 1168. For Extreme, they just made this array larger to account for more units.

To check this, you can just run the 1 v 7 game and wait until you hit that unit cap. You will not be able to recruit units, even though you did not hit the army cap.

Nevertheless, it is definitely an interesting find ;)