Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Why does looking at the surface influence FPS that much?  (Read 2204 times)

martinuzz

  • Bay Watcher
  • High dwarf
    • View Profile
Why does looking at the surface influence FPS that much?
« on: July 17, 2014, 12:08:50 pm »

When I am looking at my fortress underground levels, I get 81-85 FPS

When I look at the surface level, my FPS drops to 40-45.

What causes this? Flowing water? I do see some slowdown as well, one level below surface, but not as much as on the surface level.
My surface is completely flat, no waterfalls or anything fancy. Just a minor 3-4 tile wide river.

I've noticed this with DF 2012 as well, so I doubt it's the new trees.

More in general, Why am I seeing below 100 FPS? Recent immigration wave brought population to 58. There's maybe 20 wildlife roaming about, and my few tame animals just got killed by the first goblin siege. It's only year 2. I am surprised the game is already slowing down to below FPS cap (default 100).

Running it on an i7 ivy bridge, 8GB Ram. Is this new update bugginess, or is this what I can expect? I kinda bought this PC so I would not have to abandon forts to FPS death anymore, but this has me worried that when I get 200 population, I'll drop below 10 FPS, at this rate :(
Logged
Friendly and polite reminder for optimists: Hope is a finite resource

We can ­disagree and still love each other, ­unless your disagreement is rooted in my oppression and denial of my humanity and right to exist - James Baldwin

http://www.bay12forums.com/smf/index.php?topic=73719.msg1830479#msg1830479

Slackratchet

  • Bay Watcher
    • View Profile
Re: Why does looking at the surface influence FPS that much?
« Reply #1 on: July 17, 2014, 12:14:31 pm »

Just a guess but if you are looking from the middle down to the bottom of the map the engine only has to calculate about half the blocks than if you're looking from the top down. Displayed or not I imagine it still has to figure out whether you can see every block from where your viewpoint is down.
Logged

martinuzz

  • Bay Watcher
  • High dwarf
    • View Profile
Re: Why does looking at the surface influence FPS that much?
« Reply #2 on: July 17, 2014, 12:19:15 pm »

If that were the case I'd see a gradual decline in FPS the further I go up.
Instead, there's a distinct drop from 80 to 72 FPS when going from z-2 to z-1 (the river's water is running on z-1), and an even steeper drop from 72 to 40-45 FPS when going from z-1 to surface z-0. All levels below z-1 have a steady 79-80 FPS.
Logged
Friendly and polite reminder for optimists: Hope is a finite resource

We can ­disagree and still love each other, ­unless your disagreement is rooted in my oppression and denial of my humanity and right to exist - James Baldwin

http://www.bay12forums.com/smf/index.php?topic=73719.msg1830479#msg1830479

Agent_Irons

  • Bay Watcher
    • View Profile
Re: Why does looking at the surface influence FPS that much?
« Reply #3 on: July 17, 2014, 12:22:17 pm »

Hmm. How many lakes and things do you have? Do you get a similar but slightly lessened effect at the cavern layers?

The new update might make displaying tiles more expensive, so maybe it's just a question of the number of non-black squares.

At altitude (z+5) or so where it's just open air, is it still slow?
Logged

martinuzz

  • Bay Watcher
  • High dwarf
    • View Profile
Re: Why does looking at the surface influence FPS that much?
« Reply #4 on: July 17, 2014, 12:29:08 pm »

Hmm. How many lakes and things do you have? Do you get a similar but slightly lessened effect at the cavern layers?
Lakes and things:
http://puu.sh/afwKw/77efaf1072.png
That's about 40% of my 3x7 embark map.

As for caverns, I don't know, I have yet to breach them. I do not recall if caverns had the same effect as surface view back in df2012.

The new update might make displaying tiles more expensive, so maybe it's just a question of the number of non-black squares.
It's still a very small fortress. Humble beginnings, I have only dug down 5 levels so far, and did not mine out much on either yet. This is my largest mined out space yet, at z-5.
http://puu.sh/afwxn/1f0e9cce1a.png

At altitude (z+5) or so where it's just open air, is it still slow?
Going up to z+11, which is 2 levels above treetops, FPS goes up to 60, which is still less than what I get at z-1.
« Last Edit: July 17, 2014, 12:30:55 pm by martinuzz »
Logged
Friendly and polite reminder for optimists: Hope is a finite resource

We can ­disagree and still love each other, ­unless your disagreement is rooted in my oppression and denial of my humanity and right to exist - James Baldwin

http://www.bay12forums.com/smf/index.php?topic=73719.msg1830479#msg1830479

Iamblichos

  • Bay Watcher
    • View Profile
Re: Why does looking at the surface influence FPS that much?
« Reply #5 on: July 17, 2014, 12:39:04 pm »

When something is flowering or plants are growing, my FPS drops dramatically... just something to consider.
Logged
I'm new to succession forts in general, yes, but do all forts designed by multiple overseers inevitably degenerate into a body-filled labyrinth of chaos and despair like this? Or is this just a Battlefailed thing?

There isn't much middle ground between killed-by-dragon and never-seen-by-dragon.

Robsoie

  • Bay Watcher
  • Urist McAngry
    • View Profile
Re: Why does looking at the surface influence FPS that much?
« Reply #6 on: July 17, 2014, 01:58:54 pm »

Yes, even on small embark and just the starting dwarves i noticed some slowdown that i never had even at 150 pop on 0.34.11 , so i guess all those new surface features (falling leaves and fruits, trees, blooming plants, pathfinding of insane creature insisting to climb trees, and jump to their death or being stuck etc... instead of walking regularly) aren't yet very optimised.

Additionally, there's a bug in current version that has animals and sometime dwarf/goblins/human/elf population of site from even pocket worlds to get to insane number in very few years, and with the new world update that is certainly not helping at all (but that one should be fixed for incoming 0.40.04 , for new world that will be generated with it).
Logged

Areyar

  • Bay Watcher
  • Ecstatic about recieving his own E:4 mug recently
    • View Profile
Re: Why does looking at the surface influence FPS that much?
« Reply #7 on: July 17, 2014, 03:35:16 pm »

I think the newish grassy plants sometimes 'ripple' as though they are windblown. This could be a factor.
Logged
My images bucket for WIPs and such: link

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: Why does looking at the surface influence FPS that much?
« Reply #8 on: July 17, 2014, 03:44:47 pm »

Displaying a map tile takes a varying amount of work depending on what it is:

* Unrevealed tiles take almost no time at all - it just needs to look up what "random glyph" to display there
* Layer stone tiles need to take the biome number and layer number and look up the layer material, then look up the inorganic raw object to get the symbol/color
* Lava stone tiles need to take the biome number and look up some region information to determine what lava-stone to use, then continue as above
* Feature stone tiles (i.e. adamantine) need to look up the map feature located within the tile to figure out what it's made of, then continue as above
* Vein stone tiles need to do a linear lookup within a list specific to the 16x16x1 map block to see which vein they match and determine the material, then continue as above
* Grass tiles need to do a linear lookup within that same list to figure out what type of grass is present, then look up the plant raw object to get the symbol/color (and also account for animations)
* Shrubs and saplings need to search a separate list (not sure if it's the global list or a column-specific one) to find the plant in question and determine its symbol/color
* As of 0.40, trees need to do a linear search through a column-specific list (one list per 48x48 tile embark region block) to determine what growths are present in the tile and look up within the plant itself to get the symbol/color
* Constructed tiles need to do a binary search by X/Y/Z coordinates in a separate list to determine what material it uses, then look up that material for the symbol/color
* On top of all of that, it does a binary search by X/Y/Z coordinates in yet another list to determine whether or not an engraving is present (and, if there is, what tile to display)
* Other tile contents (units, buildings, items, vermin, etc.) get displayed
* After all of that is done, it then does yet another linear search (though the same list as with vein stones and grass) to see if the tile has a spatter on it (e.g. mud, blood, vomit, or leaves) and adjust the symbol/color accordingly

If you want to keep your FPS high, even when paused, there are several things you can do:
1. Avoid using constructions. Flarechannel's average FPS was ridiculously low - this is one of the reasons why.
2. Use as few engravings as possible.
3. Keep your map clean of contaminants. The DFHack "clean map" command works well for this, though some may consider it cheaty.
4. Minimize the number of living plants. This will not endear you to the Elves.
5. Avoid looking at complicated areas.
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

Melting Sky

  • Bay Watcher
    • View Profile
Re: Why does looking at the surface influence FPS that much?
« Reply #9 on: July 17, 2014, 04:08:46 pm »

So does DF re-render every sprite on the layer you are looking at with each new frame or only the sprites that change from frame to frame?
Logged

Rum

  • Bay Watcher
    • View Profile
Re: Why does looking at the surface influence FPS that much?
« Reply #10 on: July 17, 2014, 05:28:49 pm »

Changelog implies that the FPS slowdown is caused by world gen functions in fort mode.  Which is why Toady has asked us all to use small worlds with short histories for the time being (less of a drag on worldgen.)

He has stated that he will work on calender (aka world gen in for mode) optimization shortly
Logged

Panando

  • Bay Watcher
    • View Profile
Re: Why does looking at the surface influence FPS that much?
« Reply #11 on: July 17, 2014, 08:04:58 pm »

I've found that reducing Graphical FPS, from 50 to say 20 (believe me, you wont notice the difference with the extremely low 'resolution' of movement and  animation) helps a bundle in this version. You might even try lower than 20 and find further improvements with little sacrifice.
Logged
Punch through a multi-z aquifer in under 5 minutes, video walkthrough. I post as /u/BlakeMW on reddit.