@@ -7,6 +7,7 @@ The server is the core of the game. It manages the game logic and the network.
7
7
1 . [ RFC] ( #rfc )
8
8
- [ What is an RFC?] ( #what-is-an-rfc )
9
9
- [ Actual RFC for the Server] ( #actual-rfc-for-the-server )
10
+ 2 . [ Actual server] ( #actual-server )
10
11
11
12
## RFC
12
13
@@ -21,7 +22,7 @@ The RFC for the Server is :
21
22
``` text
22
23
Exodia
23
24
Request for comments: 1
24
- 29 november 2023
25
+ 31 december 2023
25
26
Author: Axel Rohee
26
27
27
28
@@ -65,11 +66,11 @@ Content_of_a_component - 32 bit (4 bytes) unsigned integer representing the
65
66
length of the content followed by the content.
66
67
System - Null terminated string prefixed with a 32 bit (4 bytes) unsigned
67
68
integer representing the length of the string.
68
- Timestamp - 32 bit (4 bytes) float representing the time in seconds.
69
+ Timestamp - 64 bit (8 bytes) float representing the time in seconds.
69
70
Event - 32 bit (4 bytes) unsigned integer representing the event type.
70
71
Id - 64 bit (8 bytes) unsigned integer representing the id of the command
71
72
use for implementing acknoledgement.
72
- GameEvents - - Null terminated string prefixed with a 32 bit (4 bytes) unsigned
73
+ GameEvents - Null terminated string prefixed with a 32 bit (4 bytes) unsigned
73
74
integer representing the length of the string.
74
75
Size - 64 bit (8 bytes) unsigned integer representing the size of the content
75
76
of the packet.
@@ -79,8 +80,16 @@ Commands
79
80
Each command is prefixed with a header define below representing the command. There are the
80
81
following commands command inferior to 0x80 are server commands and superior
81
82
to 0x80 are client commands.
83
+ The header is composed of the following:
84
+ Command - 8 bits (1 byte) bitfield representing the command number.
85
+ Timestamp - 32 bit (4 bytes) float representing the time in seconds.
86
+ Id - 64 bit (8 bytes) unsigned integer representing the id of the command.
87
+ Size - 64 bit (8 bytes) unsigned integer representing the size of the content
88
+ of the packet.
89
+ Bool - 1 bit represnting if the command is important or not.If it needs an acknowledge or not.
90
+
82
91
Header
83
- Content: [Command][Timestamp][Id][Size]
92
+ Content: [Command][Timestamp][Id][Bool][ Size]
84
93
85
94
Special commands
86
95
0x00 - Send number of packets received and send since last second
@@ -89,33 +98,84 @@ Special commands
89
98
Content: [Id]
90
99
ServerCommand
91
100
0x02 - Accept client connection
101
+ Content: [Id]
92
102
0x03 - Reject client connection
93
- 0x0b - Send system to load MUST get an acknowledge
94
- Content: [System][System]...
95
- 0x0c - Send entities with their components MUST get an acknowledge
103
+ 0x0b - Send system to load
104
+ Content: [System]
105
+ 0x0c - Send entities with their components
96
106
Content: [Entity][Component][Content_of_a_component]
97
- 0x0d - Send GameEvents MUST get an acknowledge
98
- Content: [GameEvents][GameEvents]...
99
- 0x0e - Send deleted entities MUST get an acknowledge
107
+ 0x0d - Send GameEvents
108
+ Content: [GameEvents]
109
+ 0x0e - Send deleted entities
100
110
Content: [Entity]
101
- 0x10 - Send deleted components on entities MUST get an acknowledge
111
+ 0x0f - Send deleted components on entities
102
112
Content: [Entity][Component][Content_of_a_component]
103
- 0x11 - Send events
104
- Content: [Event]
105
113
ClientCommand
106
- 0x81 - Connect MUST get an acknowledge
114
+ 0x81 - Connect
115
+ Content: [Timestamp][Id]
107
116
0x82 - Disconnect
108
- 0x8a - Send events
109
- Content: [Event]
110
- 0x8b - Send important events MUST get an acknowledge
111
- Content: [Event]
117
+ 0x8b - Send events release the bool is true if the event is a key press false if it is a key release
118
+ Content: [Event][Bool]
119
+
120
+ Details
121
+
122
+ 0x00 - Packet info
123
+ This command is used to send the number of packets received and send since
124
+ last call of this command. This command is used to calculate the packet loss
125
+ It's content is [Int][Int] the first int is the number of packets received
126
+ and the second int is the number of packets send.
127
+
128
+ 0x01 - Acknowledge
129
+ This command is used to acknowledge a command. It's content is [Id] the id
130
+ of the command to acknowledge.
131
+
132
+ 0x02 - Accept client connection
133
+ This command is used to accept a client connection.
134
+ It's content is [Id] the id of the client.
135
+
136
+ 0x03 - Reject client connection
137
+ This command is used to reject a client connection. It's content is empty.
138
+
139
+ 0x0b - Send system to load
140
+ This command is used to send the systems to load. It's content is
141
+ [System] the system to load.
142
+
143
+ 0x0c - Send entities with their components
144
+ This command is used to send the entities with one components. It's
145
+ content is [Entity][Component][Content_of_a_component] the entity to load
146
+ the component to load and the content of the component.
147
+
148
+ 0x0d - Send GameEvent
149
+ This command is used to send the GameEvents. It's content is
150
+ [GameEvents] the GameEvents to load.
151
+
152
+ 0x0e - Send deleted entities
153
+ This command is used to send the deleted entities. It's content is
154
+ [Entity] the entity to delete.
155
+
156
+ 0x0f - Send deleted components on entities
157
+ This command is used to send the deleted components on entities. It's
158
+ content is [Entity][Component] the entity to delete
159
+ the component to delete and the content of the component to delete.
160
+
161
+ 0x81 - Connect
162
+ This command is used to connect to the server. It's content is
163
+ [Timestamp][Id] the timestamp of the client and the id of the server to
164
+ connect to.
165
+
166
+ 0x82 - Disconnect
167
+ This command is used to disconnect from the server. It's content is empty.
168
+
169
+ 0x8b - Send events
170
+ This command is used to send the events. It's content is [Event][Bool] the event
171
+ to send and a bool representing if the event is a key press or a key release.
112
172
113
173
Usage
114
174
115
175
The protocol is designed to be used in a certain way.
116
176
this section will show an example of how to use the protocol.
117
177
118
- Initiation:events
178
+ Initiation:
119
179
Client -> [0x81][Timestamp][Id]
120
180
Server -> [0x02][Timestamp][Id]
121
181
Server -> [0x0b][Timestamp][Id][System][System]...
@@ -136,4 +196,13 @@ End:
136
196
one or the other:
137
197
Client -> [0x82][Timestamp][Id][Id] and Server -> [0x11][Timestamp][Id][Id]
138
198
Server -> [0x03][Timestamp][Id]
139
- ```
199
+
200
+ ```
201
+
202
+ ## Actual server
203
+
204
+ The R-Type server is divide in 3 parts :
205
+ - [ Main] ( server-main.md ) : The main of the server.
206
+ - [ Server] ( server-server.md ) : The part that allow to create a server.
207
+ - [ User] ( server-user.md ) : The part to handle the users.
208
+
0 commit comments