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: RenderStepped With Expensive Function

Previous Thread :: Next Thread 
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
16 Sep 2015 06:12 PM
So I am running a RenderStpped function like this:

function()
...
--print(type(CUBE_COLLISION)) >function
--print(#BASE.Bin:GetChildren()) >1
print't'
ocal z=(BASE.Bin.Part) print(CUBE_COLLISION(z.CFrame,z.Size,c+sub,MODEL_SIZE,true))
print'q'
...
Where CUBE_COLLISION is a pretty expensive function, but the problem is that after using the expensive function, the loop restarts and does not return a value to the function.

The function is required from a module (specifically AxisAngle's box collision module: pastebin/xt0f1PpK

Why does it not return any value not even an error?
Is it because it takes too long to calculate before the next frame?
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
16 Sep 2015 06:20 PM
bumpo
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
16 Sep 2015 06:23 PM
Whenever I'm working with renderstepped, I do something like:


local last = tick();
while renderSteppedEvent:wait() do
local dt = tick() - last; -- only if 'lost time' is important
last = tick()
-- do stuff
end
Report Abuse
Scripth is not online. Scripth
Joined: 23 Jun 2013
Total Posts: 1724
16 Sep 2015 06:25 PM
no need to do that anymore cntkillme
they added a very very nice return value from the RenderStepped event
game:service('RunService').RenderStepped:connect(function(step)
end)
step represents the difference of time between this step and the last
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
16 Sep 2015 06:27 PM
But the thing is, if your code takes more than ~60th of a second then won't your function be called yet again in a new thread? Mine prevents that (basically a debounce without the overhead)
Report Abuse
Scripth is not online. Scripth
Joined: 23 Jun 2013
Total Posts: 1724
16 Sep 2015 06:29 PM
true, depends on how he's going to use it though
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
16 Sep 2015 06:48 PM
Yeah that's what I thought was happening; I was using scripth's method before hand and because of the expense there was not enough time to yield anything... :/
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