Jump to content

Fixing late game lag?


Recommended Posts

There are some game-mechanics you can follow: For example avoid multipathing, too much critters, really heavy pipe-networks with lots of branches. 

But with a 10 year old CPU there is only so much power you can use at all. It wont get much better.

The rest of your setup is fine, but the CPU is just out of date, and ONI is really CPU-hungry. 

2 hours ago, Yohlo said:

ONI is one of the best game ever made.
Anyone know if they are working on DCL, expansion, more stuff, rocketery rework, etc.?

They released a free DLC just a few weeks ago (Meeps Recreation), and they are working on improvements and more content right now. What? We´ll now when its done. Klei wont talk about work in progress.

4 hours ago, SharraShimada said:

They released a free DLC just a few weeks ago (Meeps Recreation), and they are working on improvements and more content right now. What? We´ll now when its done. Klei wont talk about work in progress.

Actually in the last dev-stream, they said that there will be one more "pack" coming, and then a paid-for DLC (if I remember correctly). Timeline for the "pack" was "a few weeks".

CPUs really haven't gotten much faster over the last 10 years.  The only reason I upgraded a few years ago to an i5-6600K from my previous sandydbridge 2500k was to move from DDR2 to DDR3 ram.  Other than that, not much has changed.

I'm now past cycle 1000 and still no lag.  I avoid the use of rails ( only have some to unload the rockets ).

25 minutes ago, psusi said:

CPUs really haven't gotten much faster over the last 10 years.  The only reason I upgraded a few years ago to an i5-6600K from my previous sandydbridge 2500k was to move from DDR2 to DDR3 ram.  Other than that, not much has changed.

I'm now past cycle 1000 and still no lag.  I avoid the use of rails ( only have some to unload the rockets ).

In fast foward?

When i start a game i have 144fps. Everything is smooth and nice. Then after 200 cycle, it drop around 30 fps with some spike lag. (60fps in normal speed mode).
I don't think game use 100% of my CPU. 
I plan to build a new pc when i'll change my graphic card because my motherboard getting old for new technology.
 

4 hours ago, Yohlo said:

In fast foward?

When i start a game i have 144fps. Everything is smooth and nice. Then after 200 cycle, it drop around 30 fps with some spike lag. (60fps in normal speed mode).
I don't think game use 100% of my CPU. 
I plan to build a new pc when i'll change my graphic card because my motherboard getting old for new technology.
 

I usually play in normal speed, but even when I sometimes go to double speed I don't notice any lag.  I don't know how to measure fps, nor do I care.  To me, lag has nothing to do with fps but more to do with critters and pipes not moving or flowing when they should.  Before I took the better part of a year off from ONI, I got to the point where I had a ton of morbs and pufts and they would stop moving around and farting and inhaling like they should.  The rest of the game seemed to be fine and scrolling around and animations worked fine so it didn't seem to be an fps issue but the simulation not keeping up.  This time around I've not run into that.  FPS can easily get down to 10 and not bother me as long as things behave the way they should.  Anything over about 30 fps and your brain can't tell the difference anyhow; that's why TVs use that refresh rate.

On 2/1/2020 at 6:05 PM, Yohlo said:

I7 2600, GTX 1060, 16gig ram, SSD

ONI doesn't use a GPU much, if any.  You'll get the same performance as long as you have any form of hardware renderer.  The 16gb of RAM is adequate, provided you don't have anything else running.  That leaves the processor...

I'm running with an i5 4690s, which is maybe 15% faster than your i7 (according to benchmark statistics).  I have 16bg of RAM and a GTX 750 Ti.  My GPU is set to sync to vblank, so I max out at 60 FPS, thus I can't tell you what my maximum rate is.  I _CAN_ tell you that for most of the game, I'm running at 60fps with some dips to 30 FPS.

ONI is very heavy on calculations.  Reducing the number of calculations will improve your FPS.  Here's some general methods I use:

  1. Rooms with gas have the most calculations.  Regions of solid the least.  For example, a room with gas will allow: thermal calculations; pathfinding calculations for any critters/dupes in the room; gas pressure change calculations; gas type movement calculations.  There may be more, but those are the ones that come to mind.  A region of solid tiles only allows thermal calculations (and shovevole pathfinding).
  2. A room with multiple gasses can add a lot of extra calculations  I've found that I have much better performance when I control the gasses within my base compared with an open flow method. I try to minimize the number of different gasses in an area, or limit the size of the room.  For example, if I dig straight into a slime biome, there will be oxygen, polluted oxygen, and carbon dioxide all drifting around.  If I then dig into a toxic biome, I'll add hydrogen and chlorine gas to the mix.  For each cell, there will be checks to see if there's a temperature change, checks for pressure changes with neighboring cells of the same gas, and checks for position swap with neighboring cells of a different gas.  
  3. Adding multiple item types to a storage locker can be bad.  When you add a new batch of a material to a storage locker, it averages temperature with any of that same material already in the locker.  However, if there's multiple materials, then they transfer temperature as if they were debris on the floor.  So lets say you have 4 different minerals and 3 different ores in a storage bin.  That's 7 thermal calculations between the materials, 7 between each of the materials and the environment, and a calculation between the bin and the environment for 15 calculations each time that bin gets evaluated.  If it only has one material inside, then there's only one between the contents and the environment, and one between the bin and the environment.  2 calculations instead of 15.
  4. Use door permissions to limit possible paths for dupes.  If there's only one way for a dupe to go from point A to point B, there will be less of an impact when the pathfinding algorithm needs to figure out how to get a dupe to its job.  Also, it helps a great deal to limit certain areas to certain dupes.  For example, I've got a base with three bristlebloom farms and four farmers.  Lets call farmers A, B, C, and D.  Farm 1 allows AB.  Farm 2 allows CD.  Farm 3 allows BC.  When I finish my next farm, it will allow AD.  Granted, this doesn't make a lot of difference if you have only 10 or 20 dupes.  Recently, however, I messed around with a map that had something like 80 dupes.   All 80 had access to everything, so when a job popped, it would (for example) ask: "Are you busy? What's your priority? Are you able to get here? How close are you?" for each of the 80 dupes until it found the dupe that was "best suited" to the job.  There was a very noticeable pause every time a dupe finished a task or a new task was generated.
  5. Rocket suits have nutzo pathfinding and add a lot of extra gas and thermal calculations due to their exhaust.  Use a limited number in a limited region.  Along those same lines... shovevoles have nutzo pathfinding as well.  Fence them in and your CPU will thank you.
7 hours ago, Yohlo said:

I don't think game use 100% of my CPU. 

ONI doesn't have a lot of multithreading yet.  It has some, which helps.  Now the following is some VERY rough guestimates and should be taken only as vague guidelines.

image.thumb.png.f666fe525debad89237495761b5bf8b1.png

Above is a SS of my CPU activity while running ONI on X3.  Below is a SS of my CPU when not running ONI.

image.thumb.png.4b9a523bb6bf1f764ad8f085c20b2433.png

CPU load while running ONI is 164.9.  When not running ONI its 24.3.  So while ONI is running, 140% of a CPU core is being utilized.  Lets ignore the OS overhead.  Before the multithreading code was added, ONI would use 100% of a single CPU time, split across all 4 cores.  This would show a CPU load average of 25% per core.  So we can guess that about 40% of the processing is now multithreaded.  It helps (a LOT).  The map I used for this benchmark would not run at 60fps before the multithreading was added.

 

Oni still benefits from raw single core CPU power. And when it come to this, a modern CPU is ~60% faster compared to your 10 year old one. 

You´re right, the individual steps where really small. 3rd gen to 4th gen ~ 5%. But it sums up. Yours is 2nd generation. We are now at 10th gen. Every generation 4-8% performance gain. You may do the math.

I'm pretty sure there is still a lot of optimization Klei can pursue. Late game ONI's doesn't look half as massive as a Factorio's megabase, and yet, the later run real smooth. (Although I guess Factorio runs much less physics). Now whether or not Klei is going to make the extra effort is another subject entirely. (And also, do their engine allows for such optimization is another valid question). From what I read, ONI runs on Unity. And from what I heard, Unity is more about cross-platform than performance. 

8 hours ago, SharraShimada said:

Oni still benefits from raw single core CPU power. And when it come to this, a modern CPU is ~60% faster compared to your 10 year old one. 

You´re right, the individual steps where really small. 3rd gen to 4th gen ~ 5%. But it sums up. Yours is 2nd generation. We are now at 10th gen. Every generation 4-8% performance gain. You may do the math.

How do you figure?  Max Turbo on his cpu is 3.8 GHz.  I guess the i9-9900K does say it boosts to 5 GHz, but that's only 31% faster.

41 minutes ago, psusi said:

How do you figure?  Max Turbo on his cpu is 3.8 GHz.  I guess the i9-9900K does say it boosts to 5 GHz, but that's only 31% faster.

CPU's Hz is not operation per second. They can be used only for comparasion of similar processors.

My old CPU(Phenom II X4 945) was 3GHz, new one(Ryzen 5 3500) is 3.6(Up to 4.1) and new one is more than 2 times faster in single thread operations.

1 hour ago, SVV said:

CPU's Hz is not operation per second. They can be used only for comparasion of similar processors.

This was largely true for a few years when they started doing things like introduce the superscalar architecture with the pentium, and such, but I haven't seen any new techniques for getting more instructions per clock in the last decade.  Certainly not doubling it.

11 hours ago, Mastermindx said:

From what I read, ONI runs on Unity. And from what I heard, Unity is more about cross-platform than performance. 

ONI is coded in C#. Unity is framework to help game development, specialy with 3d games, but all game logic and calculations are programmers work. So yes, there is still a lot of places they could code better.

My dream is that at some point Klei would make this game open source, so we could make it better and better. I bet there are a lot of us programmers here, which loves this game and would love to add couple pull requests with fixes :)

11 hours ago, psusi said:

This was largely true for a few years when they started doing things like introduce the superscalar architecture with the pentium, and such, but I haven't seen any new techniques for getting more instructions per clock in the last decade.  Certainly not doubling it.

What counts is IPC. Instructions per Cycle. Cycle is the thing, you know as GHz. Modern CPUs are capable of way more instructions in the same time, compared to older ones. Remember there are 10 years in between. You cant just compare a  3GHz CPU from 2010 with a 3GHz CPU from today. They are from different worlds. All they have in common is the frequency they run. Thats it.

9 hours ago, SharraShimada said:

Modern CPUs are capable of way more instructions in the same time, compared to older ones. Remember there are 10 years in between.

How?  I haven't heard of any new innovations lately that would allow for more IPC.  Maybe I just haven't been paying enough attention.

16 minutes ago, psusi said:

How?  I haven't heard of any new innovations lately that would allow for more IPC.  Maybe I just haven't been paying enough attention.

That's because they don't. What they can do are far more impressive instructions per one clock cycle. CPUs are gigantic toolboxes with adders, multipliers, codecs and GPU and various forms of high math analysis operations all under the hood. Every generation there's always more things to add in. There is a substantial speed gain when a CPU can perform a very complex video codec operation in one cycle, because it's the same operation that everyone uses. The alternative is to spend dozens of multiplications and memory moves. Both methods end up in the same place, but the newer generation has a dedicated tool that gets it there faster. That's what MMX, SSE and faster text parsing and so on and so forth are all about.

Of course if you don't actually use those tools, it doesn't matter. Compilers are pretty good, but the programmer is always the chokepoint in making the best code.

On 2/4/2020 at 9:09 AM, bobucles said:

Of course if you don't actually use those tools, it doesn't matter. Compilers are pretty good, but the programmer is always the chokepoint in making the best code.

Exactly; those things don't help most software.  Specialized software like video transcoding might benefit from some of the newer extensions, but not ONI.

1 hour ago, bobucles said:

Personally I think it'd be far more convenient if they used a compiler that only used MOV instruction. Bonus points if the code itself looks like a dupe.

OK, that was awesome.  I would HATE to have to reverse engineer MOV-only code.

I have a theory that late game AI lag is caused by the debris on the map.  Every dupe decides that each individual piece of debris does not have a task for them, or they give it a ranking, or unreachable.  That is a lot of work.  As the game gets longer, more debris forms.  My current late game plan involves using rockets to melt down excess debris and use an infinite waterfall to compress it, then use pitcher pumps to retrieve the material if needed.

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...