My game consists of a lot of moving parts, both literal and figurative. I am using something I’m calling a Render Pool (Though this may go by a different name) to ensure that these are all recieving some kind of update per-frame. It is laid out as such;
From here I then call a BindToRenderStep with something such as;
RS:BindToRenderStep("Last", Enum.RenderPriority.Camera.Value, function(dt)
for pos, obj in pairs(RenderSystem.RenderPool.Last) do
obj:Update(dt)
end
end)
Different objects have different update actions, and some are more costly than other, meaning I do a quick calculation on the object’s-side to see if it is allowed to update on that frame.
Is there a better method to use than this for large scale update() calling?
That’s the method I use for these situations. Don’t know of a better one, and this works well and scales decently enough.
I do this differently. I do the calculation on the render loop side, so there’s no function overhead on objects that fail their conditions. I only call :Update() on objects when they’ll actually be updating.
Ah, perhaps I should rephrase slightly.
Each object does update, however their more costly calculations get locked off until there has been an adequate space between their last check. As each object is added incrementally, this breaks them up so that they don’t all try and calculate on the same frame.
You update the simple calculations at 60FPS (or whatever max frame rate you’re getting) and do the costly work at a lower FPS, with each object staggered so they update at different frames.
Yeah, and because everything is scheduled in an easily predictable fashion;
I know the Character is going to be updated before the Camera but also that Character has a costly raycast,
there shouldn’t be any stuttering mid-frame.