Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: fps, yes fps again  (Read 2526 times)

Libash_Thunderhead

  • Bay Watcher
    • View Profile
fps, yes fps again
« on: March 23, 2016, 11:55:08 pm »

I noticed an interesting thing.

When I were playing 4x4 map with lots of trees, caverns, big stockpiles and even HFS, fps usually stayed at around 25-35(lower when caravans came) when I had more than one hundred and half dwarves and guests.

Then I played a 1x1 map. I did not mine, did not build walls, and I didn't even have visitors. When population went higher and higher fps dropped quickly. When the caravan came, I got a nice 30 fps. When that happened, there were 170 visible units on the map, including animals, both caged and not caged, merchants and my own dwarves.

If it is path finding that slows things down then map #2 should be much faster than map #1, right? Actually it was indeed faster, but not by much (consider the first map was 16 times bigger in size). 
« Last Edit: March 24, 2016, 06:39:38 am by Libash_Thunderhead »
Logged

Geltor

  • Bay Watcher
    • View Profile
Re: fps, yes fps again
« Reply #1 on: March 24, 2016, 04:05:11 am »

this is an interesting question because it also made me wonder why would trolls in dark fortresses destroy fps when they are unmoving. my hypothesis is that there is some passive, pathfinding-involved status check going on each tick or something, but its impossible to know for sure.
Logged

Libash_Thunderhead

  • Bay Watcher
    • View Profile
Re: fps, yes fps again
« Reply #2 on: March 24, 2016, 06:48:03 am »

It doesn't have to be path finding related.
As I said, the second map was so small and the dwarves didn't have access to the subterranean tiles. It was only slightly faster than the first one.
Logged

Geltor

  • Bay Watcher
    • View Profile
Re: fps, yes fps again
« Reply #3 on: March 24, 2016, 08:27:20 am »

It doesn't have to be path finding related.
As I said, the second map was so small and the dwarves didn't have access to the subterranean tiles. It was only slightly faster than the first one.
could be that they path a radius around themselves and that is more expensive than pathing farther but more rarely. still, you could be right. one thing is for certain if this is not the case: the main bottleneck is derived from population size, may it be pathfinding, something else, or a mix between them... and if and when the discussion turns to multithreading, its safe to say that you dont have to re-invent df concurrently, but only to refactor those areas, that would give the game its deserved breathing space for a long, long time.
Logged

redivider

  • Bay Watcher
    • View Profile
Re: fps, yes fps again
« Reply #4 on: March 24, 2016, 10:14:56 am »

I was thinking about this as well, especially because destroying tons of items (say 10k) gives a visible fps boost. I believe the game is constantly tracking specific properties and checking if they change (ex: item wear, temperature, does it have contaminants, is it on fire or not etc.) But yeah fps becomes a problem no matter how good your cpu is because technologically we have reached the point where more GHz is not feasible but more cores are. 3GHz has been the standard for a while now with cca. 4GHz overclocks and 5+ for extreme cooling. "More cores" doesn't help DF sadly.
Logged

Haelfix

  • Bay Watcher
    • View Profile
Re: fps, yes fps again
« Reply #5 on: March 24, 2016, 11:36:20 am »

It will get to a point in your forts life where you have basically finished all of your megaprojects and where you only need ~20 dwarves for maintenance, food, hunting etc.   You then get 180 idlers doing social things.  At that point fps goes way up..  Like to 20 fps or so.  But the second you designate a mass job (like picking up arrows across the map) you will see a massive fps drop where suddenly every dwarf does a pathfinding check at once and where fps will drop to unplayable levels (even with super dwarf speed) and stay that way until the job is finished.

This is a clear check that pathfinding is a fps hog.

As you said, atomsmashing 10k items at once is another pretty large fps boost.

So yea, fps comes when the number of items gets too high, and where the amount of entities doing 'long' pathfinding checks goes too high (thats why you cage all animals and have burrow/traffic restrictions with as many walls as possible, and possibly use mods to reduce the amount of items as well as regular atomsmashing, dfhack cleaning maintenance).

I feel like there are some coding things that could be done to alleviate some of the pathfinding issues that would really prolong a fortresses endgame life, but that it probably does not make sense to do that at this point in the development cycle.
Logged

Libash_Thunderhead

  • Bay Watcher
    • View Profile
Re: fps, yes fps again
« Reply #6 on: March 24, 2016, 08:11:08 pm »

The second fort ran at 40-50 fps when the caravans left (80 dwarves, 20 animals, stockpiles, etc).

Then I started a new game on a 1x1 map.  I used dfhack's migrants-now to quickly spawn 80 dwarves (and 26 pets), so they didn't have any jobs(they just stood near the wagon). 40 fps.
« Last Edit: March 24, 2016, 08:14:44 pm by Libash_Thunderhead »
Logged

Atomisk

  • Bay Watcher
  • Majora
    • View Profile
Re: fps, yes fps again
« Reply #7 on: March 25, 2016, 08:18:40 am »

Someone explained this already. Pathfinding is not much of a problem. It's the amount of entities building up actions like having sight radius, everyone taking a step, deciding which direction to step, always getting ready to detect stealth, remembering dozens of moods and all sorts of things all at once. But the biggest draw on your FPS is apparently items. Someone deleted 8000+ items with a ten year fort and their fps went from 5 to 25.
Logged
Signatures are for people with things to show off. I'll show off something.

Geltor

  • Bay Watcher
    • View Profile
Re: fps, yes fps again
« Reply #8 on: March 25, 2016, 05:50:54 pm »

Someone explained this already. Pathfinding is not much of a problem. It's the amount of entities building up actions like having sight radius, everyone taking a step, deciding which direction to step, always getting ready to detect stealth, remembering dozens of moods and all sorts of things all at once. But the biggest draw on your FPS is apparently items. Someone deleted 8000+ items with a ten year fort and their fps went from 5 to 25.
so why do you conclude items is the biggest draw? if he would vaporize everyone it would probably shoot to 100.
Logged

Libash_Thunderhead

  • Bay Watcher
    • View Profile
Re: fps, yes fps again
« Reply #9 on: March 25, 2016, 08:27:20 pm »

If I had to guess?

Every time the map updates where everything is, it includes all items. Which seems... rather odd. Dunno.
But in my later test, the dwarves had only their clothes on their back.
Logged

Melting Sky

  • Bay Watcher
    • View Profile
Re: fps, yes fps again
« Reply #10 on: March 29, 2016, 11:06:34 pm »

Although there are known drains on FPS which are predictable and logical such as large numbers of units, large numbers of items, sprawling fortress design with scattered numerous stockpiles etc. there are also massive FPS sinks that are bug related and unpredictable. My guess is that you are running into one of these FPS wrecking bugs in your second fort which should by all measures be the faster running of the two unless you have a bunch of moving fluids or something like a volcano or waterfall on the smaller map.

Some of the more common causes for FPS wrecking bugs include animals getting stuck behind impassible doors and general pathing problems with fliers. If you are able to discover or narrow down the cause of the FPS draining bug it would be very helpful to upload the save to the bug tracker so Toady can look at it. I imagine pathing bugs are an absolute nightmare to try and track down. Those are the kinds of bugs that will leave you bashing your head on your desk after wasting a week strait and getting no closer to finding let alone solving the problem.

Sometimes temperature calculations can get a bit buggy and fps draining so try toggling to the temperature calculation option off and see if it changes anything. Other things to look for would be flying creatures and large amounts of moving fluids. I'm pretty sure I remember reading a thread where cavern tree growth had trapped a troglodyte or something and it was wrecking the FPS. I remember there being quite a few tree related pathing problems when the multi-tile trees were first added and I think some of those issues likely remain despite Toady rooting out the worst offenders.
« Last Edit: March 29, 2016, 11:14:58 pm by Melting Sky »
Logged

Robsoie

  • Bay Watcher
  • Urist McAngry
    • View Profile
Re: fps, yes fps again
« Reply #11 on: March 30, 2016, 04:12:25 pm »

On my old system in 42.06 i'm currently still a 100 dwarves forts on a 2x2 map , didn't breached in caverns, have temperature turned off, and regularly destroy any tree and useless items i have and so far i'm still maintaining the game around 60 fps, the dwarves are moving fast after all the years, several goblin sieges have met their doom in front of my single full steel equiped squad made of legendary warriors.

you should post your save, i'm curious to give a look into it and see if i can spot the problem that is cutting your fps to 30 on a 1x1 map
Logged