Open azum4roll opened 1 year ago
there was also the information that GW swapping leads to desyncs in multiplayer ... so of anyone is going to touch this, please also fix multiplayer.
personally i think auto-optimize should be active always. nobody needs a manual mode. then we could drop the UI part completely and maybe solve the multiplayer issue en passant. simple.
I redid the swaptimize code years ago…that whole class is a nightmare of boondoggle code. The problem is that is so many of the variables are stored in special containers that aren’t easy to reference without a ton of lookups. I welcome optimization but good luck.
The desyncs may be a consequence of my hijacking of the swap functions in the network class to make the event system MP compatible. Might be worth a check.
An update: Priority has been updated across the theming buildings in the merge. OP has been updated to reflect my knowledge of the code.
I think it belongs here since it's not a balance change, only QoL and AI optimization.
Add the followings to the theming screen:
Turn flow (if it doesn't already work this way): At turn start, the player should auto optimize based on the option selected (AI should always swap&optimize). At turn end, the player should place a randomly-picked GW of each type (unthemed, unlocked) to each swap slot.
Optimizing the Optimize algorithm: This is the current order of theming slots: (1) Buildings in not endangered non-puppet cities, don't consider swapping (2) Buildings in not endangered puppet cities, don't consider swapping (3) Non-music buildings in not endangered cities, consider swapping (music can't be swapped) (4) Buildings in endangered cities, don't consider swapping Don't put any GW in cities that are about to fall (CvCity::isInDangerOfFalling(true))
Endangered = lower than half HP or under 3 population in a city being razed for the AI; any damaged city for human. Capital is never endangered (which is how we can grab so many GWs off capitals I guess). Priority (from Building_ThemingBonuses) is followed within each bracket.
Assuming the priority is perfectly designed (it isn't and will never be, but I tried), this should have no problem other than below:
10440 Oxford University is never themed because Amphitheaters will almost always be themed by (1) and (2), and GW of Writing swaps will never be performed as a result. Similar with 4-slot buildings being hard to theme in general despite being high priority.
Maybe we should just always consider swapping for AI, and for the human if Swap&Optimize is used? Change the order to: (1) Buildings in not endangered non-puppet cities, consider swapping (2) Buildings in not endangered puppet cities, consider swapping (3) Buildings in endangered cities, don't consider swapping
This will resolve problem 2 above.