ID:137598
 
Lately I've been trying to figure out how to make my own version of the sleep proc to work in milliseconds instead of 1/10 of a second, but to no avail. You see, I'm trying to make a street racing game where the smallest unit of time counts majorly, and using 1/10 of a second has big limits. For example, a car with good acceleration takes off and hits top speed fast, but then because of my limits, the one that tops out better flys by in a blur. How about a little help here? Make a proc (or at least a way) to "sleep" for a smaller unit of time eh? Thanks a bunch!
As far as I know, there is no way to do such a thing*. The BYOND internal "clock" runs in ticks. I can't come up with a good analogy for this except for clocking crystals used in processors and electronics... Think of it this way, BYOND starts a loop and every tick it performs all of the code that is given to it to perform that tick. Next tick it does the same thing. Sleep and spawn commands just tell the loop when to perform certain code. Kind of. Thats not a perfect explanation, and I could be wrong.. I don't think I am, though. Perhaps Dantom could verify.

*You could simulate it by performing commands that slow down BYOND, like a really big loop. However, that does require you to be sucking down most of BYOND's resources, and it will depend on the speed of the machine it runs on, along what else the machine is doing, as to how much of a loop to do. In short, that would be a really crappy method.

-AbyssDragon
In response to AbyssDragon
Really, I think that a hundreth of a second wouldn't be very visible any way... how about slowing down general racing speed by half and then going from there?
You could probably approximate the effect you want by pre-calculating a list of delays for each speed and cycling through it as needed. To players, the overall effect will seem fairly smooth.

6 delay (fastest) = (1, 1, 1, 1, 1, 1)

10 delay = (2, 2, 1, 2, 2, 1)

12 delay = (2, 2, 2, 2, 2, 2)

21 delay = (3, 4, 3, 4, 3, 4)

24 delay = (4, 4, 4, 4, 4, 4)

29 delay = (5, 5, 5, 5, 5, 4)
In response to AbyssDragon
AbyssDragon wrote:
As far as I know, there is no way to do such a thing.

You can do it with world.tick_lag.

However it's not likely to work well if the game is being served at all.