-
Notifications
You must be signed in to change notification settings - Fork 27
/
NetworkingDesign.txt
46 lines (35 loc) · 1.45 KB
/
NetworkingDesign.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Requirements:
Generic enough to easily support mods/new content
Minimize network traffic
Minimize memory usage
Minimize CPU usage
Design:
https://www.gabrielgambetta.com/client-side-prediction-server-reconciliation.html
https://www.gabrielgambetta.com/entity-interpolation.html
-Server
-Receives commands from the players via the client
-Processes the client's command
-Responds with a change in the game state
-Client
-Sends commands from the player to the server
-Predicts the server response, starts doing the predicted action
-Receives a response with a new game state
-Somehow gets back to the server's recorded state
-Stops doing the predicted action, starts doing the server's action
abstract INetSyncable
{
NetObjectServerMessage predicted;
NetObjectServerMessage actual;
NetObjectClientMessage clientCommand;
//Mutates this object's state based upon received data from the client.
//Returns a response to the client's command.
NetObjectServerMessage ServerRecieveMessage(NetObjectClientMessage clientMessage);
//Predict a response by the server
NetObjectServerMessage PredictResponse();
//Recieve the authoratative response from the server.
void ClientRecieveMessage(NetObjectServerMessage serverMessage);
//Begin carrying out the predicted response
void ClientExecutePrediction(NetObjectServerMessage predictedResponse);
//Called until the client's syncable object matches with the server's response.
void Resolve();
}