There is a difference between Action and Axis inputs. Between input value and input events.
What is Important to me is axis type of inputs such as MouseX, MouseY, JoyStickX and Y. All of those are axis inputs meaning having values of (-1.0 to +1.0). My major focus is on those axis values, and the general input handling system as a whole as well.
What is a frame? what is a tick?
The tick is a function on a UObject that is called in runtime, once every frame. The frame is the period where all tickable UObjects get ticked (called) within the game loop. A tick can happen at the beginning, middle, of end of a frame depending on some ordering rules and options.
So when we talk about the input tick here, we are actually talking about a little function being called on the player controller which will handle calculations of inputs that are being collected since this same tick function was last called in the previous frame. There’s some nuances for each type of input, and multiple input sources pouring into one game-perceived input and whatnot that I have yet to fully know, but the concept is what I said specifically for float-valued axis inputs that are my concern ( and not buttons or input events).
So in terms of order of events, everything runs in well ordered lockstep fashion as you just noticed. This is quite clear and is a fantastic job by unreal game loop already.
Now before going back to our game frame, let us just have a look at the input controller itself. This is an input device that is being polled periodically by the operating system, let’s say at 120 times per second. The polling reading will then be stored in the RAM (or equivalently accessible OS source) for other applications to pick. The game is the application that will pick those readings.
Now say both the game and the device polling were at 120hz, and suppose that both are running with no fluctuations at all, which is far from reality, but let’s suppose that is the case. In this case the frame length is actually 8.33 milliseconds for both loops (the game loop and the polling loop). There is by definition a “delay” of input pick up by the game loop ranging from few nanoseconds to 8.32 milliseconds depending on the difference two loops starting points. There is no way around that. We have a delay, worse still, we don’t know how much exactly, and we don’t guarantee its steadiness either. Now is this delay actually noticeable by players? No, not at all. But can we utilize this delay for our advantage as game makers, yup and that’s my job here.
My concept is not only to accept the existence of this delay, but also to increase it by few milliseconds (say it will be 10 or 11 milliseconds) to include barely two pollings.
What do I gain, three main things:
- The delay will be virtually fixed with no fluctuations[stability]
- The delay will let me have two polling readings prior to applying input to game logic[valuable information].
- Game logic will run with precisely similar mathematical results (collision/velocities etc) at low fps just as at a high fps, so long the input picking thread is working properly on the two versions of the game.[this is just huge benefit]
The last point is related to the fact that the game has its own physics engine that already runs the same regardless of frame rate, and DeltaTime fluctuations.
All in all, this manufactured delay will be unnoticeable by the player, but measurable by the machine and extremely useful in our input handling arithmetics, animations logic, physics, and a bunch of other concerns.
I have started already studying UE4 input handling, it is really a cool system, but it will take a long time for me to fully analyze it and I just wanted to see if somebody here could help me out.
My hope it that I can find the a way through UE4 to deal with input without needing to go directly to the operating system, or any other low level input handling because I don’t want to lose UE4 systems of dealing with a ton of input sources simultaneously, I need either to hijack that system as is, or replicated. I really don’t want to end up making a plugin that might give me headache after game launch. I am a solo dev and I need guaranteed solutions,