Where I'm at
2D MMO Unity game with client/server networking architecture (server is also a headless Unity instance) containing only basic movement. My early/simple approach has worked thus far:
- Client and server operating on fixed tick rate
- Client sends movement input to the server and predicts movement locally
- Predictions stored as [input → amount moved]
- Server receives/buffers inputs and processes all on next tick
- Server uses snapshot approach where it sends entire game state to each client with the client specific last processed input
- Client receives and performs reconciliation
- Throws away any predictions before last processed input
- ‘Replays’ remaining predictions after given server state and checks if the same, if not adjust to server position
Note: No timestamps or ticks are sent from the client yet. Just an input number and the input itself.
What I'm trying to do next (including the problem)
A ‘dash’ skill that lasts several frames from a single input. i.e.
- Client taps dash skill and begins ‘dashing’ over the next 10 seconds/ x number of ticks
- On every tick until the skill is complete the client stores a prediction
- Client sends dash skill input to the server
- Server receives dash input sometime later and also begins dashing for next 10 seconds
- Game snapshots being sent out every tick with the current player position
- Last input received has not changed though since it stemmed from a single ‘dash’ input
- Client receives updates, but does not know which dash related predictions to throw out
What I've Tried
OK, I've thought of some ways I could solve this if input is locked during the skill
- Send some sort of ‘dash progress’ info about how much of the dash is complete from the server to client
But, I've lost determinism if another input occurs. i.e.
- I jump in the middle of the dash which occurred on tick x of the dash
- Server receives jump input, but if the server and client and even a little out of sync in terms of processing the fixed tick rate, the jump may take place at different point during the dash which would produce a different outcome.
I could also:
- Include a timestamp in the packet about client dash start time then start the skill on the server at the point where the server believes the client is. But, this feels wrong since the client will snap to a spot on the server if we have a lot of latency. The server will always have a brief ‘catch-up’ since it receives client input late. Is this normal?
- Syncing server/client tick rates using RTT/2 (the ‘Overwatch’ model I believe). I then store locally the predicted time the dash will be received by the server (client always a but in future). But, this seems overkill for the game I'm trying to create.
What I'm Looking For
Help with resources about how to solve such a problem (or with my problem specifically if I managed to explain clearly enough :P. I'm making a simple Top-Down 2D MMO w/ PVE Only so I don't need advanced rollback for player fairness or anything (yet). I may be overthinking the situation, but can't seem to find any resources about this type of ‘over-time’ prediction.