author | terom |
Mon, 08 Dec 2008 23:52:08 +0000 | |
changeset 334 | 0cf3f2be51eb |
parent 330 | dcc47278e5ab |
child 400 | d64bf28c4340 |
permissions | -rw-r--r-- |
187 | 1 |
#ifndef NETWORK_PROTOCOL_HH |
2 |
#define NETWORK_PROTOCOL_HH |
|
3 |
||
4 |
/* |
|
5 |
* The network protocol is defined here :o |
|
6 |
*/ |
|
7 |
||
8 |
enum NetworkChannel { |
|
9 |
/* |
|
10 |
* Core channel used for NetworkSession |
|
11 |
*/ |
|
203
3ec7ab40755f
send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents:
200
diff
changeset
|
12 |
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
|
13 |
|
3ec7ab40755f
send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents:
200
diff
changeset
|
14 |
/* |
3ec7ab40755f
send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents:
200
diff
changeset
|
15 |
* 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
|
16 |
* |
3ec7ab40755f
send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents:
200
diff
changeset
|
17 |
* 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
|
18 |
* 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
|
19 |
* 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
|
20 |
*/ |
3ec7ab40755f
send initial terrain data to clients using a new NETCHAN_TERRAIN_ARRAY channel using raw BigNetworkPacket
terom
parents:
200
diff
changeset
|
21 |
NETCHAN_TERRAIN_ARRAY = 0x0010, |
187 | 22 |
}; |
23 |
||
24 |
enum NetworkPhysicsFlags { |
|
224
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
25 |
NETWORK_PHYSICS_INAIR = 0x01, |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
26 |
NETWORK_PHYSICS_FACE_RIGHT = 0x02, |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
27 |
}; |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
28 |
|
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
29 |
enum NetworkProjectileFlags { |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
30 |
NETWORK_PROJECTILE_REMOVE_GROUND = 0x01, |
187 | 31 |
}; |
32 |
||
33 |
enum NetworkMessage { |
|
223 | 34 |
NETMSG_PACKET_INVALID = 0x0000, |
187 | 35 |
|
36 |
/* |
|
37 |
* You have joined the game: |
|
38 |
* |
|
39 |
* Vector initial_position |
|
40 |
*/ |
|
223 | 41 |
NETMSG_SERVER_HELLO = 0x0100, |
187 | 42 |
|
43 |
/* |
|
44 |
* New client has connected to server: |
|
45 |
* |
|
46 |
* Vector initial_position |
|
47 |
*/ |
|
223 | 48 |
NETMSG_PLAYER_JOIN = 0x0101, |
187 | 49 |
|
50 |
/* |
|
51 |
* Client has left server: |
|
52 |
* |
|
53 |
*/ |
|
223 | 54 |
NETMSG_PLAYER_QUIT = 0x0102, |
187 | 55 |
|
56 |
/* |
|
223 | 57 |
* Client has input to process |
187 | 58 |
* |
223 | 59 |
* uint16_t PlayerInput |
334 | 60 |
* uint32_t dt |
187 | 61 |
*/ |
223 | 62 |
NETMSG_CLIENT_INPUT = 0x0201, |
187 | 63 |
|
64 |
/* |
|
65 |
* Initial player info |
|
66 |
* |
|
67 |
* Vector initial_position |
|
68 |
*/ |
|
223 | 69 |
NETMSG_PLAYER_INFO = 0x0300, |
187 | 70 |
|
71 |
/* |
|
72 |
* Player position update |
|
73 |
* |
|
74 |
* Vector position |
|
75 |
* Vector velocity |
|
76 |
* uint8_t NetworkPhysicsFlags |
|
200
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
77 |
* float32 aim |
187 | 78 |
*/ |
223 | 79 |
NETMSG_PLAYER_POSITION = 0x0301, |
200
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
80 |
|
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
81 |
/* |
302 | 82 |
* Player has spawned somewhere |
83 |
* |
|
84 |
* Vector position |
|
85 |
*/ |
|
86 |
NETMSG_PLAYER_SPAWN = 0x0302, |
|
87 |
||
88 |
/* |
|
89 |
* Player has died |
|
90 |
* |
|
91 |
*/ |
|
92 |
NETMSG_PLAYER_DIE = 0x0303, |
|
93 |
||
94 |
/* |
|
200
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
95 |
* Terrain update, removeGround |
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
96 |
* |
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
97 |
* Vector position |
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
98 |
* float32 radius |
2dbf40661580
better NetworkBuffer/Packet stuff + some additional Physics+Network stuff + random fixes
terom
parents:
187
diff
changeset
|
99 |
*/ |
241 | 100 |
NETMSG_PLAYER_DIG = 0x0312, |
223 | 101 |
|
102 |
/* |
|
239
550397d9d479
implement network weapon changes and fix weapon firing
terom
parents:
224
diff
changeset
|
103 |
* Player changed weapon |
550397d9d479
implement network weapon changes and fix weapon firing
terom
parents:
224
diff
changeset
|
104 |
* |
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
263
diff
changeset
|
105 |
* uint8_t weapon_id |
239
550397d9d479
implement network weapon changes and fix weapon firing
terom
parents:
224
diff
changeset
|
106 |
*/ |
241 | 107 |
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
|
108 |
|
241 | 109 |
/* |
110 |
* Player threw the rope |
|
111 |
* |
|
112 |
* Vector position |
|
113 |
* Vector velocity |
|
114 |
* float length |
|
115 |
*/ |
|
116 |
NETMSG_PLAYER_ROPE_THROW = 0x0331, |
|
117 |
||
118 |
/* |
|
119 |
* Player rope fixed on to something |
|
120 |
* |
|
121 |
* Vector position |
|
122 |
* float length |
|
328 | 123 |
* Object? player |
241 | 124 |
*/ |
125 |
NETMSG_PLAYER_ROPE_FIXED = 0x0332, |
|
126 |
||
127 |
/* |
|
128 |
* Player rope released |
|
129 |
* |
|
130 |
*/ |
|
131 |
NETMSG_PLAYER_ROPE_RELEASED = 0x0333, |
|
132 |
||
133 |
/* |
|
134 |
* Rope length changed |
|
135 |
* |
|
136 |
* float length |
|
137 |
*/ |
|
138 |
NETMSG_PLAYER_ROPE_LENGTH = 0x0334, |
|
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
263
diff
changeset
|
139 |
|
239
550397d9d479
implement network weapon changes and fix weapon firing
terom
parents:
224
diff
changeset
|
140 |
/* |
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
263
diff
changeset
|
141 |
* Player has fired a weapon, creating this projectile |
223 | 142 |
* |
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
263
diff
changeset
|
143 |
* Object player |
223 | 144 |
* Vector position |
145 |
* 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
|
146 |
* uint8_t weapon_id |
223 | 147 |
*/ |
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
263
diff
changeset
|
148 |
NETMSG_PROJECTILE_PLAYER_FIRED = 0x0411, |
224
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
149 |
|
296
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
276
diff
changeset
|
150 |
/** |
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
276
diff
changeset
|
151 |
* Projectile has hit a player |
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
276
diff
changeset
|
152 |
* |
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
276
diff
changeset
|
153 |
* Object player |
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
276
diff
changeset
|
154 |
*/ |
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
276
diff
changeset
|
155 |
NETMSG_PROJECTILE_HIT_PLAYER = 0x0421, |
4d3ebaa29430
add separate Types.hh, and fix projectile-worm collisions on network
terom
parents:
276
diff
changeset
|
156 |
|
224
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
157 |
/* |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
158 |
* Projectile has gone away |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
159 |
* |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
160 |
* Vector position |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
161 |
* uint8_t NetworkProjectileFlags (REMOVE_GROUND) |
e6faefba2ec1
fixed logger, and network projectiles should work reasonably well now
terom
parents:
223
diff
changeset
|
162 |
*/ |
276
87434abc1ba1
ability to send NetworkObjectID's via packets, modify Network Projectiles to use this and fix recoil/reloading
terom
parents:
263
diff
changeset
|
163 |
NETMSG_PROJECTILE_DESTROY = 0x040F, |
187 | 164 |
}; |
165 |
||
166 |
#endif |