Skip to content

Handling player input from _input(event) vs NetworkTime.before_tick_loop.connect(_gather) #215

Closed Answered by elementbound
cody3b asked this question in Q&A
Discussion options

You must be logged in to vote

The RollbackSynchronizer node collects and submits input after every network tick. So, as long as your variables are set to the proper value at that point in time, you should be good.

Relying on input events for this is not the best idea, since they are not tied to the network loop at all. What I've found to work well is input buffering - i.e. remember what the player has pressed, then reset your variables before the next tick. This way, you can use the input events to set your variables, but if the event is not fired at the exact right time, you still won't lose that input.


Here's a very simplified version of what I'm currently using in a different game:

extends BaseNetInput
class_name P…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@cody3b
Comment options

Answer selected by cody3b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants