Closed tnevolin closed 3 years ago
I don't remember how this was patched in your code or if I have even looked at it. If it's considered a bug in the game and you can produce a source code patch for it, I can merge the functionality here. So that would be helpful.
Adding config options for player starting units also is possible... have to look into it.
The bug and fix is tricky. So I have to describe it in few words.
Vanilla runs [.text:005B0420 balance] function from setup_game. This function analyzes each faction start locations (including late starters) and grant them extra colony if it decides so. Unfortunately for late starters, game also deletes all their units to simulate they are not yet started. The game then runs setup_player for them when it is time for them to appear. However, at that point, extra colonies given by balance are lost and balance is not run again as it affects all players and would screw existing ones up. As a result they miss bonus colonies.
Here is the tricky thing I did. https://github.com/tnevolin/thinker-doer/blob/86b1b03f6b660f779cc5e7455eb2b77a0199d047/src/patch.cpp#L170 When game runs setup_player for late starters it passes the -282 as second parameter to it. I detect that and call balance again to force it generating bonus colonies. To make it work for this designated faction only I set global variable to faction ID and intercept veh_init call. https://github.com/tnevolin/thinker-doer/blob/86b1b03f6b660f779cc5e7455eb2b77a0199d047/src/patch_wtp.cpp#L2224 And check this global variable to create vehicle only for designated faction during this call.
You are welcome to make it any way simpler than that.
So I added player_free_units option there, but does it make sense to separate it into player_free_colonies and player_free_formers? I'm not sure if any player asked for it, not to mention having it to spawn satellites for players. Probably unnecessary.
I don't think so. It is too fine grained tuning. There is no need to distinguish human and computer players bonuses/restrictions escalating visible inequality. Difficulty settings already do that pretty well.
In WTP I didn't introduce such things and I tried to nullify all such differences inherited from Thinker.
It does not fix incorrect number of colonies given to late starting factions. I had this fix in WTP before but now I am retiring this code in favor of subject one. Therefore, I need to reintroduce this into the flow somehow. Would be simpler to integrate it in Thinker code since it started take care of player setup.
Suggestion Thinker offers free formers and colonies to computer player. I've got a lot of feedback from players that they want same too. Would be nice to treat everybody equally or to introduce more parameters controlling how many free units human players receive.