Hi,
I'm building a 2p fighting game, and I'm trying to get a very basic netcode system up and running to allow 1v1 online play. I'm totally new to the entire netcode thing, but I managed to setup lacewing (blue) client and do some basic data input data exchange between two peers :
catching the player's control inputs
sending them over to the other peer
get data translated back into controller's input, effectively getting one char to move on the other side.
My 1st question is: How Can I ensure that both player are synced based on an in-game timer?
My idea was that the channel master would send over its timer, so that the other player would be in sync with him.. but if I, as the channel master, send my packet "frame_cout = 0" a t=0, there is a lag of,say, 33 ms when it is received so player two will receive "frame = 0" at t+2, being effectively 2 frames late. Since I don't know how to measure latency, I don't see how I can sync player 2 with the timer sent by player 1 (the channel master).
am I looking at this problem the wrong way...?
My 2nd question is: Is there an easy way to ensure packet receiving order?
I'm assuming that once I solve problem 1, I can timestamp the packets myself when sending them over, then put them into a list or array and sort them, but maybe there's an easier way...?
FYI, I watched this very interesting talk at Please login to see this link., but i'm quite a few steps before thinking about such things for the moment. My concern right now is