Page 1 of 1

Game freezes

Posted: Tue Sep 29, 2020 2:29 pm
by Dominiquini
Every 1 minute or so, my game freezes for a few fractions of a second and then returns to normal. This is becoming a little irritating.
My computer is relatively good and my base is still small (I just launched my first rocket). But I have many mods installed! How can I find out if and what mod is causing this problem?
To clarify, the game runs well in general ... Only these occasional freezes from time to time.

Thank you.

Re: Game freezes

Posted: Tue Sep 29, 2020 2:49 pm
by eradicator
Press F4, enable "show-time-usage" on the "debug" tab. Press F4 again, then press F5. At the very bottom below "Script update" it shows what mod uses how much CPU time. Wait for a freeze and check if one of the numbers drastically changes. If it's not a mod the spike might also be in some of the other categories.

If it's none of the above it might be anything. Cooling problems, background programs, etcpp.

Re: Game freezes

Posted: Tue Sep 29, 2020 9:55 pm
by Dominiquini
I had to record the game to be able to see anything, as the freeze lasts less than 1 second.
The only numbers that I noticed a significant increase right after the freeze were the parameters:
- Wait for update (2,950 -> 7,711)
- Game update (1,769 -> 6,493)
- Entity update (0.896 -> 5,623)

Normal data:
normal.png
normal.png (3.77 MiB) Viewed 4497 times
Soon after freeze:
freeze.png
freeze.png (3.72 MiB) Viewed 4497 times
Any idea what it might be?

Thanks,

Re: Game freezes

Posted: Tue Sep 29, 2020 10:10 pm
by Dominiquini
I checked if my GPU or CPU could be experiencing heating problems and slowing down periodically, but I didn't find any problems.
I also found no evidence of peak processing demand by any other application during gameplay.
The freezing occurs when I am moving or stopped. Me being in the middle of my base or in the middle of nowhere. It also happens in the map view!

Thanks.

Re: Game freezes

Posted: Tue Sep 29, 2020 10:36 pm
by jodokus31
Nanobots has a peak.

Re: Game freezes

Posted: Tue Sep 29, 2020 10:46 pm
by eradicator
Also the Nanobot spike is exactly as large as the Entity Update spike:

5.623-0.896 = 4.727 (Entity Update)
4.832-0.106 = 4.726 (Nanobot)

Which might imply that Nanobot interferes with entity update somehow.

YARM and GunEquipment are also taking a hefty chunk of processing time. Don't know either mod so that might be ok.

Re: Game freezes

Posted: Tue Sep 29, 2020 11:12 pm
by Dominiquini
jodokus31 wrote: Tue Sep 29, 2020 10:36 pm Nanobots has a peak.
I hadn't noticed that! I will try to remove this mod and test here...

Thanks

Re: Game freezes

Posted: Tue Sep 29, 2020 11:13 pm
by Dominiquini
eradicator wrote: Tue Sep 29, 2020 10:46 pm Also the Nanobot spike is exactly as large as the Entity Update spike:

5.623-0.896 = 4.727 (Entity Update)
4.832-0.106 = 4.726 (Nanobot)

Which might imply that Nanobot interferes with entity update somehow.

YARM and GunEquipment are also taking a hefty chunk of processing time. Don't know either mod so that might be ok.
But their numbers are stable and the game's performance is good most of the time!

Thanks.

Re: Game freezes

Posted: Tue Sep 29, 2020 11:22 pm
by Dominiquini
The problem seems to be with the "Nanobots" mod!
I will report this problem to the author of the mod to see if he discovers the problem.

Thank you for your help!

Re: Game freezes

Posted: Wed Sep 30, 2020 12:36 am
by eradicator
Dominiquini wrote: Tue Sep 29, 2020 11:13 pm But their numbers are stable and the game's performance is good most of the time!
Yea, sure. There can be perfectly fine reasons for this. Just saying that GunEquipment is almost using as much cpu as your entire factory (entity update). From a quick glance at the code it looks mostly like the author basically never cared about performance. Seems like it's doing whatever it is doing - and all of it - repeatedly every single tick. Would probably be trivial to speed it up 60 times by simply reducing that to once per second.

Re: Game freezes

Posted: Wed Sep 30, 2020 12:43 am
by Dominiquini
eradicator wrote: Wed Sep 30, 2020 12:36 am
Dominiquini wrote: Tue Sep 29, 2020 11:13 pm But their numbers are stable and the game's performance is good most of the time!
Yea, sure. There can be perfectly fine reasons for this. Just saying that GunEquipment is almost using as much cpu as your entire factory (entity update). From a quick glance at the code it looks mostly like the author basically never cared about performance. Seems like it's doing whatever it is doing - and all of it - repeatedly every single tick. Would probably be trivial to speed it up 60 times by simply reducing that to once per second.
I will contact the mod's author about this.

Thank you for your help!

Re: Game freezes

Posted: Wed Sep 30, 2020 10:36 am
by jodokus31
Dominiquini wrote: Tue Sep 29, 2020 11:22 pm The problem seems to be with the "Nanobots" mod!
I will report this problem to the author of the mod to see if he discovers the problem.

Thank you for your help!
IIRC there is a nanobots mod setting, where you can tame the cpu usage a bit. It could also be, that you have something on your map, where nanobots spends alot of time on. F.e. monstrous amounts of ghosts or such.
Might be a good performance savegame for the author to inspect.

Re: Game freezes

Posted: Wed Sep 30, 2020 3:19 pm
by Dominiquini
jodokus31 wrote: Wed Sep 30, 2020 10:36 am
Dominiquini wrote: Tue Sep 29, 2020 11:22 pm The problem seems to be with the "Nanobots" mod!
I will report this problem to the author of the mod to see if he discovers the problem.

Thank you for your help!
IIRC there is a nanobots mod setting, where you can tame the cpu usage a bit. It could also be, that you have something on your map, where nanobots spends alot of time on. F.e. monstrous amounts of ghosts or such.
Might be a good performance savegame for the author to inspect.
I was using the features "Mark items on ground", "Deconstruct finish miners" and "Find all the fish" provided via signals. The problem goes away if I disable these signals!
Maybe, every 1 minute, "Nanobots" starts to process these signals and causes the freeze that I was experiencing...
About the mod settings, I didn’t try to tamper with it because I’m not sure what many of those parameters are for. Maybe I’ll test other settings later...

Thanks.

Re: Game freezes

Posted: Thu Oct 01, 2020 10:18 pm
by DeznekCZ
Hi all,

GunEquipment can take that much time how much grids (equipment grids) are on map. In version 0.0.11 was some optimalization, but it can not handle all. For now it contain many loops, specially in OnRobotBuildEntity and in OnBuildEntity. If there was build many entities in one tick, may cause a freeze. Every bullet shoot may cause same problem, because every time the magazine is low, the equipment is replaced inside grid.

If I can help in that way, I will try it.

For GunEquipment, DeznekCZ

PS: 0.0.12: Krastorio 2 magazines fix, projectile magazines now available.

Re: Game freezes

Posted: Fri Oct 02, 2020 1:42 am
by DeznekCZ
I got an idea to solution how to make it more efficient. There could be queue with all guns and every tick will be updated only some of them instead checking of all grids. In first tick after load will be queue constructed and in any call of entity will be equiped or unequiped, this queue will be checked. If weapon is valid, then load if not remove from queue. So it needs to be implemented and tested.

Re: Game freezes

Posted: Fri Oct 02, 2020 10:02 pm
by Dominiquini
DeznekCZ wrote: Fri Oct 02, 2020 1:42 am I got an idea to solution how to make it more efficient. There could be queue with all guns and every tick will be updated only some of them instead checking of all grids. In first tick after load will be queue constructed and in any call of entity will be equiped or unequiped, this queue will be checked. If weapon is valid, then load if not remove from queue. So it needs to be implemented and tested.
I do not understand enough to give an opinion on the matter. I only linked you here because I thought it might be of interest to you to hear this comments about your mod.
Anyway, good mod.

Thanks.