Logo Platform
logo amplifiers simplified

Full feedback on AI changes on 1.5.58 - prepatch preview

Reply
Copied to clipboard!
a year ago
Dec 1, 2023, 10:25:23 AM

I carefully checked and tested all of the changes. In the grand scheme of things, all the errors noted here doesn't have a huge impact, in the sense the DLLs will not generate crashes or things of the like, and many of the important AI improvements and fixes are working as expected.


Missing Gains (Assembly-CSharp.dll):


Probably important to mid-late game as Microwave Pipes is one of the best buildings of the game. The others have much less impact.


- "PlanetFIDS" doesn't get gains. (PlanetImprovementFIDS3)

- "PlanetFIDSI" doesn't get gains.(StarSystemImprovementVictoryWonder1, StarSystemImprovementFIDSI1, StarSystemImprovementUniqueStartingImprovement)

- "NetSystemManpower" doesn't give ManpowerGain. (StarSystemImprovementWonder4)

- "EmpireResearch" doesn't give ScienceGain. (StarSystemImprovementWonder1)

- "Upkeep" doesn't give DustGain (StarSystemImprovementQuestRuinsCravers)

- "EmpireManpower" doesn't give ManpowerGain. (StarSystemImprovementPopulationSlot2Vampirilis)


Importance: 3/5.


AI improvements port into AI core DLL:


SmallInvaderRoleMissing.cs


Missing the set of the variable on the getContexts. Will be an issue on a game load when the variable needs to be set again, leading to multiple ship designs for invader.


Importance: 2/5.


ComputeShipDesignComposition.cs


Designated support modules for explorer role ships is added twice, not a big issue, worst case scenario Horatio and any other very flexible scout ship will have no defense modules.


Also a few categories with missing elements, or wrong order, this also is not a big issue, as the important ones are there.


Missing the UpdateModules call,  only exists on the support modules section. This one is important, is missing on the weapon and defense modules part, is responsible to track what was previously installed, as one of the main goals of the changes here is to prevent the AI to starve themselves loading lots of strategic modules, also doesn't make the shield and hull plate distribution.


Importance: 5/5.


HarvestBestSystem.cs


The call to this.GetHarvestGain should be done after some conditions are met, not a big issue, some miliseconds of un-needed computation.


Importance: 1/5.


ModuleDecisionHelper.cs


Lack the condition of one-only modules for non strategics. Not a big issue, but AI will fill their ships with swarm missiles at times.


Importance: 2/5.


QueueTechnologyForIncreaseModuleEfficiency.cs


"WantedModuleFamilly" category array lacks all the categories for the Ark modules. Still works, as there's still a module level comparison, but should be there (due to modding and maybe future changes).


Importance: 1/5.


SearchAllColonies.cs


There's an additional code logic that shouldn't be there, it works as intended anyways, but that one adds a lot of unnecessary computation. (tested)


Importance: 1/5.


As before, I provide my edited code, as well as the original disassembled code as reference, you can compare both with a merge/compare tool (IE WinMerge) to see the exact changes, and apply those into the source code.


The code files: reviewed-code.zip


Lastly, a legal disclaimer in the case it is needed: I give Amplitude and their collaborators full permission to use and modify my code if there's any intellectual property held into it, not covered by the game's terms of service.


Thank you.

Updated a year ago.
0Send private message
a year ago
Dec 1, 2023, 3:52:26 PM

I've implemented all these changes, other than Upkeep in Gains, due to the chance of unintended consequences.

Is nice to have had your additions, even if as the codebase is so different before being compiled much of it needed rewriting to fit. Certainly has been worth the effort!

Have some fun facts on that;

-(You probably know) all variables have proper names, they are just stripped down when compiled

-Almost all strings in code are actually refs to const strings, all stored in only a couple of classes
-Most if statements become inverted and merged or nested
(In original code there is a lot of If(x) continue; If(y) continue; which becomes if(!x && !y) do everything)

0Send private message
a year ago
Dec 1, 2023, 4:05:54 PM

Thanks Cyrob, you're our hero!


The AI won't be that much better, but at least fully operational and a tiny bit more competent on what it already does.


Yeah, as an old C# programmer, and seeing how the code works I expected some good practices that match almost all you said. The one that caught me by surprise is the negative conditions that reflect breaking conditions/loops, thanks for sharing, interesting!

Updated a year ago.
0Send private message
?

Click here to login

Reply
Comment