Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Would a hard limit on total number of creatures present in any fort fix FPS💀?  (Read 970 times)

darkhog

  • Bay Watcher
  • JAGIELSKI is PERFECTION
    • View Profile
    • Jagielski Gaming YT channel

Wasn't sure where to put it since it's neither a suggestion, nor a bug report, just some ideas. So one of the biggest FPS death causes is pathfinding, especially when stuff like clown armies, undead body parts and so on are concerned, which goes back to the number of creatures trying to pathfind each frame. But wouldn't putting a hard limit on the total number of creatures on the map at the same time solve FPS death, at least when large amounts of creatures are concerned? Or, at the very least, putting a limit on the amount of creatures that can actually pathfind every frame, others being frozen in time until it's their "turn".


//edit: Another cause for the FPS death seems to be creatures stuck on trees or other inaccessible locations - would making them able to jump off, even if it would injure them help reduce chances of FPS death from such occurrences?
« Last Edit: December 10, 2023, 05:13:03 pm by darkhog »
Logged
I am a dwarf and I'm digging a hole. Diggy Diggy hole, diggy diggy hole.

If I say something funny, don't ask if you can sig it. Just do it (though credit me).

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile

So one of the biggest FPS death causes is pathfinding

Nope.
Logged
Reading his name would trigger it. Thinking of him would trigger it. No other circumstances would trigger it- it was strictly related to the concept of Bill Clinton entering the conscious mind.

THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. This was inevitable (Y/y)?

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile

Pathfinding itself actually doesn't cause much performance hit, outside of pathological conditions like flowing water causing the connectivity map to recalculate frequently.  Putnam did a lot of profiling to confirm that.

Citizens are supposed to be able to climb down from getting stranded now, so that should be better than it was at one point.  Animals still get stuck in trees, but I don't think they contribute much to FPS since they don't do much but randomly wander.  I think there are still some outstanding issues like having strange moods in burrows that can cause FPS to tank if a dwarf can't reach an item they want.

That said, reducing the number of creatures will always help.  I'm pretty sure the number of fort citizens has an outsized impact since they do more than things like animals, but I'm not sure if sapient creatures like goblins or random cavern civilization creatures have the same impact as dwarves despite having no meaningful relations or other things to calculate.  For all I know the game does the calculations and just does nothing with them.

I am curious if it's practical to amortize unit calculations though, like half of the units "thinking" on A frames and the other half on B frames.  The game may even do this for all I know, since you'll occasionally notice dwarves pursuing some task for a while after it's meaningless, like station orders, before abruptly changing to something else a few frames later.  The complex interactions between units probably make this hard to do in practice too.

One thing that would definitely help some people is fixing the fact that you can get hundreds of cavern people on your map.  I don't know if it's just a problem with agitating them and getting unending ambushes, or if they just accumulate over time no matter what.  I'm also not sure if they start accumulating or showing up before the caverns are revealed.
Logged
Through pain, I find wisdom.

anewaname

  • Bay Watcher
  • The mattock... My choice for problem solving.
    • View Profile

Minor points (not intended to take away from what has already been covered):
Spoiler (click to show/hide)
Logged
How did I manage to successfully apply the lessons of The Screwtape Letters to my perceptions of big grocery stores?

brewer bob

  • Bay Watcher
  • euphoric due to inebriation
    • View Profile

Flying creatures can also do horrible things to FPS in the right circumstances.

The upside of this FPS drop on certain maps is that you get an early warning that the kea menace has arrived.

darkhog

  • Bay Watcher
  • JAGIELSKI is PERFECTION
    • View Profile
    • Jagielski Gaming YT channel

Still, if there's a hard limit on the number of creatures on the map at once, there's a less of a possibility that any of those things happen. It would be reasonably high to not affect the gameplay too much, but also low enough to improve the things.

Also another thing would be to limit how often creatures could repath, the lower FPS (as percentage of max FPS), the tighter the limit. IMO having a creature, including a megabeastm stuck is preferable to unplayable FPS.
Logged
I am a dwarf and I'm digging a hole. Diggy Diggy hole, diggy diggy hole.

If I say something funny, don't ask if you can sig it. Just do it (though credit me).

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile

So one of the biggest FPS death causes is pathfinding

Nope.

Yeah, fair response, but the primary cause of fort FPS issues is still... number of creatures. So the title question's a valid one. And the answer is basically just "yes", straight-up.

Still, if there's a hard limit on the number of creatures on the map at once, there's a less of a possibility that any of those things happen. It would be reasonably high to not affect the gameplay too much, but also low enough to improve the things.

Also another thing would be to limit how often creatures could repath, the lower FPS (as percentage of max FPS), the tighter the limit. IMO having a creature, including a megabeastm stuck is preferable to unplayable FPS.

Yeah, this is something I've sorta-kinda considered. Making your units who are stuck in a tree explicitly try to climb around instead of just path failing and posting to the errorlog about it is a sort of "step one" of this, there's a flag in there now that makes this happen and adding more "chill out with the panic pathing" stuff might just generally be a good idea. While slow FPS reduction over time isn't a pathfinding problem, sudden drops to the single digits usually is. The thread I made there was using "FPS death" to mean the general complaint of "slow, inevitable decline in game speed", which pathfinding is not really a party in at all.
« Last Edit: December 21, 2023, 06:30:03 pm by Putnam »
Logged

Pillbo

  • Bay Watcher
    • View Profile

It seems like flying is often brought up as a problematic issue in general. Has there be any thought put into ways to address the way flying currently works? I'd be interested in seeing the results of profiling flying creatures behavior.

Edit - limiting creatures in some way will likely have to be part of the updates to adv mode since you can't really even go into a lot of cities or pits without the game becoming unplayable. So maybe that kind of change will work out for fort mode too.
« Last Edit: December 21, 2023, 09:07:59 pm by Pillbo »
Logged