Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Poll

Does your game freeze or "hiccup" when raising or lowering a bridge or floodgate?

Yes
- 4 (30.8%)
No
- 9 (69.2%)

Total Members Voted: 13


Author Topic: Yay or Nay: Freezing while Operating Bridges/Floodgates  (Read 808 times)

Barrow

  • Bay Watcher
    • View Profile
Yay or Nay: Freezing while Operating Bridges/Floodgates
« on: November 22, 2010, 01:06:13 pm »

I've always noticed a loss of frames when toggling bridges (and, I believe, floodgates). This isn't a normal drop in FPS, such as dropping to 60 to 30, but rather a momentary freeze. I'm uncertain as to what causes this, but I do know it isn't related to destroying objects underneath them (IE not just atom smashers). I've tested it both with graphics and 2D, as well as without graphics and running STANDARD.

As to the reason for this post, I had asked about this in IRC today, and to my surprise I received responses suggesting that this isn't normal for the game. Since I've had this issue as long as I can remember, and spread across three computers, this was not something I was expecting to hear, so I figured I would ask the forums.

Have you noticed a small hang when toggling bridges (.5-1 second lag run running in the 100 FPS range, perhaps 1-3 seconds at much lower FPS)?
Logged

Dariush

  • Bay Watcher
  • I don't think I !!am!!, therefore I !!am!! not
    • View Profile
Re: Yay or Nay: Freezing while Operating Bridges/Floodgates
« Reply #1 on: November 22, 2010, 01:14:44 pm »

It all depends on pathfinding. If you close off a way to a small chamber nobody was ever using, you won't notice the difference. If you put it in the middle of your fort, expect waiting. It's simple, really.

Barrow

  • Bay Watcher
    • View Profile
Re: Yay or Nay: Freezing while Operating Bridges/Floodgates
« Reply #2 on: November 22, 2010, 01:20:06 pm »

Sadly, no, not that simple. The most annoying occurrence of this is in fluid repeaters I've used; I lock the door to the room, or even wall it off completely (aside from the submerged fortification that feeds it) and still have the same lag spikes as a bridge would trigger in a high-traffic area.
Logged

NecroRebel

  • Bay Watcher
    • View Profile
Re: Yay or Nay: Freezing while Operating Bridges/Floodgates
« Reply #3 on: November 22, 2010, 01:25:21 pm »

Are you watching the bridge, or the creatures?

You say that you get a .5-1 second lag at 100 FPS. I take it you mean that to say that for .5-1 second at 100 FPS after the trigger occurs, the bridge remains up or down? If so, I'd suggest you watch some moving creatures instead of the bridge. If the creatures hang for that time, something is wrong. If the bridge hangs for that time, though, that's exactly what should happen.

You see, bridges don't raise, lower, or retract instantly when a signal is sent to them like doors or hatches do. They have a built-in 100-step delay, which, incidentally, takes roughly .5-1 seconds at 100 FPS. It's understandable that this built-in, intended delay in the bridge's operation is what you're seeing and mistaking as a lag-spike, while your mistaken explanation for it is what's causing people to think you're seeing something unusual.

If you already had taken this into account, of course, something is different, but it seems a plausible explanation to me, as I have never noticed significant lag-spikes when bridges operate save when lots of stuff was getting smashed.
Logged
A Better Magma Pump Stack: For all your high-FPS surface-level magma installation needs!

Hyndis

  • Bay Watcher
    • View Profile
Re: Yay or Nay: Freezing while Operating Bridges/Floodgates
« Reply #4 on: November 22, 2010, 01:30:23 pm »

Yes, it has to recalculate pathing.

One thing I do instead is to put the bridge over a narrow ledge. For example, have a 30x5 section channeled out, with a deep pit below it. Construct 30x1 of floors in the middle. Build 5 tile wide bridges over the entire thing and link them all to levers.

Pathing is never broken so there aren't any FPS issues. However anything trying to walk through that corridor will be flung around by the bridges and plummet into the pit to their doom.
Logged

Barrow

  • Bay Watcher
    • View Profile
Re: Yay or Nay: Freezing while Operating Bridges/Floodgates
« Reply #5 on: November 22, 2010, 01:37:27 pm »

NecroRebel: Thank you for the response, but I mean an actual freeze. At the point of raising or lowering (no the point at which it is triggered), there is an actual freeze in the game (all calculations halted, including movement/water flow/etc).

Hyndis: Cool, hadn't considered that for my pit traps, will need to give that a shot. However, I don't think that will fully resolve the issue. I made a test embark just to experiment before making this post, and having a repeating lever linked to a 1x1 or 3x3 bridge in the middle of an empty field (no ditch underneath it, no pathing dwarves as all but the lever-puller are idle inside) still causes the freezing.

Is the issue still pathing related? I assume so, but I don't understand why if nothing is calculating paths in that area, nor do I understand how the game can remain playable for people if this is normal behavior in a sealed fluid repeater.

I'm not trying to complain here, I'm just confused as to what causes this, and how isolated my issue is.
Logged

Hyndis

  • Bay Watcher
    • View Profile
Re: Yay or Nay: Freezing while Operating Bridges/Floodgates
« Reply #6 on: November 22, 2010, 01:57:13 pm »

I think it has to do with needing to recalculate pathing because the terrain has changed. You see the same sort of pause if you are in a cold environment when lakes or rivers thaw.
Logged

Ten_Tacles

  • Bay Watcher
    • View Profile
Re: Yay or Nay: Freezing while Operating Bridges/Floodgates
« Reply #7 on: November 22, 2010, 02:05:06 pm »

I think it has to do with needing to recalculate pathing because the terrain has changed. You see the same sort of pause if you are in a cold environment when lakes or rivers thaw.
That spike isn't pathing related.
It must change the water into ice blocks, and then recreate the water physics when thawing.

But I really don't know what is causing your bridge lag.
I don't really build bridges that often.
Logged

Shoku

  • Bay Watcher
    • View Profile
Re: Yay or Nay: Freezing while Operating Bridges/Floodgates
« Reply #8 on: November 22, 2010, 02:17:54 pm »

There are two kinds of pathing calculations. One is the typ you're familiar with where creatures go checking every space around them until they find a way to their goal and there is the pathing where the game decides what the actual chunks of space are. Obviously you wouldn't want all of the creatures on the surface to go trying to path down to cavern 2 when there's no connection- they would have to check every single space on the surface and then realize "whoops, no path" over and over as they chose new spaces that weren't really connected.

So whenever you place walls, stairs, ramps, of raise a drawbridge the game has to recheck to make sure that didn't cut zone connected area into two disconnected ones or vice versa. Now normally as you carve out a fort this doesn't happen too frequently and doesn't cause slowdowns quite like this. It's really only when you're carving ramps into a huge area or repeatedly toggling a bridge. Basically if you're unlucky enough to run into this but you still want to atomsmash water try to link more bridges to the same lever. Having slowdown when they're off in some corner or even cut off entirely means that it's obviously trying to compute some large area- doubling the number of drawbridges doesn't seem like it would make the situation worse when that's happening.

-

Actually there's not that much overhead with sticking 7/7 water on some tile. The workload there comes from how there are suddenly all of these new floors that can be walked on, or those vanishing, or in shallow water there suddenly being walls AND one other very intense set of calculations: temperature. The ice thaws at at particular temperature changes and the game has got to actually work out how far the temperature carries into adjacent tiles. Obviously your map contains some magma so there are going to be spots that don't have that temperature change and then the game has to judge what the tiles between them are going to be and naturally this maps working out if the ice should melt or not pretty involved.
Logged
Please get involved with my making worlds thread.

Barrow

  • Bay Watcher
    • View Profile
Re: Yay or Nay: Freezing while Operating Bridges/Floodgates
« Reply #9 on: November 22, 2010, 02:32:30 pm »

Exactly the sort of response I was hoping for, Shoku. Thank you very much for sharing that information (and thank you to everyone else who took the time to respond, as well).
Logged

Hyndis

  • Bay Watcher
    • View Profile
Re: Yay or Nay: Freezing while Operating Bridges/Floodgates
« Reply #10 on: November 22, 2010, 04:31:56 pm »

On a related note, please do try the bridge trap I outlined. Its murderously effective!  :D

Pathing is never interrupted, goblins will always have a clear path into your fortress. They will just be flung off of the ledge by the bridges into the pit below. You can drop them into water, magma, or onto solid granite 20 levels below. Link each bridge up to 2 levels. Put them both on repeat. The reason for there to be two levers all linked to the same bridges is to avoid interruption if a dwarf needs to suddenly booze in the middle of a siege. The odds for both dwarves to be boozing is much lower, and there is a much smaller gap if you a redundant lever puller.

If you want to move lots of dwarves through there just extend the bridges and leave them extended. It will handle huge amounts of traffic with no slowdown. Alternatively, keep the bridges withdrawn and your marksdwarves will have plenty of time for target practice as the goblins move through the 1 tile wide ledge. Or just toss them into the pit with the bridges.
Logged