December 2013
Beginner
242 pages
4h 23m
English
Now that we have our script structured the way we need, we can go ahead and implement the rest. First, we'll create a structure to hold move commands:
// represents a move command sent to the server
private struct move
{
public float HorizontalAxis;
public float VerticalAxis;
public double Timestamp;
public move( float horiz, float vert, double timestamp )
{
this.HorizontalAxis = horiz;
this.VerticalAxis = vert;
this.Timestamp = timestamp;
}
}On the server, we'll store a buffer of move states sent from the client. We'll also keep a reference to our Player script for the client and server:
// a history of move states sent from client to server List<move> moveHistory = new List<move>(); // a reference to ...
Read now
Unlock full access