Replies: 1 comment
-
I think you could manually clear the input events in a system that runs at the end of the frame? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm currently trying to test inputs at low tick rate systems and as one might assume a lot of my inputs are dropping. I believe this is because the KeyboardInput events themselves are being consumed by keyboard_input_system introduced by the InputPlugin to fill the Input resource. To my understanding the default cleanup strategy is to clear events every frame, but with double buffering, so that events from the previous frame update stay available. This makes it to where large tick periods in fixed time systems lead to dropped inputs as they are cleared before they can be used. So the overall question is how can I remove or override keyboard_input_system to where I can manage the keyboard events separately. I understand that at a large enough frame rate or large enough tick period this would cause a great deal of memory to be consumed but I will focus on solutions to that later.
I understand that I could circumvent this issue by creating another system which follows the systems refresh rate for inputs and then just copy the dominant inputs over to the fixed tick rate, but I feel like that ends up being wasteful as we have the inputs I just want to handle them manually. The other solution I could think of was rewrite a similar event which works how I would like as the underlying conversion logic has already been implemented so I don't think it would be hard to incorperate. The last solution is the one I'm leaning toward but I want to make certain there isn't a major problem in what I want that I'm missing or an easier way before I focus on it.
To test what I'm talking about I have slightly modified the fixed time step example given by bevy (Original Here) and written this script based off it:
This code shows the trailing consistency of the fixed time step the current time step counting upward by 1 and allows for the reading of KeyboardInput Events. This demonstrates the consistency of input reading from this system based on the FIXED_TIMESTEP provided. At a tick rate of 0.5 the overwhelming majority of your inputs will drop whereas the closer you get to the frame rate of the blank application that appears the more inputs will be read up until you are 1:1.
Beta Was this translation helpful? Give feedback.
All reactions