

The UI component of the physics step – this, for example, scans mechanical constructs for updates – does need to be repeated in each physics step, but it’s such a small (i.e., 1-2%) part of the physics update that it only introduces a small CPU load. Since we’ve divided the same workload into two pieces, this introduces no performance burden. We’ve broken what was originally an eight-iteration forward-dynamics update of each object’s position and velocity (this is known as the “world step”) into two smaller, but no less accurate four-iteration updates. The performance effect of this change is minimal. The difference is that, for each physics step, there is one render step – and, ultimately, both physics and rendering are updating at a synchronized 60 FPS. Now, here’s an illustration of how ROBLOX will manage each thread in the near future. Players will see some choppiness in the motion of physically simulated objects (e.g., characters, projectiles, and falling bricks, to name a few). That means physics is updating at 30 FPS, while rendering is updating at 60 FPS. This is a linear perspective.Īs you can see, the physics step happens once for every two render steps. Let’s step back and take a look at how ROBLOX currently manages each job. This is what we’ve done to increase ROBLOX’s framerate to 60: optimize the frequency and distribution of physics updates, and ultimately synchronize the physics frequency with the render frequency. Instead, we have to optimize the frequency at which each job provides new data for the best possible experience. However, in an online game as complex and variable as ROBLOX, that’s a dream.

In an ideal world, each of the primary jobs would be updated at exactly the same frequency (let’s say 120Hz), your computer and network would be able to manage the load, and the framerate would stay locked at 120. We are working on rolling out an optimization to those update frequencies – particularly in relation to the physics and rendering jobs – to boost ROBLOX’s max framerate to 60 at almost no cost to performance. The primary jobs are physics, rendering, networking and Lua scripts, and each job is updated at a frequency that balances performance and fidelity. SteerServo2.TargetAngle = steerAngle * steer.The ROBLOX game engine interweaves multiple jobs to create an accurate on-screen representation of your multiplayer, physically simulated games. SteerServo1.TargetAngle = steerAngle * steer.Value SetMotorVelocity(throttle.Value * maxSpeed)ĬhangeSteer.Event:Connect( function(desiredSteer) Throttle.Value = throttle.Value + increment Local function setMotorVelocity(velocity)ĬhangeThrottle.Event:Connect( function(increment) Wheel.CustomPhysicalProperties = CustomPhysics Local CustomPhysics = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight) Local function changeWheelsPhysics(density, friction, elasticity, frictionWeight, elasticityWeight)įor _, wheel in pairs(car.Wheels:GetChildren()) do Local Players = game:GetService("Players") Heres the script that recieves the fires: - Services So if i set throttle to 1 the car will speed up smoothly? If RaycastResult and 0.001 and turning = false thenĪll of the work is already done for you in the physics engine! It’s as simple as setting reasonable values for the constraints, and then setting values in a Script. Local RaycastResult = game.Workspace:Raycast(

RaycastParams.FilterDescendantsInstances = Local raycastParams = RaycastParams.new() Hello, I’ve been working on a NPC car and when things were going well I noticed that after 30 - 60 seconds in game the fps starts to decrease, I know that this happens because every frame I start some while loops, but they break after some conditions gets false, I don’t see why broken loops would cause lag.įunction that runs the loops: RunService.Heartbeat:Connect( function()
