1.0.0-exp.8: Changing SimulationTickRate to anything else than 60 breaks physics simulation

In 0.51 the simulation rate could be modified by creating a ClientServerTickRate singleton and adjusting the Simulation rate.

Now if I set any value other than 60, the physics simulation seems to break (from not working at all at 72, to multiple errors for prediction errors at 30).

Is there anything else needed than creating the singleton to have a different simulation rate than the default 60?

Hi Occuros, thanks for reporting! I have managed to reproduce the issue where the rate is set above 60, but did not see the same issues when going below 60. Can you provide more info or perhaps report a bug through the editor so we can get the project to reproduce it?

1 Like

After machine restart, even with multiple tests of varying framerates, we didn’t manage to reproduce it with lower than 60 fps.

So it seems only values of above 60 provide consistent issues.

1 Like

Great, we’ve managed to find out why the bug is happening. PredictedFixedStepSimulationSystemGroup.RateManager.Timestep needs to be a multiple of the SimulationTickRate. So you can add a system that changes it, something like this:

if (TryGetSingletonEntity<ClientServerTickRate>(out var tickRateEntity))
{
    var tickRate = EntityManager.GetComponentData<ClientServerTickRate>(tickRateEntity);
    tickRate.ResolveDefaults();
    World.GetExistingSystemManaged<PredictedFixedStepSimulationSystemGroup>().RateManager.Timestep = 1f / tickRate.SimulationTickRate;
}

We will fix this for the proper 1.0 release so this should not be necessary.

1 Like