View Issue Details

IDProjectCategoryLast Update
0021513AI War 2Bug - GameplayAug 26, 2019 12:01 pm
ReporterZeusAlmighty Assigned ToChris_McElligottPark  
Status resolvedResolutionfixed 
Product Version0.881 AI Neighborhood Watch 
Fixed in Version0.884 The Helping Hat 
Summary0021513: Slow Performance and other oddities
DescriptionI'm approaching the late game in a game with 3 AI Factions, Nanocaust, etc. and the game has slowed down performance-wise notably, around 40%

Other things observed:

1. Fleets are not respecting "V-move," so ships are not actively pursuing hostiles on the planet.
2. The AI and nanocaust are gathering in tremendous magnitudes on the edge of the planet well of contested planets. This seems to be a significant contribution to the slow down
 
TagsNo tags attached.

Relationships

related to 0021516 resolvedBadgerBadger Allow Nanocaust ships to stack 

Activities

ZeusAlmighty

Aug 17, 2019 7:27 pm

manager  

low performance .save (4,980,671 bytes)

Chris_McElligottPark

Aug 19, 2019 1:27 pm

administrator   ~0052578

If anyone who wants to try out recompiling the code with some of the decollision logic turned off reads this, then that might be an interesting place to see if this is getting bogged down.

Chris_McElligottPark

Aug 20, 2019 11:14 am

administrator   ~0052582

Observations:

1.
"Thread 'specialFactionContext_4_AntiAIZombie' is in state Background, WaitSleepJoin after 30 seconds, so killing it now."

I was also running into some other special factions being so slow that they were having their long-term thinking threads killed here, too.

2. There were a tooon of ships that were out of the gravity well, most of them nanocaust, and this was indeed a performance bog. I have the game correct this on load, now, and there were 7818 ships in the wrong spot in this savegame.

3. There's a heck of a lot of fighting, and the stacking that is newer in the upcoming version helps a lot with that. Plus ships being able to actually get at each other to fight.

4. In general there are just a ton of ships, and I'm not sure why they are having so much trouble given that they are being stacked properly now, etc.

Chris_McElligottPark

Aug 20, 2019 11:20 am

administrator   ~0052583

Coming in 0.883:

* Added a new Mat.DistanceBetweenPointsSIMD( ArcenPoint P1, ArcenPoint P2 ) method, which uses hardware-accelerated floating point math to get a distance between two points. This won't be quite sim-perfect, but given our correction algorithms that are planned the slight drift should be ok. And this does seem to be faster than Mat.ApproxDistanceBetweenPointsFast( ArcenPoint P1, ArcenPoint P2, Int32 ShortcutsBeyond ) in at least some cases.

* We had an old method called FastGetIsPointOutsideGravWell(), and that was very frequently not noticing some places where ships could be placed out of the gravity well. Mainly to the southeast for some reason?
** We're now using a replacement method, GetIsPointOutsideGravWell_SlowButCorrect(), which is using DistanceBetweenPointsSIMD to try to offset the slowness at least some. This keeps all the ships actually in the gravity well.

* On load of savegames, there's now a new FixAnyShipsOutsideOfGravWells_OnLoadOnly() method that is run that brings any ships that were erroneously outside the gravity well back into the gravity well.


This save still runs very slow, but it's at least better and not demonstrably incorrect in things like the ships being outside the grav well. I'd be curious if the V-move pursuit mode is working now; I've not tested that, but probably it was just getting bogged down.

RocketAssistedPuffin

Aug 20, 2019 9:22 pm

reporter   ~0052588

Last edited: Aug 20, 2019 10:09 pm

special_entity_type="AIGuardian"

Is set on the three basic Nanocaust units - the Deviant, the Mutation, the Anomaly. There are over 3,000 of those units in that save, all unstacked. Removing that line stacks them, and on my machine so far seems to improve performance from 60% to 77-81% or so. It seems to fluctuate a bit, so may be slightly inaccurate.

I don't know if that line is necessary for anything, so I don't want to remove it yet.

Regarding decollision being turned off, if I knew how I could try some of it.

EDIT: The performance numbers are indeed fluctuating a good bit, but there's still an okay jump in performance with that.

One thing I am noticing is if the game is paused for a few seconds, there's a temporary jump as well. I would only guess that's letting it catch up on some tasks? Longer I wait, the better the boost - been able to go to 100% several times, but it doesn't last long.

BadgerBadger

Aug 21, 2019 12:45 am

manager   ~0052589

I opened another ticket to remind me to try to allow the nanocaust units to stack.

Chris_McElligottPark

Aug 26, 2019 11:47 am

administrator   ~0052627

The performance is an average over the last few seconds, so when you pause it is counting that in there and it throws off the average. It's not actually running any faster after pausing, it's just giving you averaged-out results that are misleading for I think 10 seconds.

Chris_McElligottPark

Aug 26, 2019 11:49 am

administrator   ~0052628

Thanks!

* AI guardians and dire guardians are now allowed to stack, which also means that other things like nanocaust ships (which are flagged as such) are now also able to stack. This gives a pretty major performance boost in some games that were previously bogged down because of a ton of those sorts of ships that were not stacking.

Chris_McElligottPark

Aug 26, 2019 12:01 pm

administrator   ~0052630

Whoops:

* Added SmallShipNotStackable and LargeShipNotStackable, which don't have the other AIGuardian logic or flags, but which prevent stacking of them.
** Currently applied LargeShipNotStackable to: dark spire ships (is this needed?), dyson ships (is this needed?), macrophage harvesters (is this needed?), nanocaust ships (this is needed, for now at least, to not let them stack across different spawners).
** Thanks to Badger for reporting the problems that the change to AI Guardians stacking logic could cause with some of the other factions. This makes the performance worse (for now) with the nanocaust again, but it does make it so that guardians are stackable.

Issue History

Date Modified Username Field Change
Aug 17, 2019 7:27 pm ZeusAlmighty New Issue
Aug 17, 2019 7:27 pm ZeusAlmighty File Added: low performance .save
Aug 19, 2019 1:27 pm Chris_McElligottPark Note Added: 0052578
Aug 20, 2019 11:14 am Chris_McElligottPark Note Added: 0052582
Aug 20, 2019 11:20 am Chris_McElligottPark Note Added: 0052583
Aug 20, 2019 11:20 am Chris_McElligottPark Assigned To => Chris_McElligottPark
Aug 20, 2019 11:20 am Chris_McElligottPark Status new => feedback
Aug 20, 2019 9:22 pm RocketAssistedPuffin Note Added: 0052588
Aug 20, 2019 10:09 pm RocketAssistedPuffin Note Edited: 0052588
Aug 21, 2019 12:45 am BadgerBadger Note Added: 0052589
Aug 26, 2019 11:47 am Chris_McElligottPark Note Added: 0052627
Aug 26, 2019 11:49 am Chris_McElligottPark Status feedback => resolved
Aug 26, 2019 11:49 am Chris_McElligottPark Resolution open => fixed
Aug 26, 2019 11:49 am Chris_McElligottPark Fixed in Version => 0.884 The Helping Hat
Aug 26, 2019 11:49 am Chris_McElligottPark Note Added: 0052628
Aug 26, 2019 12:01 pm Chris_McElligottPark Note Added: 0052630
Aug 26, 2019 12:01 pm Chris_McElligottPark Relationship added related to 0021516