N*sync

I’ve managed to get some basic networking going, and have started on the logic around movement.
But with every step forward I’m seeing more and more steps appear in front of me… Making a multiplayer game is no small feat!

I want to have point and click movement, rather than incremental movement via input, but this is pretty complicated to work out. At least I’m finding it to be.
Every time I think I’ve worked out a solution, I realise there’s a case where it won’t work. For example, just now I’ve made it so the server is updating the player’s position on an interval according to their speed. The client is doing the same, so they should both end up in the same place. However, if the player clicks somewhere else during this move, then the previous move needs to stop, but I need some way to stop the loop on the server… I guess I could add a variable to the user that’s checked on each loop, and breaks out if it’s set, something like CanMove”. But I’d need to save that to the DB, make sure the running loop sees it and stops, then change it again to allow the next move.
There must be a better way…

I’ll sleep on it and see what comes to mind.


Date
November 7, 2020