FPS/UPS drop to <20

Anything that prevents you play the game properly. Do you have issues with paying for the game, downloading it or properly running it on your computer? Let us know here.
SquarelyCircle
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Jan 07, 2017 12:17 am
Contact:

FPS/UPS drop to <20

Post by SquarelyCircle » Sun Jan 15, 2017 6:12 pm

My game is running at 1/3 speed for no good reason. My cpu is at <20% usage. My base is getting larger, and there are tons of large alien bases, but it still makes no sense for the game to slow down, since my cpu isn't being used up. And frankly, my base isn't THAT big. I've basically mastered a large area around the starting area. I have a total of about 1200 bots. I do have a lot of mods installed, but again, without the cpu being taxed, I don't get why it would slow down.

Operating System: Windows 10 Home 64-bit (10.0, Build 14393) (14393.rs1_release.161220-1747)
Processor: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (8 CPUs), ~4.0GHz
Card name: NVIDIA GeForce GTX 1070
Dedicated Video Memory: 8145 MB
System Memory: 16384MB RAM

I've done a pretty thorough search of this issue, and none of the recommended fixes helped:
1) I'm not on a laptop, so power settings were always set for performance.
2) I've set the video memory usage to "All" and started the game with the launch option, "--max-texture-size=8196"
3) I've tried in both multiplayer and single player

Below I'm attaching the image of my game with F5 pressed:

Image

I get that the fps/ups being equal means that the rendering is keeping up with the game logic, so it must be a cpu bottleneck, but I don't get why that would happen or what I can do to fix it. As my system stats demonstrate, the computer should be more than capable of running this game under intense circumstances.

A new game isn't this slow; it's only after dozens of hours of playing that it slows down like this.

Here's my save file:
http://www.mediafire.com/file/5bqzx32x8 ... NPJS_8.zip

And this is my mod's list (of note, my unmodded game with a base of somewhat similar size also seemed to slow down, but I didn't look much into it or verify that it actually was slower):
-----------------------------
mods
-----------------------------

Thanks in advance for any suggestions or insights.

orzelek
Smart Inserter
Smart Inserter
Posts: 3549
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: FPS/UPS drop to <20

Post by orzelek » Sun Jan 15, 2017 6:18 pm

Two things:
1. Providing all mods as a zip file along with save helps a lot :)
2. Few mods eat quite a bit of CPU but some quite important data is barely readable due to overlap. You can try to reduce debug font size in config file to make debug display a bit more readable.

For me it seems you are running into limit of what single core on CPU can process and thats how simulation is run on Factorio. There are quite a few discussions about multithreading around the forums.
There are also quite a few optimizations coming in 0.15 so it should make the save much more playable.

Loewchen
Global Moderator
Global Moderator
Posts: 5043
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: FPS/UPS drop to <20

Post by Loewchen » Sun Jan 15, 2017 6:56 pm

20% CPU utilization on 8 cores means it is as its limit since factorio is not multi threaded, at least not in a way that would be significant in this situation. So all of this is completely expected behaviour.

SquarelyCircle
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Jan 07, 2017 12:17 am
Contact:

Re: FPS/UPS drop to <20

Post by SquarelyCircle » Sun Jan 15, 2017 7:15 pm

Ok. Thanks for the quick response. I wish there was something I could do about it besides wait for 0.15.

I don't understand the information in the diagnostic screenshot. What should I be looking for to determine which mods are problematic? Are there any mods I'm using that are likely to be using up a ton of CPU, and I'd be better off dropping them? Maybe if I get rid of some of the higher offenders, things'll clear up?

SquarelyCircle
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Jan 07, 2017 12:17 am
Contact:

Re: FPS/UPS drop to <20

Post by SquarelyCircle » Sun Jan 15, 2017 7:34 pm

Here's a screenshot with the font size reduced. I wasn't sure what made a mod problematic, so I assumed that the higher the number next to it, the more CPU time it was taking up. Is this correct? I removed several mods that had a number higher than .2. The performance didn't improve, but they're no longer in the screen shot.

Image

And here's a link to a zip file with the mods I _WAS_ using. (I'll be switching them up a bit as I'm planning to start a new play through, and I don't want mods that will lag my end game):
https://doc-0c-8s-docs.googleuserconten ... e=download

SquarelyCircle
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Jan 07, 2017 12:17 am
Contact:

Re: FPS/UPS drop to <20

Post by SquarelyCircle » Sun Jan 15, 2017 7:37 pm

Also, I'm baffled if my CPU really is the bottleneck here. My CPU is way more than is necessary for any other game. After buying it, I even regretted wasting money on a CPU that wasn't really going to see as much use as it was capable of. Does everyone get extremely slow late game? If not, I wish I knew why I'm getting it.

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: FPS/UPS drop to <20

Post by Adil » Sun Jan 15, 2017 7:51 pm

Is there documentation about the debug anywhere? Keep forgetting how to read update times.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

daniel34
Global Moderator
Global Moderator
Posts: 2757
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: FPS/UPS drop to <20

Post by daniel34 » Sun Jan 15, 2017 8:43 pm

SquarelyCircle wrote:Here's a screenshot with the font size reduced. I wasn't sure what made a mod problematic, so I assumed that the higher the number next to it, the more CPU time it was taking up. Is this correct? I removed several mods that had a number higher than .2. The performance didn't improve, but they're no longer in the screen shot.
Screenshot
Yes, the higher a number is the more CPU time it will take. In your case the issue aren't the mods though.

The complete framecycle takes 49.349ms, the update of the game state (CPU part) takes 48.435ms. To run the game at 60 FPS/UPS this number would have to be at 16.666ms (=1000/60) or below.

The entities on the map themselves take most of the time to process at 46.149ms (Entity update), which is to be expected on most maps since this includes the update of belts/bots/assemblers/biters/..., effectively every entity/prototype, modded or not. In that phase modded entities will take the same time to process as vanilla entities, as vanilla entities are also just part of a mod (the base mod). Replacing modded belts with vanilla ones with similar speed and then removing the mod won't make a difference.
Lowering the number of entities will lower the Entity update time, that's why long sections of belt replaced with underground belts will increase performance (2 entities instead of 6), adding better roboports/bots from mods if you then have fewer bots flying around, or using drills with larger mining area/speed because you'll end up using less drills. I think using modules can also increase performance, e.g. 1 assembling machine + speed modules instead of 3 assembling machines, when doing this with lots of assemblers, don't forget the inserters and chests/belts you'll save.

The mods (and scenario) can also run extra code (the control.lua part) which is indicated using the Script update time (in your case 0.630ms) and is then broken down for each mod. In your case 0.630ms is a very low number, it only accounts for 1-2% of the update time. Removing the mods that account for the most time won't have much influence, unless removing the mod also removed entities because then it would also lower the Entity update time. You would have missing entities on the map though.

A good example is the bottleneck mod, every tick it updates the status of 40 entities and takes 0.249ms to do it. Removing it would save that time, and probably a very small amount of Entity update / Render time because the signals won't have to be displayed anymore, but you won't notice the difference (0.2 UPS or so).

SquarelyCircle
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Jan 07, 2017 12:17 am
Contact:

Re: FPS/UPS drop to <20

Post by SquarelyCircle » Sun Jan 15, 2017 8:59 pm

Hmm... so getting rid of these 0.2 millisecond things hardly matters compared to the massive 49 millisecond frame cycle. Good to know. I won't get rid of the mods, then.

But dang... I have to get 49 ms down to 16 ms? I don't see how that's possible. Will version 0.15 be optimized to that extent? Or is there something I can do to solve this? Does everyone experience this late-game slow down?

I'm starting to feel a little discouraged. :/

Suggestions are welcomed!

Loewchen
Global Moderator
Global Moderator
Posts: 5043
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: FPS/UPS drop to <20

Post by Loewchen » Sun Jan 15, 2017 9:05 pm

See here on how to improve your performance: viewtopic.php?f=49&t=39593#p235798

SquarelyCircle
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Jan 07, 2017 12:17 am
Contact:

Re: FPS/UPS drop to <20

Post by SquarelyCircle » Sun Jan 15, 2017 9:11 pm

Ok, I did a quick test.
I went into the save game and entered the following into the console:

Code: Select all

/c local surface = game.player.surface
for c in surface.get_chunks() do
   for key, entity in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, force= "enemy"})) do
       entity.destroy()
   end
 end
Which kills all the enemies on the map, according to: https://www.reddit.com/r/factorio/comme ... _commands/

The fps/ups returned to 60/60, and frame cycle went to 16.6 or so, and the lag disappeared.

I was really enjoying the intensity of these biters - I'm using both Rampant AI and Natural Evolution, which has made for some crazy intense fighting. Furthermore, I really don't like the feeling of magically eliminating all the aliens in the explored world. Is there some way to reduce the CPU cost of all the aliens? I think that in my previous game the 7000 bots I had were causing cpu lag as well, even without so many aliens.

Any suggestions for future play-throughs? Are the alien mods at fault for making aliens so insanely abundant, or is that present even without the mods?

SquarelyCircle
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Jan 07, 2017 12:17 am
Contact:

Re: FPS/UPS drop to <20

Post by SquarelyCircle » Sun Jan 15, 2017 9:18 pm

Loewchen wrote:See here on how to improve your performance: viewtopic.php?f=49&t=39593#p235798
Thank you for the link. It does provide some insight. However, I don't see any actionable steps that I could implement to improve my performance.

The one thing I do see (I've seen it suggested elsewhere) is to slow down the game speed. But that seems to me to merely be giving in to the performance issues, since slow speed is the reason I noticed that the performance was bad in the first place.

Am I missing something? Or are there additional suggestions to improve performance?

orzelek
Smart Inserter
Smart Inserter
Posts: 3549
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: FPS/UPS drop to <20

Post by orzelek » Sun Jan 15, 2017 10:05 pm

If killing aliens reduces the update time by so much I'd post the save in the Rsendings topic about game optimization. It seems that for some reason all those enemies are updated. You could also add counter to the kill loop to see how many it actually kills just out of curiosity :D

You have Natural Enemies mod which adds lots of enemy variants and will cause more enemy spawns. Removing it could help but it will reduce the difficulty.

Using some mods like bobs logistics for faster assemblers etc could help in entity reduction - more production done with less entities. Same by using some of the underground belt extension mods. But this might not help if killing enemies helps so much - they are simply most relevant part.

Rseding91
Factorio Staff
Factorio Staff
Posts: 9026
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: FPS/UPS drop to <20

Post by Rseding91 » Mon Jan 16, 2017 12:54 am

orzelek wrote:If killing aliens reduces the update time by so much I'd post the save in the Rsendings topic about game optimization. It seems that for some reason all those enemies are updated. You could also add counter to the kill loop to see how many it actually kills just out of curiosity :D

You have Natural Enemies mod which adds lots of enemy variants and will cause more enemy spawns. Removing it could help but it will reduce the difficulty.

Using some mods like bobs logistics for faster assemblers etc could help in entity reduction - more production done with less entities. Same by using some of the underground belt extension mods. But this might not help if killing enemies helps so much - they are simply most relevant part.
I already know why biters are slow and there's not much I can do about it. They're slow because they do a ton of calculations as they move. If they don't do the calculations they can't move.
If you want to get ahold of me I'm almost always on Discord.

SquarelyCircle
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Jan 07, 2017 12:17 am
Contact:

Re: FPS/UPS drop to <20

Post by SquarelyCircle » Mon Jan 16, 2017 2:32 am

Thanks for all the replies. I'll be removing the Natural Evolution mod. I'm a bit disappointed by this, because the enemies were very interesting and challenging. I loved the huge deadly groups.
Instead, I'll be trying Bob's enemies. It seems like that one focuses on keeping numbers down as it increases the power of the enemies. Hopefully that'll help with the lag. If I have low FPS/UPS on my next run through, I'll post again with an update.

SquarelyCircle
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Jan 07, 2017 12:17 am
Contact:

Re: FPS/UPS drop to <20

Post by SquarelyCircle » Thu Jan 19, 2017 7:41 pm

Starting a new game with different mods helped me determine the source of the problem. I think this is something that the devs might actually be able to fix, so I'll try to find that other place to post save files, but I don't remember where it is, so I decided to just respond to this post, so that if anyone else has this issue, they'll be able to find a response.
Ultimately, the lag is being caused by mods that pick items up off the ground. There was one included within Natural Evolution. I also downloaded one (https://mods.factorio.com/mods/Rseding9 ... Collectors) to deal with the unbelievable spam of little artifacts in Bob's Enemies (both Bob's enemies and Natural Evolution created HUNDREDS OF THOUSANDS of "new small artifacts".)

As I said, I'll try to upload the save file that demonstrates the issue to the place where the devs are requesting them, but just so that I get this up there quick, here's my mods and saves:
Save file: https://drive.google.com/open?id=0B2dPr ... GxRLVFYTXM
Mods zip: https://drive.google.com/open?id=0B2dPr ... mlOQ2IwYTg

Load up the save, and you'll immediately experience extremely low FPS for about 30 seconds. I've set up the save to rapidly emphasize the problem, but even under less dramatic circumstances the issue is very noticeable.

Okay, as a temporary fix for anyone looking, you can disable small artifacts in the data.lua of Bob's enemies. In my game, that removed like 200,000 small artifacts from the game and set my FPS/UPS back up to 60. Silky smooth as butter, now.

orzelek
Smart Inserter
Smart Inserter
Posts: 3549
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: FPS/UPS drop to <20

Post by orzelek » Thu Jan 19, 2017 8:19 pm

It's quite interesting.
Is it the presence of artifact collecting mods or presence of lots of items?
Since mods themselves did not show any big run times it might be some strange interaction between having lots of biters and lots of items on the ground. Your previous test with biter removal also did help - did you remove artifacts then also?

I'm using collectors from natural evolution with a buff to make sure that my defense areas stay clear of artifacts.
I did not have problem with those but I also barely reached evolution factors of 0.4-0.5 so scale of effect was pretty small.

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: FPS/UPS drop to <20

Post by Adil » Thu Jan 19, 2017 9:56 pm

NE collectors share the code with Rseding's ones and there was never much thought put into those, it was mostly an example of the api usage back then:
viewtopic.php?f=14&t=5410
Rseding91 wrote:This is a very simple mod I quickly made for someone that collects items off the ground in a 50x50 area centered on the chest.

No screenshot of it because it's a simple chest (it uses the smart chest icon) - just place it where you want it to pick up stuff and it will do its thing.
Here's a quick change, that speeds up the script update time from 300 to 1.5 ms.
More speed can be gained by rethinking how the mod should work (e.g. collect more items less frequently, in smaller area).

On a side note, setting limit=1 in the find_entities_filtered() didn't affect performance, the C++ backend apparently finds and stores all results and only then discards everything above the threshold.
Attachments
Item Collectors_1.1.9.zip
(18.32 KiB) Downloaded 24 times
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

Rseding91
Factorio Staff
Factorio Staff
Posts: 9026
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: FPS/UPS drop to <20

Post by Rseding91 » Thu Jan 19, 2017 11:05 pm

Adil wrote:On a side note, setting limit=1 in the find_entities_filtered() didn't affect performance, the C++ backend apparently finds and stores all results and only then discards everything above the threshold.
Indeed. Because the filtering allowed (type, force, name) isn't applied until after all of the entities in the given area are collected.

Regardless, just not using "item collectors" is the best option. Go out and pick them up from time to time or re-work the mod to not need them.

Artifacts won't be a thing in 0.15 anyway.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: FPS/UPS drop to <20

Post by Adil » Fri Jan 20, 2017 8:07 am

Rseding91 wrote:
Adil wrote:On a side note, setting limit=1 in the find_entities_filtered() didn't affect performance, the C++ backend apparently finds and stores all results and only then discards everything above the threshold.
Indeed. Because the filtering allowed (type, force, name) isn't applied until after all of the entities in the given area are collected.
So, this function is just equivalent of using find_entities() and filtering the results yourself? One would hope that the C++ would feature some optimizations over that.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

Post Reply

Return to “Technical Help”

Who is online

Users browsing this forum: No registered users