Jump to content

[296074] Game update loop does not utilise time between ticks

  • Branch: Preview Branch Version: Windows Pending

This seems to be a long-standing issue and is one deeply rooted in the game's update logic.

As it currently stands, ONI tries to do 5 update ticks per second, with the rate of these ticks varying based on the chosen simulation speed. The problem lies in the fact it tries to cram this entire update into a single render sub-tick (locked at 60fps, 12 sub-ticks per tick), causing visible stutter if an update takes considerably longer than one sub-tick (even though actual ticks are 12 sub-ticks apart). This leaves 11 sub-ticks where no actual logic is performed (except for smoothing out the changes).

Poking around in decompiled code, I've noticed the functions "SimEveryTick(dt)" and "StepTheSim(dt)", with the latter havingĀ a bunch of sub-simulations within it (and also likely being where the CPU hit is). My thought on this is that these sub-simulations could be spread across sub-ticks, making better use of available CPU time that is otherwise not used at all, instead of trying to do it all at once.

The issue is particularly apparent on slower sim speeds, as the time spent not doing anything will be larger. You can also tell this is happening by the fact the stutter persists on slower sim speeds despite lower CPU usage.

Steps to Reproduce

User Feedback

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...