Increasing long term stability/Timeout for entities

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

kaZ
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Tue Aug 25, 2015 9:26 am
Contact:

Increasing long term stability/Timeout for entities

Post by kaZ »

Short version: Many biters that have to be calculated decrease the performance of ANY computer/server over time depending on it's individual hardware setup.

This is not considered to be a new observation, it's just for clarity. The question is, what leads to those many (unneeded) biters. My observations on daniel34's server (viewtopic.php?f=53&t=20025) are the following:

1) Once a new and fresh map is started everything is fine related to performance (few chunks unveiled -> few biters to calculate). Just by playing new chunks are unveiled and more and more bases are affected (=they are getting activ, new biters are calculated). It's just like an empty red balloon. The radius of that ballon is increased while blowing in (polluted) air. An increased radius leads to an exponential touched surface of the outer boarders where the game routine of biters rallying up for attack kicks in (see Native Life https://wiki.factorio.com/index.php?title=Pollution). This is rather ok since it's the game mechanic and usually they would attack and get killed/vanish somehow or kill the polluters and decrease the spawning of themselves over time.

2) A major problem is related to the pathfinding if there is water inbetween. They get stuck on the coastal line (see https://imgur.com/mquhquG). Imagine this all over the map, where the way between the player/s and the biters are blocked. -> decrease in performance

3) Another idea are the many many bases that are unveilled but NOT touched by pollution. They produce their basic amount of biters that are idling most of the time without the ability to flow off at any time. Many unpoluted bases -> many "basic-idling" biter -> decrease in performance.

The last observation is not related to biters at all, but to entities on the ground like alien artefacts (in general: any uninstalled item on the floor) and it's just a guess, I haven't tested it so far. Many items on the ground could reduce the performance over time while they are not picked up?! On the previous map we had around 50k alien artefacts in chests and an estimated 150k lying around since we where to lazy at some point to pick them up because there was no need to.

Some possible solutions could be:

- Biter could time out and vanish after an acceptable amount of time (> their time they would need for a regular attack) to prevent them to rally up in blocked situations
- Biter bases(including the thought of vanishing) that are NOT touched by pollution only creates biter when a player is close inbetween n-chunks. (=inactive bases till the player get's close)
- (minor due untested) Items on the ground vanish after n-minutes, since they most likely never ever will be picked up (maybe after 1 hour? idk)


Both could be done either by giving every biter or items on the map an exclusive timestamp (entity created at playtime 1:30:45 -> vanish after n-minutes) or by pooling them up and make the pool as a total vanish after n-minutes, whatever is better to performance.
bobucles
Smart Inserter
Smart Inserter
Posts: 1708
Joined: Wed Jun 10, 2015 10:37 pm
Contact:

Re: Increasing long term stability/Timeout for entities

Post by bobucles »

Pathing is so much simpler if they just tunnel down and pop up in the middle of your base somewhere.

It also helps to eliminate recurring entity checks. For example there is no need to update a biter's health every tick, or even every second. It only ever becomes relevant when it enters player range or combat. Until then the biter can simply sleep.
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: Increasing long term stability/Timeout for entities

Post by daniel34 »

An interesting observation (probably a little too technical for an Ideas and Suggestions thread, but well):
Killing all enemies on that map (/c game.forces["enemy"].kill_all_units()) will bring down the Entity update from ~29ms to ~11ms, the Path finder goes down from 1.0ms to around 0.7ms, but is up to 1.0ms again after 1 minute.
The difference between complete time and Entity update (all the other stuff) constantly stays at ~6ms.

Number of enemy units on that map:

Code: Select all

small-biter:      2069
medium-biter:     3373
big-biter:        9031
behemoth-biter:   6855
small-spitter:    2087
medium-spitter:   5873
big-spitter:     15333
behemoth-spitter: 9403
----------------------
total:           54024
Active entities: 233.000
When killing all enemy units, the entities go down to 80.000 and increase quickly (in ~5 sec) to around 170.000, then after a minute stay at 190.000 and increase very slowly (10/sec).
Chunks: total 16.500, with entities 15.300, active 5.800

In summary it looks like the vast amount of biter/spitter entities on the map is what's causing the lag. It's also interesting that they stay at the coast of the map and don't try to go around it, probably because that path would be very long. The pathfinding itself doesn't actually account for much of the processing time and is independent from the amount of enemy units on the map (cached paths, probably).
quick links: log file | graphical issues | wiki
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Increasing long term stability/Timeout for entities

Post by ssilk »

The pathfinding is one issue there, but I think it will be fixed more or less with 0.13. There where some FFF's about that and I'm nearly sure, that this will improve a lot.

Your last observation with the spawners - I see this is also as one of the biggest impacts to my current game speed. Turning off the spawners, if they have produced enough biters, should fix that more or less.

I'm not sure, what killing will bring. Killing is "change" and change needs to be calculated. No killing, no change, no calculation. Simple.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
kaZ
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Tue Aug 25, 2015 9:26 am
Contact:

Re: Increasing long term stability/Timeout for entities

Post by kaZ »

Thanks for all of your input guys. I've been a bit late in replying, the weather was just too good :)
ssilk wrote:(...)

Your last observation with the spawners - I see this is also as one of the biggest impacts to my current game speed. Turning off the spawners, if they have produced enough biters, should fix that more or less.

I'm not sure, what killing will bring. Killing is "change" and change needs to be calculated. No killing, no change, no calculation. Simple.
Made two drawings how I would explain the current and estimated situation as I see it. Please keep in mind that I'm not that/ not IT-based compared to you guys :)

My initial situation is explained as the following:
- pollution is stable in the viewed time
- 100 Bases are in the circle of pollution (=activ all the time)
- 100 Bases can be found by the player over the time (get active at the point where they are found; minus the behaviour of spawning and sending army's)

Current situation:
http://imgur.com/XswcKx0
Each t+1 the player unveils 10 biter bases, those are added to the "pool". At t=1 there would bei 100 pol. Bases + 10 unpol. Bases = 110 Bases.
As this goes on and on there is an increasing usage of computer ressource to monitor. Once you kill them by lua command the situation is much better
daniel34 wrote:28 Apr 2016, 13:18 (...)
also adds data to this and confirms it in a way.

Estimated situation:
http://imgur.com/Os0cRSd
Here I've chosen that the player finds 50 new Bases at once at t=3 (more common behaviour than "current situation). Also the time for their simulation shall be 3.
My idea now is to add some calculation of previously "saved" calculation power to manage the killing/removal/setting inactive of the new unpoluted bases (etc.). Overall this could (again, I'm not IT-based) lead to a lower demand for ressources for the game as whole. The benefit would be that the lag in relationship to biters on the map occurs later / much much later, in other words: the longterm stability get's increased.
Post Reply

Return to “Ideas and Suggestions”