author | nireco |
Sat, 31 Jan 2009 12:33:08 +0200 | |
changeset 443 | 5d1119729f58 |
parent 431 | c6d7272a164b |
permissions | -rw-r--r-- |
187 | 1 |
#ifndef NETWORK_PROTOCOL_HH |
2 |
#define NETWORK_PROTOCOL_HH |
|
3 |
||
400
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
4 |
/** |
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
5 |
* @file |
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
6 |
* |
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
7 |
* Definitions for game network protocol |
187 | 8 |
*/ |
9 |
||
400
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
10 |
/** |
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
11 |
* The various NetworkChannelIDs used with our NetworkSession |
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
12 |
*/ |
187 | 13 |
enum NetworkChannel { |
14 |
/* |
|
15 |
* Core channel used for NetworkSession |
|
16 |
*/ |
|
203
3ec7ab40755f
send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents:
200
diff
changeset
|
17 |
NETCHAN_CORE = 0x0001, |
3ec7ab40755f
send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents:
200
diff
changeset
|
18 |
|
3ec7ab40755f
send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents:
200
diff
changeset
|
19 |
/* |
3ec7ab40755f
send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents:
200
diff
changeset
|
20 |
* Channel used to send initial terrain array |
3ec7ab40755f
send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents:
200
diff
changeset
|
21 |
* |
3ec7ab40755f
send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents:
200
diff
changeset
|
22 |
* uint32_t map_w |
3ec7ab40755f
send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents:
200
diff
changeset
|
23 |
* uint32_t map_h |
3ec7ab40755f
send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents:
200
diff
changeset
|
24 |
* uint8_t[map_w][map_h] terrain |
3ec7ab40755f
send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents:
200
diff
changeset
|
25 |
*/ |
3ec7ab40755f
send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents:
200
diff
changeset
|
26 |
NETCHAN_TERRAIN_ARRAY = 0x0010, |
187 | 27 |
}; |
28 |
||
400
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
29 |
/** |
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
30 |
* Various flags used with NETMSG_PLAYER_POSITION related to PhysicsObject state |
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
31 |
*/ |
187 | 32 |
enum NetworkPhysicsFlags { |
224
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
33 |
NETWORK_PHYSICS_INAIR = 0x01, |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
34 |
NETWORK_PHYSICS_FACE_RIGHT = 0x02, |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
35 |
}; |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
36 |
|
400
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
37 |
/** |
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
38 |
* Various flags used with NETMSG_PROJECTILE_* messages... |
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
39 |
*/ |
224
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
40 |
enum NetworkProjectileFlags { |
400
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
41 |
/** NETMSG_PROJECTILE_DESTROY */ |
224
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
42 |
NETWORK_PROJECTILE_REMOVE_GROUND = 0x01, |
187 | 43 |
}; |
44 |
||
400
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
45 |
/** |
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
46 |
* Various NetworkMessageIDs used with our NetworkSession's NetworkObjects. |
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
47 |
* |
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
48 |
* Message names are of the form 'NETMSG_<object type>_<action>' |
d64bf28c4340
more documentation tweaking, all Network/ files now have a @file comment. Fix Platform.h -> Platform.hh, and Buffer.hh + Packet.cc
Tero Marttila <terom@fixme.fi>
parents:
334
diff
changeset
|
49 |
*/ |
431
c6d7272a164b
rework Network send() code to use NetworkTarget/Node/Group::send classes, add a NetworkMessage class for sending NetworkObject messages, and fix a bug whereby the server's client TCP sockets weren't nonblocking.... I wonder how this has worked before?\!
Tero Marttila <terom@fixme.fi>
parents:
400
diff
changeset
|
50 |
enum NetworkMessageID_ { |
223 | 51 |
NETMSG_PACKET_INVALID = 0x0000, |
187 | 52 |
|
431
c6d7272a164b
rework Network send() code to use NetworkTarget/Node/Group::send classes, add a NetworkMessage class for sending NetworkObject messages, and fix a bug whereby the server's client TCP sockets weren't nonblocking.... I wonder how this has worked before?\!
Tero Marttila <terom@fixme.fi>
parents:
400
diff
changeset
|
53 |
// Server -> Client: Handshake |
187 | 54 |
/* |
55 |
* You have joined the game: |
|
56 |
* |
|
57 |
* Vector initial_position |
|
58 |
*/ |
|
223 | 59 |
NETMSG_SERVER_HELLO = 0x0100, |
187 | 60 |
|
431
c6d7272a164b
rework Network send() code to use NetworkTarget/Node/Group::send classes, add a NetworkMessage class for sending NetworkObject messages, and fix a bug whereby the server's client TCP sockets weren't nonblocking.... I wonder how this has worked before?\!
Tero Marttila <terom@fixme.fi>
parents:
400
diff
changeset
|
61 |
// Server -> Client: Player state |
187 | 62 |
/* |
63 |
* New client has connected to server: |
|
64 |
* |
|
65 |
* Vector initial_position |
|
66 |
*/ |
|
223 | 67 |
NETMSG_PLAYER_JOIN = 0x0101, |
187 | 68 |
|
69 |
/* |
|
70 |
* Client has left server: |
|
71 |
* |
|
72 |
*/ |
|
223 | 73 |
NETMSG_PLAYER_QUIT = 0x0102, |
187 | 74 |
|
431
c6d7272a164b
rework Network send() code to use NetworkTarget/Node/Group::send classes, add a NetworkMessage class for sending NetworkObject messages, and fix a bug whereby the server's client TCP sockets weren't nonblocking.... I wonder how this has worked before?\!
Tero Marttila <terom@fixme.fi>
parents:
400
diff
changeset
|
75 |
// Client -> Server: Player |
187 | 76 |
/* |
223 | 77 |
* Client has input to process |
187 | 78 |
* |
223 | 79 |
* uint16_t PlayerInput |
334 | 80 |
* uint32_t dt |
187 | 81 |
*/ |
223 | 82 |
NETMSG_CLIENT_INPUT = 0x0201, |
187 | 83 |
|
431
c6d7272a164b
rework Network send() code to use NetworkTarget/Node/Group::send classes, add a NetworkMessage class for sending NetworkObject messages, and fix a bug whereby the server's client TCP sockets weren't nonblocking.... I wonder how this has worked before?\!
Tero Marttila <terom@fixme.fi>
parents:
400
diff
changeset
|
84 |
// Server -> Client: Player |
187 | 85 |
/* |
86 |
* Initial player info |
|
87 |
* |
|
88 |
* Vector initial_position |
|
89 |
*/ |
|
223 | 90 |
NETMSG_PLAYER_INFO = 0x0300, |
187 | 91 |
|
92 |
/* |
|
93 |
* Player position update |
|
94 |
* |
|
95 |
* Vector position |
|
96 |
* Vector velocity |
|
97 |
* uint8_t NetworkPhysicsFlags |
|
200
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
98 |
* float32 aim |
187 | 99 |
*/ |
223 | 100 |
NETMSG_PLAYER_POSITION = 0x0301, |
200
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
101 |
|
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
102 |
/* |
302 | 103 |
* Player has spawned somewhere |
104 |
* |
|
105 |
* Vector position |
|
106 |
*/ |
|
107 |
NETMSG_PLAYER_SPAWN = 0x0302, |
|
108 |
||
109 |
/* |
|
110 |
* Player has died |
|
111 |
* |
|
112 |
*/ |
|
113 |
NETMSG_PLAYER_DIE = 0x0303, |
|
114 |
||
115 |
/* |
|
200
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
116 |
* Terrain update, removeGround |
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
117 |
* |
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
118 |
* Vector position |
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
119 |
* float32 radius |
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
120 |
*/ |
241 | 121 |
NETMSG_PLAYER_DIG = 0x0312, |
223 | 122 |
|
123 |
/* |
|
239
550397d9d479
implement network weapon changes and fix weapon firing
terom
parents:
224
diff
changeset
|
124 |
* Player changed weapon |
550397d9d479
implement network weapon changes and fix weapon firing
terom
parents:
224
diff
changeset
|
125 |
* |
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
263
diff
changeset
|
126 |
* uint8_t weapon_id |
239
550397d9d479
implement network weapon changes and fix weapon firing
terom
parents:
224
diff
changeset
|
127 |
*/ |
241 | 128 |
NETMSG_PLAYER_WEAPON_CHANGE = 0x0321, |
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
263
diff
changeset
|
129 |
|
241 | 130 |
/* |
131 |
* Player threw the rope |
|
132 |
* |
|
133 |
* Vector position |
|
134 |
* Vector velocity |
|
135 |
* float length |
|
136 |
*/ |
|
137 |
NETMSG_PLAYER_ROPE_THROW = 0x0331, |
|
138 |
||
139 |
/* |
|
140 |
* Player rope fixed on to something |
|
141 |
* |
|
142 |
* Vector position |
|
143 |
* float length |
|
328 | 144 |
* Object? player |
241 | 145 |
*/ |
146 |
NETMSG_PLAYER_ROPE_FIXED = 0x0332, |
|
147 |
||
148 |
/* |
|
149 |
* Player rope released |
|
150 |
* |
|
151 |
*/ |
|
152 |
NETMSG_PLAYER_ROPE_RELEASED = 0x0333, |
|
153 |
||
154 |
/* |
|
155 |
* Rope length changed |
|
156 |
* |
|
157 |
* float length |
|
158 |
*/ |
|
159 |
NETMSG_PLAYER_ROPE_LENGTH = 0x0334, |
|
431
c6d7272a164b
rework Network send() code to use NetworkTarget/Node/Group::send classes, add a NetworkMessage class for sending NetworkObject messages, and fix a bug whereby the server's client TCP sockets weren't nonblocking.... I wonder how this has worked before?\!
Tero Marttila <terom@fixme.fi>
parents:
400
diff
changeset
|
160 |
|
c6d7272a164b
rework Network send() code to use NetworkTarget/Node/Group::send classes, add a NetworkMessage class for sending NetworkObject messages, and fix a bug whereby the server's client TCP sockets weren't nonblocking.... I wonder how this has worked before?\!
Tero Marttila <terom@fixme.fi>
parents:
400
diff
changeset
|
161 |
// Server -> Client: Projectiles |
c6d7272a164b
rework Network send() code to use NetworkTarget/Node/Group::send classes, add a NetworkMessage class for sending NetworkObject messages, and fix a bug whereby the server's client TCP sockets weren't nonblocking.... I wonder how this has worked before?\!
Tero Marttila <terom@fixme.fi>
parents:
400
diff
changeset
|
162 |
/** |
c6d7272a164b
rework Network send() code to use NetworkTarget/Node/Group::send classes, add a NetworkMessage class for sending NetworkObject messages, and fix a bug whereby the server's client TCP sockets weren't nonblocking.... I wonder how this has worked before?\!
Tero Marttila <terom@fixme.fi>
parents:
400
diff
changeset
|
163 |
* Projectile object sync |
c6d7272a164b
rework Network send() code to use NetworkTarget/Node/Group::send classes, add a NetworkMessage class for sending NetworkObject messages, and fix a bug whereby the server's client TCP sockets weren't nonblocking.... I wonder how this has worked before?\!
Tero Marttila <terom@fixme.fi>
parents:
400
diff
changeset
|
164 |
* |
c6d7272a164b
rework Network send() code to use NetworkTarget/Node/Group::send classes, add a NetworkMessage class for sending NetworkObject messages, and fix a bug whereby the server's client TCP sockets weren't nonblocking.... I wonder how this has worked before?\!
Tero Marttila <terom@fixme.fi>
parents:
400
diff
changeset
|
165 |
* @see NETMSG_PROJECTILE_PLAYER_FIRED |
c6d7272a164b
rework Network send() code to use NetworkTarget/Node/Group::send classes, add a NetworkMessage class for sending NetworkObject messages, and fix a bug whereby the server's client TCP sockets weren't nonblocking.... I wonder how this has worked before?\!
Tero Marttila <terom@fixme.fi>
parents:
400
diff
changeset
|
166 |
*/ |
c6d7272a164b
rework Network send() code to use NetworkTarget/Node/Group::send classes, add a NetworkMessage class for sending NetworkObject messages, and fix a bug whereby the server's client TCP sockets weren't nonblocking.... I wonder how this has worked before?\!
Tero Marttila <terom@fixme.fi>
parents:
400
diff
changeset
|
167 |
NETMSG_PROJECTILE_INFO = 0x0410, |
c6d7272a164b
rework Network send() code to use NetworkTarget/Node/Group::send classes, add a NetworkMessage class for sending NetworkObject messages, and fix a bug whereby the server's client TCP sockets weren't nonblocking.... I wonder how this has worked before?\!
Tero Marttila <terom@fixme.fi>
parents:
400
diff
changeset
|
168 |
|
239
550397d9d479
implement network weapon changes and fix weapon firing
terom
parents:
224
diff
changeset
|
169 |
/* |
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
263
diff
changeset
|
170 |
* Player has fired a weapon, creating this projectile |
223 | 171 |
* |
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
263
diff
changeset
|
172 |
* Object player |
223 | 173 |
* Vector position |
174 |
* Vector velocity |
|
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
263
diff
changeset
|
175 |
* uint8_t weapon_id |
223 | 176 |
*/ |
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
263
diff
changeset
|
177 |
NETMSG_PROJECTILE_PLAYER_FIRED = 0x0411, |
224
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
178 |
|
296
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
276
diff
changeset
|
179 |
/** |
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
276
diff
changeset
|
180 |
* Projectile has hit a player |
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
276
diff
changeset
|
181 |
* |
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
276
diff
changeset
|
182 |
* Object player |
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
276
diff
changeset
|
183 |
*/ |
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
276
diff
changeset
|
184 |
NETMSG_PROJECTILE_HIT_PLAYER = 0x0421, |
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
276
diff
changeset
|
185 |
|
224
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
186 |
/* |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
187 |
* Projectile has gone away |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
188 |
* |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
189 |
* Vector position |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
190 |
* uint8_t NetworkProjectileFlags (REMOVE_GROUND) |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
191 |
*/ |
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
263
diff
changeset
|
192 |
NETMSG_PROJECTILE_DESTROY = 0x040F, |
187 | 193 |
}; |
194 |
||
195 |
#endif |