veden / Rampant

Factorio Mod - Basic AI augmentation using potential fields
GNU General Public License v3.0
57 stars 22 forks source link

3.2.0 Biters stop nesting completely for MigratingAI phases at some point after upgrading game from ver3.1.3 #163

Closed garrotte13 closed 1 year ago

garrotte13 commented 1 year ago

Upgraded map from Rampant 3.1.3 to 3.2.0 First half an hour it was fun - more attack waves, a lot of regional raiding in RaidingAI state like in old times v.0.18. And expansions during MigrateAI phase. But at some point biters stop expanding. For all 4 or 5 clans ("regional factions", "baseAI" or whatever). Only raiding works fine.

There are no messages about settler squad start building when I turn on printing such message. There are no messages about Settler squad forming for a pay of 400 points. Only usual squads -175 points. MigrateAI state looks like total silence, peaceful state. SiegeAI produces squads for 175 points each, but they all die in attacks on my turrets.

I loaded gamesave when I just upgraded map to Rampant 3.2.0 and I see the same problem: first 15-20 minutes biters are expanding (when clan is in MigrateAI state). But after that time period no new "settled" event, no event about settler squad -400 points formed (is it for MigrateAI only? SiegeAI produces regular squads for 175 points, and don't settle neither - all units always attack my defenses).

I waited for 90 minutes just to be sure it's not some feature of respecting map settings (I have 5..45 minutes vanilla expansion interval set).

There are enough points (both - "unit points" and "points") as I see it in debug prints.

Maybe not related info: During first 20 minutes (when expansions were still taking place) I witnessed a few times settler squad not building anything. It is formed in debug message, but no message about squad settled. As I understand settlers squad formed message has GPS of gathering point. Once it was an empty island.

I tried to increase number of building groups in mod map settings - it didn't help.

garrotte13 commented 1 year ago

There was some successful SiegeAI attempt finally. Therefore I suppose problem is with MigratingAI, while SiegeAI has been not lucky enough with nesting chunk&position selected :-).

Update: yes, confirmed - SiegeAI works fine (with little success chance as usual).

Problem is purely MigratingAI related - can it be that it requires "points" [and "unit points"] critical minimum? I have clans with huge amounts of unit points accumulated (several thousand), but never see common "points" amount exceed 1k for any baseAI for any considerable time period.

garrotte13 commented 1 year ago

Got 2 occurrences when biters settled 3 chunks away from my defenses. I believe it's SiegeAI in some lazy case, because there are still a lot of places further from my base where biters could expand. Can it be some new logics implemented to limit endless expansions introduced in Rampant2.0?

garrotte13 commented 1 year ago

After some hours I see one migration expansion note far away from base, so I stop monitoring building command prints.

Probably there is some serious rebalance here, and according to changelog there was something about pheromones and other things. Behavior really changed a lot - biters do raid a lot now, like in good old times, and do it with several squads in a region like it was in Rampant 0.18. Nice! And that's all is happening with Peaceful phase checked Off. I haven't tested Dagothur changes to that option so far.

garrotte13 commented 1 year ago

Tried a new game with Rampant3.2 (sandbox mode, reduced option value of "biters detect player's presence" to 3 minutes) for 75 minutes play: 3 migration expansions and 2 revenge expansions (I destroyed a nearby nests cluster to avoid pollution triggered activities). Migration expansions occurred in first 20 minutes. Later I see no expansions, only raiding squads appear. Map settings for biters expansion are "every 4..35 minutes". MigratingAI phases do occur, but no squads are generated during those phases.

garrotte13 commented 1 year ago

yep, confirmed. Made one more new game, changed enemy expansion settings to values of 5/20 minutes (min/max). And looked through changes in FACTO-215...

universe.settlerCooldown = randomTickDuration(universe.random,
                                                  universe.expansionMinTime,
                                                  mFloor(linearInterpolation(evolutionLevel ^ 1.66667,
                                                                             universe.expansionMaxTime,
                                                                             universe.expansionMinTime)))

so now Rampant expands like vanilla - only once a in a while (once in a period of 5..60 minutes depending on map settings). Therefore to make Rampant wild again I need to reduce those map settings to values 3 and 10 minutes for min and max accordingly.

That's great. People whined a lot about Rampant settling too much. So now everyone can set the game he/she wants to get more or less pain. :-)

garrotte13 commented 1 year ago

The only problem is that unlike Vanilla Rampant has AI phases, points and other random factors applied, making expansion chance much lower than Vanilla has with the same map enemy expansion values, because not only settlerCoolDown should pass, but also MigratingAI phase be active in the same period and enough activity points available. Except maybe SiegeAI (if it does not obey the same rule of course - didn't check it).

garrotte13 commented 1 year ago

And here is the proof: image

only 3 settler groups were formed and sent by MigratingAI during 140 minutes for evolution 35%. SiegeAI phase happened only twice and probably only once an initially settler squad was sent which transformed into attackers because of too close nesting position selected.

Map settings are: image

For vanilla with the same settings 140 minutes it would be at least 7 settler squads (and all of them would be successful, because chunks near player are not selected), while 27 settler squads in most "lucky" random outcome. Middle would be about 16 new nests clusters built versus only 3 clusters made by Rampant -> 5 times less productive for the same game settings. So here is the problem.

garrotte13 commented 1 year ago

From my point of view a quick solution without mathematics can be empirical: to divide settlerCoolDown by a number of possible AIstates (e.g. divide by 6 if all states are enabled) and to exclude SiegeAI from this cool down logics, because it has its own only 15% success chance anyway (but sometimes when it is lucky it brings so much pain to unprepared player... - that's a different story).

Sophisticated approach could be to use separate settlerCoolDown for each biters clan ("BaseAI") and maybe some other changes to avoid full replication of vanilla logics.

garrotte13 commented 1 year ago

hm, sentExpansionGroups ... that's quite complex logics. Many squads can settle a lot during one migration wave, dramatically changing map if player is lucky enough. Looks like player's behavior (if he is sitting at base centre, building factory, or driving around and purging nests or provoking them with pollution) has a critical importance as before (Rampant mod is sleeping if player has killed everything in 4-5 chunks from his base and not provoking).

I tested dividing settlerCooldown by 6 and it gave some fruits for the same game (change was applied after 40 minutes from start): image

garrotte13 commented 1 year ago

In general dividing by 6 didn't help much. I added printing out for universe.expansionMinTime and universe.expansionMaxTime. It printed: 64800000 for expansionMinTime and 259200000 for expansionMaxTime Even if it is ticks, not minutes, then it will be 18000 minutes for expansionMinTime and 72k minutes for MaxTime. Something is wrong here if I understood it correctly. I was unable to find where these values are defined, except when game is upgraded from older Rampant version, where they are multiplied by ticks-per-minute. But they are already measured in ticks https://lua-api.factorio.com/latest/Concepts.html#EnemyExpansionMapSettings

Another observation: Looks like this tick count control and sentExpansionGroups reset happens only during MigratingAI and SiegeAI. Therefore if none of these stages starts for a long time, then game map settings values are increased even more (time consumed by other AI states after settlerCooldown timeout occurred is added to the value).

garrotte13 commented 1 year ago

I was completely wrong about settlerCoolDown needed to be divided. Despite the fact the time out is reset only for MigratingAI and SiegeAI, each clan (baseAI) has a separate count and Rampant is still much-much more active and aggressive than Vanilla when there are many nests and many clans (big map explored).

Found a place causing this issue, making a PR...