ID:265961
 
I've been playing with world.tick_lag to get more appealing framerates. Since it allows more things to happen in less time I imagine this can be detrimental to games played over a network. I wasn't able to find any discussions about it, but has anyone experimented with world.tick_lag settings to find what values start to make things worse for clients?

Based on how this is handled internally, I'm not sure how it would affect performance. My main reason for changing world.tick_lag is to allow for smoother animations (animated icons and screen scrolling), but there's really nothing more happening (players aren't moving or attacking at sub-0.1 second rates). For example: is it worse to have 100 players on the same screen each moving once every 5 ticks (with tick_lag set to 1) or have 100 players moving every 10 ticks with tick_lag set to 0.5? In theory the players are all moving every 0.5 seconds, but does the lower tick_lag setting have some other consequence?
I'm not sure how much you have actually played around with tick lag, but in my experience, setting world.tick_lag to , say, 0.1 would still require you to sleep 0.1 to acheive the desired effect.

From a logical point of view it still appears that 1 tick = 1/10th of a second regardless of what tick lag is set to; setting tick_lag to a lower number lets you sleep less time for faster updates and more procedures per second.

I would be interested in hearing from someone with more intimate knowledge of BYOND on how setting tick lag to a lower number yet still calling sleep(1) is supposed to effect actual performance.
world.tick_lag is pretty amazing.

I use it in Pokemon Challenger where you can see it live in action over the network. If you join, start a game, and crank the speed up (buttons at the top).

The game has three speeds:

Slow:
tick_lag = 1

Normal:
tick_lag = 0.75

Fast:
tick_lag = 0.50

I also use a sleep_modifier variable, which every sleep statement uses, instead of sleep(5) it is sleep(5 * sleep_modifier) <small>(I actually use a #define)</small>.

The game handles extremely well over even slow networks at 0.50, which is 20 FPS. I would like to experiment with 0.40, which is 25 FPS, or basically past the point of "this is as smooth as it needs to be" but I think it would work just fine.

0.10 on the other hand will blow up your game, and it will run horribly over the network, as it'll be sending tons of packets pre second to every player online - it ends up looking more like tick_lag = 3.00 on the end machine.

And to clarify what Jotdaniel mentioned, sleep(1) always sleep for 1/10th of a second when tick_lag is 1, 0.5, 0.1, or any other value <1. If you want to sleep for less time, you have to do sleep(0.5) or what have you. This didn't make sense at first (seems like sleep should sleep for the tick_lag amount), but what can you do? :P


~Polatrite~
In response to Polatrite
Polatrite wrote:
world.tick_lag is pretty amazing.

I use it in Pokemon Challenger where you can see it live in action over the network. If you join, start a game, and crank the speed up (buttons at the top).

Ok, thanks. I'll check it out.

The game handles extremely well over even slow networks at 0.50, which is 20 FPS. I would like to experiment with 0.40, which is 25 FPS, or basically past the point of "this is as smooth as it needs to be" but I think it would work just fine.

That's good to know. I've been using a tick_lag of 0.5.

0.10 on the other hand will blow up your game, and it will run horribly over the network, as it'll be sending tons of packets pre second to every player online - it ends up looking more like tick_lag = 3.00 on the end machine.

I wasn't planning on drawing animations intended to be viewed at 100 fps, so I'm okay with that =)

I'm still interested in some of the internals to get a better idea of how this would scale with different types of games and levels of activity: is it the tick_lag or the level of activity that makes things slow for the clients? For instance, would a slow-paced board game with five players be more playable with a tick_lag of 0.1 than an action game with 20 players and a tick_lag of 0.4?

And to clarify what Jotdaniel mentioned, sleep(1) always sleep for 1/10th of a second when tick_lag is 1, 0.5, 0.1, or any other value <1. If you want to sleep for less time, you have to do sleep(0.5) or what have you. This didn't make sense at first (seems like sleep should sleep for the tick_lag amount), but what can you do? :P

I was thrown off by this too but the reference does state that sleep's delay is specified in tenths of a second, not in ticks. I'm not sure why but at least it's documented properly.
In response to Polatrite
Thank you for clarifying what I said. I confused myself a little bit with that post. :S