pre network, it was just the input action “use” connected to “dismount”
post network:
on button press:
-if server, do action and broadcast
-if client request action
on request:
(server only) do action and broadcast
on broadcast:
do action
This seems correct, and works, but it feels like it could be improved on, is there a way perhaps to network replicate events “behind the scenes” or a smarter way of going about things?
I do this because it helps a lot with client-side gameplay if you set yourself locally before asking the server to multicast what you’ve set. If you do not do so, you’ll have to wait for the round-trip of going to the server and back before you finally set the state on your local machine. I’ve created several gameplay mechanics that all did not do this at first, and the result was jitter, lag, teleporting issues, irreponsiveness, etc. This made a phenomenal improvement on my client-side gameplay for a multiplayer game.
A good way to test your client-side performance is to run the editor as a client with ‘net pktlag=150’ or so, to simulate a fairly laggy client connection. If you don’t do it like this, you’ll definitely feel it.