doggy00
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 3571 |
|
|
| 07 Jul 2016 04:45 AM |
title
--what should be siggy be? |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 04:49 AM |
| Idk. Try something like wait(0.000000000000000000000000000000000001). |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 04:53 AM |
game:GetService"RunService".RenderStepped:wait() ---wait's 1/60th of a second i believe
mom wheres the spaghetti | R$19,427 |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 05:01 AM |
-- LocalScript: game:GetService("RunService").RenderStepped:wait() -- 60 fps
-- Script: game:GetService("RunService").HeartBeat:connect(function() -- User's fps.
end)
What doesn't make sense to me though is why RenderStepped only works in LocalScripts and runs in 60 fps, whereas HeartBeat runs in a script and capture's the user's fps. Oh well.
-=[ RAP: 347,257 || DurstAuric; the narb of ROBLOX ]=- |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 05:07 AM |
| What is the shortest time possible with something like wait(0.00000000000001)? |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 05:07 AM |
Just a little correction to above. HeartBeat is basically fired every time the game updates. For example let's say the game is running very smoothly (as stated on the wiki) at 1/60th of a second and fires successfully each time you have a 60FPS game not rendering.
Just remember that, the higher the divisor of the step, the faster. 1/1 = 1 but 1/2 = 0.5 so of course 1/60 is faster than 1/30.
|
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 05:08 AM |
| Also, never do things such as wait(0.00000000000000001) as it literally has no use and regardless of how small you make the number they'll be a roughly same timestep which means you're not doing much. |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 05:09 AM |
adding a negative number into wait() will make you time travel, ex: wait(-10)
mom wheres the spaghetti | R$19,427 |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Jul 2016 05:11 AM |
Have you ever time traveled by doing that? I didn't think so. Putting that at the top of your script instead makes it read from the bottom up.
|
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 05:11 AM |
| What would seriously happen if you say wait(-1)? Game would break or not? |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 05:12 AM |
nothing, sadly
mom wheres the spaghetti | R$19,427 |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 05:12 AM |
| Nothing, as I said there's a standard value. If you enter an invalid value or you enter something like 0.000000000000000001, it won't make a difference. |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 05:23 AM |
Oh, but there's coroutine.yield() Test how long that waits for. :) IIRC, it's ~1/60
|
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 05:38 AM |
| Yep, coroutine.yield() is 1/60th and is more stable than all the above! |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 07 Jul 2016 07:15 AM |
The real question is:
Why do you need to wait for less time? |
|
|
| Report Abuse |
|
|
doggy00
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 3571 |
|
|
| 07 Jul 2016 08:57 AM |
Because ROBLOX studio gets different test results than ROBLOX player, and I fixed it by adding a wait() somewhere but it can still be kinda buggy in a way.
--what should be siggy be? |
|
|
| Report Abuse |
|
|
0Dan
|
  |
| Joined: 22 Oct 2009 |
| Total Posts: 2552 |
|
|
| 07 Jul 2016 08:59 AM |
"Idk. Try something like wait(0.000000000000000000000000000000000001)." That's useless, it'll just automatically be rounded back to the normal wait() time > print(wait(0.000000000000000000000000000000000001)) 0.038490141465239 42.51938375691 > print(wait()) 0.032619116495063 50.161808152217
𝐃𝐚𝐧𝐢𝐞𝐥 |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 09:24 AM |
I'm not convinced you guys know what you're talking about.
Please note that things like RenderStepped and Heartbeat are throttled. That means that they do not guarantee a consistent update rate. In other words, it is not guaranteed to stay at 60FPS. For instance, it might move between 40FPS and 60FPS every few seconds in a really performance-intensive game.
There is really no reason to have code running at a faster rate than the rendering speed. Here's the main gist of this all:
If you are rendering objects (moving objects, moving the camera, etc.), then you should do that with RenderStepped. If you are updating game logic, you should do that with Heartbeat. If you need anything faster, you should just use a loop to do multiple iterations within an update frame. |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 09:26 AM |
| Also: When you use the "wait" function, what happens is that your code yields and is thrown into a queue to be resumed essentially. That queue is only flushed based on the speed of the task scheduler, which I believe runs alongside Stepped or Heartbeat. That means that throwing a really small number into a 'wait' function is pointless. |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2016 09:30 AM |
wait(math.min())?
"When you're gonna do something stupid then don't do it it's simple as 123" - TheAddictPlayer | RIP Tickets you'll be always missed ;-; 2007-2016 | Errare humanum est, perseverare diabolicum | Current RAP: R$210 |
|
|
| Report Abuse |
|
|
Skellobit
|
  |
| Joined: 13 Apr 2016 |
| Total Posts: 12758 |
|
|
| 07 Jul 2016 09:30 AM |
^ Do you even know what math.min is/how it works?
Formerly ToxicDominator - add 17,509 posts | :(){:|:&};: |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Jul 2016 10:14 AM |
coroutine.yield() is the shortest wait
#code R+ | local RAP = "R$762,351"; local robux = "R$72,046"; life = nil; |
|
|
| Report Abuse |
|
|
| |
|