D
Drepple
Guest
Hello,
I am working on a multiplayer game in GameMaker. The concept is close to a fighting game and so it's very important both players see the same thing happening at the exact same time. It takes a while for a buffer to be sent to the other player though. A lot of fighting games fix this by having an input delay, where a move is performed say, 2 frames after the input. At the input a buffer is sent to the other player saying the input for a move was given and it will be executed two frames after the input. That player's game will then calculate how long before it has to display the move as well, by subtracting how long ago the message was sent from those two frames.
The problem is that I have no idea how the second player's computer can know how long ago messages were sent. I thought about sending the value of 'get_timer()' to the other player at the beginning of the match and then for every move it will send the time at which it was inputted. Using it's own get_timer() value, the other player's game could then calculate how long after the beginning of the match the input was given in the other player's game and when that would be for itself, but the 'get_timer()' message at the beginning of the match would of course take time to be sent as well and so when the second player receives this message the first player's game will already be hundreds of milliseconds further.
Does anyone have an idea on how I can figure out how long ago a message was sent?
Thanks in advance!
I am working on a multiplayer game in GameMaker. The concept is close to a fighting game and so it's very important both players see the same thing happening at the exact same time. It takes a while for a buffer to be sent to the other player though. A lot of fighting games fix this by having an input delay, where a move is performed say, 2 frames after the input. At the input a buffer is sent to the other player saying the input for a move was given and it will be executed two frames after the input. That player's game will then calculate how long before it has to display the move as well, by subtracting how long ago the message was sent from those two frames.
The problem is that I have no idea how the second player's computer can know how long ago messages were sent. I thought about sending the value of 'get_timer()' to the other player at the beginning of the match and then for every move it will send the time at which it was inputted. Using it's own get_timer() value, the other player's game could then calculate how long after the beginning of the match the input was given in the other player's game and when that would be for itself, but the 'get_timer()' message at the beginning of the match would of course take time to be sent as well and so when the second player receives this message the first player's game will already be hundreds of milliseconds further.
Does anyone have an idea on how I can figure out how long ago a message was sent?
Thanks in advance!