Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [spoilers] Why all the lag?  (Read 1962 times)

MrC

  • Bay Watcher
    • View Profile
[spoilers] Why all the lag?
« on: September 18, 2011, 07:58:19 pm »

Whenever i open up the HFS my FPS drops badly  why is this?

If i kill the clowns will the FPS improve?
Logged

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: [spoilers] Why all the lag?
« Reply #1 on: September 18, 2011, 08:00:46 pm »

HFS can fly, swim, and magma-swim.  They pathfind through every non-wall tile on the map.  That's a lot of pathfinding.  Strike them from the holy underground, and claim time itself as your slave

MrC

  • Bay Watcher
    • View Profile
Re: [spoilers] Why all the lag?
« Reply #2 on: September 18, 2011, 08:10:02 pm »

Ok then i will continue my candy weapon/armor production.

Jebus Zombie Christ my HFS is 91 Z-levels above the bottom layer...


Logged

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: [spoilers] Why all the lag?
« Reply #3 on: September 18, 2011, 08:11:55 pm »

Don't take the name of Zombie Jesus in vain.  Nor Raptor Jesus...

Eoganachta

  • Bay Watcher
  • The Second Mouse Gets The Cheese
    • View Profile
Re: [spoilers] Why all the lag?
« Reply #4 on: September 18, 2011, 08:17:14 pm »

Don't take the name of Zombie Jesus in vain.  Nor Raptor Jesus...

Armok is the one True God!
*takes bite into kitten*
Logged
Quote from: Loud Whispers
Giant Cave Spider Wagons. Where are your Gods now Goblins?
This minecart has more kills then every other weapon in the mountainhomes.
Quote from: Broken
every place i go ends covered in vomit
Quote from: Karnewarrior
WHERE DO YOU EVEN GET ENOUGH BABY FOR A PICKAXE? THERE ISN'T ENOUGH BABY.

NecroRebel

  • Bay Watcher
    • View Profile
Re: [spoilers] Why all the lag?
« Reply #5 on: September 19, 2011, 12:02:08 am »

HFS can fly, swim, and magma-swim.  They pathfind through every non-wall tile on the map.  That's a lot of pathfinding.  Strike them from the holy underground, and claim time itself as your slave
This doesn't account for the lag caused. Even if you did have all that pathfinding occurring, it wouldn't lag that much; if you did, large sieges of flying, swimming, magma-swimming creatures, like the FD Nightwings for instance, would cause similar lag, but they don't. In addition, they only do pathing once, then continue on that path until they're interrupted, so that wouldn't cause such a consistent drop as they cause, not to mention that they can't possibly be doing pathing to places they can't reach, as if you seal off Hell again with a drawbridge or similar the lag (eventually) disappears even if the clowns don't. If they actually pathed through every non-wall tile, well, sealing the paths wouldn't help.

The actual answer is that they all have the BUILDINGDESTROYER:2 tag, and so path towards every single building you've got, and probably repath to them every step. You can see this phenomenon with buildingdestroyer sieges, too, which also cause 99% FPS drops while they can path to all of your buildings. Since flying, swimming, magma-swimming creatures in large numbers due to siege don't cause massive lag, and buildingdestroyer creatures in large numbers due to siege do, the implication is that the large numbers of flying, swimming, magma-swimming, buildingdestroyer creatures due to HFS cause lag due only to the last property, not the first 3.
Logged
A Better Magma Pump Stack: For all your high-FPS surface-level magma installation needs!

Valdrax

  • Bay Watcher
  • HUGE ELF (bluh bluh)
    • View Profile
Re: [spoilers] Why all the lag?
« Reply #6 on: September 19, 2011, 12:13:58 am »

HFS can fly, swim, and magma-swim.  They pathfind through every non-wall tile on the map.  That's a lot of pathfinding.  Strike them from the holy underground, and claim time itself as your slave
I haven't seen any evidence that pathfinding gets worse the less restrictions there are.  In fact, I saw small FPS improvements when I started carving fortress corridors entirely out of linked up/down stairs and eliminated interior fortress walls wherever possible (i.e. everywhere but designated rooms, moodable workshops, and underground animal pastures).

Then again, I haven't rigorously tested it.  Has anyone else?
Logged
The history of a good fortress is not written in blood, it's painted on the walls by the hand of a melancholy orphan.

Vehudur

  • Bay Watcher
  • [evil]
    • View Profile
Re: [spoilers] Why all the lag?
« Reply #7 on: September 19, 2011, 12:19:20 am »

Complexity of path finding is not an issue, the length of it is.  I'd expect the dwarves to check every possible path until they find the right one, but I'm not sure if they recalculate it unless they hit an error (can't path/dangerous terrain/proximity to an enemy for civillians/ext.).
Logged
Quote
...and a third died in his bunk of natural causes - for a dagger in the heart quite naturally ends one's life.

I used to have an avatar, but I was told to remove it after it kept making people go insane.

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: [spoilers] Why all the lag?
« Reply #8 on: September 19, 2011, 12:48:19 am »

Dwarves only re-path if their original path is broken, observed frequently in uses like the Undump.

I'll believe it's the building destroyer thing.  That sounds entirely more legit.

Valdrax

  • Bay Watcher
  • HUGE ELF (bluh bluh)
    • View Profile
Re: [spoilers] Why all the lag?
« Reply #9 on: September 19, 2011, 12:30:58 pm »

Complexity of path finding is not an issue, the length of it is.  I'd expect the dwarves to check every possible path until they find the right one, but I'm not sure if they recalculate it unless they hit an error (can't path/dangerous terrain/proximity to an enemy for civillians/ext.).
You are young in the ways of search algorithms.  Look up the A* search algorithm some time.  You can intelligently weigh options by, for example, increasing the cost of movement that takes you further away from a target to bias the path more towards a straight-line from A to B.  Once you have a workable path, the diminishing returns of searching alternate paths make it logical to design the search not to keep searching too much longer.  I mean, that's half the point of using an informed search algorithm.

I can't say for certain that DF uses A* (after all, there are several other decent options out there), but the fact that we have a way of increasing the cost of squares with [d]-[o] argues for it or something like it.  In the case that DF does use A*, removing obstacles to pathing would be expected to increase FPS.
Logged
The history of a good fortress is not written in blood, it's painted on the walls by the hand of a melancholy orphan.

Xen0n

  • Bay Watcher
  • Took joy in ‼SCIENCE‼ lately.
    • View Profile
Re: [spoilers] Why all the lag?
« Reply #10 on: September 19, 2011, 02:41:04 pm »

HFS can fly, swim, and magma-swim.  They pathfind through every non-wall tile on the map.  That's a lot of pathfinding.  Strike them from the holy underground, and claim time itself as your slave
I haven't seen any evidence that pathfinding gets worse the less restrictions there are.  In fact, I saw small FPS improvements when I started carving fortress corridors entirely out of linked up/down stairs and eliminated interior fortress walls wherever possible (i.e. everywhere but designated rooms, moodable workshops, and underground animal pastures).

Then again, I haven't rigorously tested it.  Has anyone else?

Yeah, I keep finding conflicting reports that seem to say the optimal fort design for pathfinding is:
A)  Have every single tile be an up/down stair, to increase odds that a dwarf with always have a straight-line path to his destination.
OR
B)  Have one main highway system, with as few branching paths as possible, with each room separated with as few entrances as possible.  Then use traffic designations to make the main highway "high traffic" and dead end rooms "restricted traffic," with "low traffic" around the entrances to rooms.  This is to minimise the options available for a dwarf to get to his destination.

I'm planning on ending my fort by converting all the mined out spaces and walls into stairs and seeing the effect, but what I'd like to do is have a test fort that is made according to design B) to begin with (since mine is a bit of a mix of the two ideas) and then convert it to type A) all at once, and see the effect.  Actually, I could probably get a pre-made fort that is made according to A) or B) and convert it... Anyone know of any forts on the file depot that are supposedly optimised one way or another for pathing?
Logged