2
\$\begingroup\$

I am currently working on a fighting game (with 3d graphics, gameplay like a 2d fighter) and encountered a pretty big hurdle I currently don't know how to deal with. For fighting games, input consistency is an absolute must, for example reading and processing the user input 60 times per second with fixed intervals between the input processing steps.

I started my game with Unity and right now, Unity's input is tied to the Update() function which means that during one Update() the input is consistent. the problem is that this would mean that input is framerate dependent and it would be pretty bad if the game has lag spikes or some machines cannot run the game at full 60 fps. I read that Unity is working on a new input system that allows for framerate independent input, but it is uncertain when the input system is finished or when it will be implemented in a public build:

https://forum.unity.com/threads/welcome-new-input-system-resources-and-info-please-read.397153/

I searched a little in the Unreal Engine 4 forums but couldn't find an answer to my specific question whether the engine does process the input really frame rate independent.

The goal is the following: Have the game logic separate from the main thread which handles rendering in another thread. Read the user input at fixed time steps, for example 16,6 milliseconds, provide this input information to the game logic thread, calculate the game logic for the input (which of course must take less long than 16,6 milliseconds) and only use the main thread for rendering the world state. For example by taking the world state data from the logic thread from the previous frame and the current frame and interpolate the data, then render the visuals with the provided interpolation.

My question is:

Is my approach the correct one when the goal is to have framerate independent input for games?

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.