generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Does renderstep use too much?

Previous Thread :: Next Thread 
szkiller_dev is not online. szkiller_dev
Joined: 07 Oct 2016
Total Posts: 3572
05 Apr 2017 08:56 PM
Does renderstep use too much resources ?
Report Abuse
szkiller_dev is not online. szkiller_dev
Joined: 07 Oct 2016
Total Posts: 3572
05 Apr 2017 09:01 PM
BUMP
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
05 Apr 2017 09:05 PM
no it just runs every frame and waits for all events to execute before continuing
Report Abuse
szkiller_dev is not online. szkiller_dev
Joined: 07 Oct 2016
Total Posts: 3572
05 Apr 2017 09:07 PM
So it doesn't, thx!
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
05 Apr 2017 09:09 PM
ye but u should use heartbeat unless you immediately need the next frame (for stuff like camera manipulation or local transparency) because it will delay everything else that runs on the client until its done
Report Abuse
szkiller_dev is not online. szkiller_dev
Joined: 07 Oct 2016
Total Posts: 3572
05 Apr 2017 09:16 PM
Can you explain heartbeat to me?
I don't understand it that much.
Report Abuse
SevenRubyRobes is not online. SevenRubyRobes
Joined: 18 Mar 2017
Total Posts: 14
05 Apr 2017 09:17 PM
http://wiki.roblox.com/index.php?title=API:Class/RunService/Heartbeat


Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
05 Apr 2017 09:17 PM
it runs around 60 fps, similar to renderstepped except it runs at the end and does not influence the rest of the events
here is a visual example of event order

goo.gl/U17VgB
Report Abuse
szkiller_dev is not online. szkiller_dev
Joined: 07 Oct 2016
Total Posts: 3572
05 Apr 2017 09:24 PM
Wait what is the wait() resume for?

Does that mean I can pause the wait's ?
This is stupid XD
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
05 Apr 2017 09:25 PM
you cant pause waits, you would have to use your own custom sleeping function for that
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
05 Apr 2017 09:25 PM
wait() resume is when it fires wait() on the server
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
05 Apr 2017 09:26 PM
i mean its when wait() is done waiting when used on the server
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
05 Apr 2017 09:31 PM
local sleep
sleep = setmetatable( {active = true}, { __call = function( s )
local elapsed, current = 0, 0
local waitlapsed = 0
repeat
elapsed, current = wait()
if sleep.active then
waitlapsed = waitlapsed + elapsed
end
until waitlapsed >= s
return waitlapsed, current
end } )

sleep( 1 )
print( "hi" )
spawn( function()
sleep( 2 )
print( "test" )
end)
wait()
sleep.active = false
wait( 2 )
sleep.active = true
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
05 Apr 2017 09:31 PM
__call = function( _, s )
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
05 Apr 2017 09:34 PM
thats an example of a 'pausable' wait but keep in mind that active is for the entire sleeping function

to make separate ones you do

local function newSleep()
return --the setmetatable junk
end

local sleep = newSleep()
--use sleep here, makes a new version of sleep with its own 'active'
Report Abuse
szkiller_dev is not online. szkiller_dev
Joined: 07 Oct 2016
Total Posts: 3572
05 Apr 2017 09:37 PM
Jeez thanks m8

BTW renders. is the fastest of all right ?
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
05 Apr 2017 09:38 PM
you should not be using it for anything that you don't immediately need as i said
camera motion, gui movement, and local modifiers should take priority and belong there
a lot of other things should not be there such as changing character speed, animations, etc
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
05 Apr 2017 09:40 PM
heres the fixed example


local newSleep
do
local meta = {
__call = function( sleep, s )
local elapsed, current = 0, 0
local waitlapsed = 0
repeat
elapsed, current = wait()
if sleep.active then
waitlapsed = waitlapsed + elapsed
end
until waitlapsed >= s
return waitlapsed, current
end
}
newSleep = function()
return setmetatable( {active = true}, meta )
end
end

local sleep = newSleep()
local sleep2 = newSleep()
sleep( 1 )
print( "hi" )
spawn( function()
sleep( 1 ) --waits more than one second because paused
print( "test" )
end)
wait()
sleep.active = false
sleep2( 1 ) --waits 1 second
sleep.active = true
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
05 Apr 2017 09:51 PM
wow you're bad at lua
learn how closures work pls
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
05 Apr 2017 09:52 PM
### wat u mean lol if its for the repeat, i used it because i wanted to implement waiting for 0 time similar to calling wait()
Report Abuse
szkiller_dev is not online. szkiller_dev
Joined: 07 Oct 2016
Total Posts: 3572
05 Apr 2017 09:53 PM
Pls ### Its hard to type with all the roblox filtering
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
05 Apr 2017 09:53 PM
Yeah by writing the world's worst code
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
05 Apr 2017 09:54 PM
wat so bad about it, its a pausable wait xd
Report Abuse
szkiller_dev is not online. szkiller_dev
Joined: 07 Oct 2016
Total Posts: 3572
05 Apr 2017 09:59 PM
Lol I was talking about kill
Report Abuse
Wunder_Wulfe is online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
05 Apr 2017 10:00 PM
and if u talking about y i made elapsed and current in the functions scope instead of just current its because i didnt want to make it harder to assign both of them
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image