Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Forbidding Doors to large areas = Better FPS?  (Read 1359 times)

Dr_Pylons

  • Bay Watcher
  • [GREEDY]
    • View Profile
Forbidding Doors to large areas = Better FPS?
« on: December 10, 2010, 01:38:42 pm »

Does forbidding doors work in the same way that walling off large sections, i.e. a mine shaft, works? I have a large mining operation that I cancelled since I have enough "greediness" to last me awhile, and I put doors up and forbade them. I haven't noticed an increase in FPS very much (continues to hover around ~40). Does it only work with walls?
Logged

Lord Aldrich

  • Bay Watcher
    • View Profile
Re: Forbidding Doors to large areas = Better FPS?
« Reply #1 on: December 10, 2010, 02:28:28 pm »

Unfortunately, doors don't seem to affect the path-finding algorithm. The door prevents movement on the frame where the actor tries to actually move through the door tile, but the algorithm walks through them like they weren't there. Because the algorithm is what's eating up CPU cycles, you won't see any increase in FPS.
Logged

Dr_Pylons

  • Bay Watcher
  • [GREEDY]
    • View Profile
Re: Forbidding Doors to large areas = Better FPS?
« Reply #2 on: December 10, 2010, 02:53:05 pm »

Alrighty then. Done walled it off instead. Thanks.
Logged

Sir Crashalot

  • Bay Watcher
    • View Profile
Re: Forbidding Doors to large areas = Better FPS?
« Reply #3 on: December 10, 2010, 02:56:53 pm »

Just out of interest, did walling it off help your FPS?

I have a fort chugging along at 20 FPS and walling off all my used up mining shafts and tunnels didn't help a bit.
Logged

LealNightrunner

  • Bay Watcher
    • View Profile
Re: Forbidding Doors to large areas = Better FPS?
« Reply #4 on: December 10, 2010, 03:20:23 pm »

You'll only notice an increase if the area is regularly traveled.  If you wall off a distant mining operation and the rest of your fort is an open field the pathfinding algorithm never makes it that far into the tunnels anyway because it's typically hit a better path before then.

An alternative to walling off areas is to mark the rooms as restricted traffic.  Restricted greatly increases the cost of paths and causes the algorithm to "give up" on paths through them much quicker without evaluating the entire room: The algorithm will take ~13 normal traffic tiles per single restricted tile it steps on, and this doubles if you mark heavily traveled areas (central corridors and stairwells) as high traffic.  It's not quite the benefit of completely walling off the area because there's still some evaluation going on, but it leaves the space usable.

EDIT: The related Wiki article may shed some more light on it than I can.
« Last Edit: December 10, 2010, 03:23:45 pm by LealNightrunner »
Logged
Current Fort: NatureRags

Dr_Pylons

  • Bay Watcher
  • [GREEDY]
    • View Profile
Re: Forbidding Doors to large areas = Better FPS?
« Reply #5 on: December 10, 2010, 03:24:51 pm »

Just out of interest, did walling it off help your FPS?

I have a fort chugging along at 20 FPS and walling off all my used up mining shafts and tunnels didn't help a bit.
Actually, it dropped to ~30.  :P
You'll only notice an increase if the area is regularly traveled.  If you wall off a distant mining operation and the rest of your fort is an open field the pathfinding algorithm never makes it that far into the tunnels anyway because it's typically hit a better path before then.

An alternative to walling off areas is to mark the rooms as restricted traffic.  Restricted greatly increases the cost of paths and causes the algorithm to "give up" on paths through them much quicker without evaluating the entire room: The algorithm will take ~13 normal traffic tiles per single restricted tile it steps on, and this doubles if you mark heavily traveled areas (central corridors and stairwells) as high traffic.  It's not quite the benefit of completely walling off the area because there's still some evaluation going on, but it leaves the space usable.

EDIT: The related Wiki article may shed some more light on it than I can.

Nice. I'll do some psuedo-science to see what I can come up with. Thanks dude.
Logged

Shoku

  • Bay Watcher
    • View Profile
Re: Forbidding Doors to large areas = Better FPS?
« Reply #6 on: December 10, 2010, 05:56:48 pm »

Well pathfinding basically works like this: yo take the tile the end point is at and then mark every walkable tile next to it as 1. Then you take every unmarked walkable tile next to a 1 and mark it as 2. Repeat this until you hit the start point. The the dwarf just walks to whatever tile has the lowest number over and over till they get to their goal. Traffic designations throw a little addition into this mix: you don't always mark the next tiles with 1 higher.
Normally the game actually counts by 2's. If you mark a high traffic zone it counts by 1's there so it will actually mark out those tiles and the ones touching them before it would mark a normal traffic hallway of the same length. Low traffic counts by 5s or something around there and high was 10 if I recall.

So in ten "steps" of the pathfinding bloom you would get 10 tiles down a high traffic zone, 5 through normal, 2 through low, and 1 through restricted.

By laying down restricted areas you basically say "go through ten steps everywhere else before you check this again. If there is not really any reason for them to want into what's on the other side of the restricted zone then pathfinding just won't check very deep into there and it won't have much impact on the processor load. However if they actually do want something 100 tiles deep into a restricted area then they are basically going to sweep the entire map just to figure out how to get there, and if you have a lot of dwarves doing that it will obviously slow the game down lots.

-

In my experience pathfinding hasn't really been the main slowdown in my forts. It's easy to chain up some animals and that but I have job materials stored reasonably close to their workshop so there wasn't ever a lot of long distance pathfinding. Instead I got bigger boosts to framerate from atomsmashing stone and such, though I simply couldn't ever reclaim much speed after around 40 dwarves. They both had to die and I had to get rid of the tens of thousands of items laying about.
Logged
Please get involved with my making worlds thread.

expwnent

  • Bay Watcher
    • View Profile
Re: Forbidding Doors to large areas = Better FPS?
« Reply #7 on: December 10, 2010, 06:53:34 pm »

Unfortunately, doors don't seem to affect the path-finding algorithm. The door prevents movement on the frame where the actor tries to actually move through the door tile, but the algorithm walks through them like they weren't there. Because the algorithm is what's eating up CPU cycles, you won't see any increase in FPS.

In GCS farms, they seem to be able to path through unforbidden, pet-impassible doors, but they cannot path through forbidden, pet-passible doors. This seems to imply that while animals can path through pet-impassible doors (but can't walk through them), nobody paths through a forbidden door.
Logged

darkflagrance

  • Bay Watcher
  • Carry on, carry on
    • View Profile
Re: Forbidding Doors to large areas = Better FPS?
« Reply #8 on: December 10, 2010, 08:29:31 pm »

Unfortunately, doors don't seem to affect the path-finding algorithm. The door prevents movement on the frame where the actor tries to actually move through the door tile, but the algorithm walks through them like they weren't there. Because the algorithm is what's eating up CPU cycles, you won't see any increase in FPS.

In GCS farms, they seem to be able to path through unforbidden, pet-impassible doors, but they cannot path through forbidden, pet-passible doors. This seems to imply that while animals can path through pet-impassible doors (but can't walk through them), nobody paths through a forbidden door.

Except that kobolds can somehow path through forbidden doors and unlock them.
Logged
...as if nothing really matters...
   
The Legend of Tholtig Cryptbrain: 8000 dead elves and a cyclops

Tired of going decades without goblin sieges? Try The Fortress Defense Mod

Frogwarrior

  • Bay Watcher
    • View Profile
Re: Forbidding Doors to large areas = Better FPS?
« Reply #9 on: December 10, 2010, 09:15:52 pm »

Questions:

I heard that just having doors AT ALL can reduce FPS. Is this confirmed?

Does linking doors to a lever remove them from consideration for pathing concerns? (Relatedly, can kobolds path through/pick THOSE doors?)

Also, do statues path like walls? I know they act as walls for the purposes of room definition, but I don't know about pathing. (I have this great image all of a sudden of a fort with no doors anywhere to reduce pathing time, but every room has an unbuilt statue in it to be quickly placed in case of an emergency...)
Logged
Lately, I'm proud of MAGMA LANDMINES:
http://www.bay12forums.com/smf/index.php?topic=91789.0
And been a bit smug over generating a world with an elephant monster that got 87763 sentient kills.
http://www.bay12forums.com/smf/index.php?topic=104354.0

twilightdusk

  • Bay Watcher
    • View Profile
Re: Forbidding Doors to large areas = Better FPS?
« Reply #10 on: December 10, 2010, 09:21:00 pm »

Questions:

I heard that just having doors AT ALL can reduce FPS. Is this confirmed?

When a dwarf passes through the door the game has to change the door to the "open" state, and then back to the "closed" state, every time something passes through it. This creates more things for the game to keep track of, leading to lower FPS.
Logged
A man would see that as a difficult challenge.
An elf would see that and despair.
A dwarf would see that and say, "Bring it on."