I have been recently re-designing the way how movement should work in my game project and I would like to take this opportunity to show my recent sequence diagram about it. I hope to get feedback if there is something relevant which I haven't taken into consideration. Especially if there is something which can't work in practice.
My design idea: Tile-based movement in which character can jump from position x: 0 to position x: 1 without animating between the tiles. Movement delay is 200ms which is handled at client and server-side. Client side uses prediction and corrects itself if there is something that server disagrees with. I am trying to make this over TCP so I have made movement slow enough and instead of doing interpolation (because I dont need it?) I am using presentation delay at other clients to tolerate higher ping times. (just to make sure & lost packets / re-transmissions etc.). I am also buffering inputs for 100ms at client but in reality, because of the movement delay there can't be movement inputs more frequently than every 200ms (ofc. other inputs there can be). At server, I am trying to trigger movement response from x: 0 to x: 1 asap so other clients could be notified faster, instead of waiting x: 0 -> 1 and then notify. Finally, both client and server wont send packets more frequently than every 100ms.
- 1.) Does my design make sense at all? Is there something which really worries you, like the delay when other players sees where C1 actually is?
- 2.) I wont do collisions between players, but I would like that in order to do fighting C1 and C2 must stand next to each other to be at attack range.. Can I accomplish that with this design? Do I need to move -300ms to history at server to confirm hit/ranges?
- 3.) I would like to do collisions between NPC's, and for this I am thinking that it could be possible to let NPC's decide like 3 (or enough) steps to future their every next movement which is sent to clients and collisions can work that way?
- 4.) If I display players at past, what else I would need to delay more? or if any?
Any comments would be great! thnx.