libspades
Ace of Spades library
protocol.h
1
4
5#ifndef LIBSPADES_PROTOCOL_H
6#define LIBSPADES_PROTOCOL_H
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11#include "../config.h"
12#include "datatypes.h"
13
14#define VARIABLE_LENGTH 1
15
16#ifdef PACK_GCC
17#define LIBSPADES_PACKED __attribute__((packed))
18#else
19#pragma pack(push, 1)
20#define LIBSPADES_PACKED
21#endif
22
23/* core protocol packet structs */
24
42struct LIBSPADES_PACKED PacketPositionData {
43 uint8_t packetID;
44 float xPosition;
46 float yPosition;
48 float zPosition;
50};
51
83struct LIBSPADES_PACKED PacketOrientationData {
84 uint8_t packetID;
90};
91
92struct LIBSPADES_PACKED PlayerPositionData {
93 float xPosition;
94 float yPosition;
95 float zPosition;
96 float xOrientation;
97 float yOrientation;
98 float zOrientation;
99};
100
101struct LIBSPADES_PACKED PlayerPositionData76 {
102 uint8_t playerID;
103 float xPosition;
104 float yPosition;
105 float zPosition;
106 float xOrientation;
107 float yOrientation;
108 float zOrientation;
109};
110
117struct LIBSPADES_PACKED PacketWorldUpdate { /* do 0.76 version later */
118 uint8_t packetID;
119 struct PlayerPositionData players[MAX_PLAYERS];
120};
121
127struct LIBSPADES_PACKED PacketInputData {
128 uint8_t packetID;
129 uint8_t playerID;
130 uint8_t keyStates;
142};
143
145struct LIBSPADES_PACKED PacketWeaponInput {
146 uint8_t packetID;
147 uint8_t playerID;
148 uint8_t weaponInput;
153};
154
156struct LIBSPADES_PACKED PacketHit {
157 uint8_t packetID;
158 uint8_t playerID;
159 uint8_t hitType;
167};
168
170struct LIBSPADES_PACKED PacketSetHP {
171 uint8_t packetID;
172 uint8_t HP;
173 uint8_t type;
178 float sourceX;
179 float sourceY;
181 float sourceZ;
182};
183
202struct LIBSPADES_PACKED PacketGrenade {
203 uint8_t packetID;
204 uint8_t playerID;
212 float xPosition;
213 float yPosition;
215 float zPosition;
216 float xVelocity;
217 float yVelocity;
218 float zVelocity;
219};
220
222struct LIBSPADES_PACKED PacketSetTool {
223 uint8_t packetID;
224 uint8_t playerID;
225 uint8_t tool;
232};
233
237struct LIBSPADES_PACKED PacketSetColour {
238 uint8_t packetID;
239 uint8_t playerID;
240 uint8_t blue; /* TODO: use b,g,r
242 xor
243 blue,green,red
244 */
245 uint8_t green;
246 uint8_t red;
247};
248
257struct LIBSPADES_PACKED PacketExistingPlayer {
258 uint8_t packetID;
259 uint8_t playerID;
260 uint8_t team;
262 uint8_t weapon;
268 uint8_t item;
275 uint32_t kills; /* or points? */
277 uint8_t blue;
278 uint8_t green;
279 uint8_t red;
280 char name[16];
297};
298
310struct LIBSPADES_PACKED PacketShortPlayerData {
311 uint8_t packetID;
312 uint8_t playerID;
318 uint8_t team;
319 uint8_t weapon;
320};
321
323struct LIBSPADES_PACKED PacketMoveObject {
324 uint8_t packetID;
325 uint8_t objectID;
326 uint8_t team; /* unsigned int is intentional for some reason, check the
327 aosprotocol docs */
328 float xPosition;
329 float yPosition;
330 float zPosition;
331};
332
334struct LIBSPADES_PACKED PacketCreatePlayer {
335 uint8_t packetID;
336 uint8_t playerID;
337 uint8_t weapon;
338 uint8_t team;
339 float xPosition;
340 float yPosition;
342 float zPosition;
344 char name[16];
349 /* or connected?? TODO: verify */
350};
351
353struct LIBSPADES_PACKED PacketBlockAction {
354 uint8_t packetID;
355 uint8_t playerID;
357 uint8_t actionType;
377 int32_t xPosition;
378 int32_t yPosition;
379 int32_t zPosition;
380};
381
402struct LIBSPADES_PACKED PacketBlockLine {
403 uint8_t packetID;
404 uint8_t playerID;
405 uint32_t startXPosition;
407 uint32_t startYPosition;
409 uint32_t startZPosition;
410 uint32_t endXPosition;
411 uint32_t endYPosition;
413 uint32_t endZPosition;
414};
415
416struct LIBSPADES_PACKED FloatVector {
417 float x;
418 float y;
419 float z;
420};
421
423 uint8_t playerID;
424 Vector3Float position;
425};
426
428struct LIBSPADES_PACKED CTFStateData {
429 uint8_t team1Score;
430 uint8_t team2Score;
431 uint8_t captureLimit;
433 uint8_t heldIntels;
445 Vector3Float team1TentPosition;
446 Vector3Float team2TentPosition;
447};
448
449struct LIBSPADES_PACKED Territory {
450 float xPosition;
451 float yPosition;
453 float zPosition;
454 uint8_t team;
455};
456
458struct LIBSPADES_PACKED TCStateData {
464};
465
471
475struct LIBSPADES_PACKED PacketStateData { /* TODO: shoehorn gamemode state data in later */
476 uint8_t packetID;
477 uint8_t playerID;
478 uint8_t fog_b;
479 uint8_t fog_g;
480 uint8_t fog_r;
481 uint8_t team1_b;
482 uint8_t team1_g;
483 uint8_t team1_r;
484 uint8_t team2_b;
485 uint8_t team2_g;
486 uint8_t team2_r;
487 char team1Name[10];
488 char team2Name[10];
489 uint8_t gamemode;
495};
496
498struct LIBSPADES_PACKED PacketKillAction {
499 uint8_t packetID;
500 uint8_t playerID;
501 uint8_t killerID;
502 uint8_t killType;
516 uint8_t respawnTime;
521};
522
524struct LIBSPADES_PACKED PacketChatMessage {
525 uint8_t packetID;
526 uint8_t playerID;
527 uint8_t type;
533 char message[VARIABLE_LENGTH];
535};
536
540struct LIBSPADES_PACKED PacketMapStart {
541 uint8_t packetID;
542 uint32_t mapSize;
544};
545
547struct LIBSPADES_PACKED PacketMapStart76 {
548 uint8_t packetID;
549 uint32_t mapSize;
550 uint32_t crc32;
552 char mapName[16]; /* may not actually work */
553};
554
558struct LIBSPADES_PACKED PacketMapChunk {
559 uint8_t packetID;
560 uint8_t mapData[VARIABLE_LENGTH];
562};
563
565struct LIBSPADES_PACKED PacketPlayerLeft {
566 uint8_t packetID;
567 uint8_t playerID;
568};
569
571struct LIBSPADES_PACKED PacketTerritoryCapture {
572 uint8_t packetID;
573 uint8_t territoryID;
574 uint8_t winning;
575 uint8_t team;
576};
577
581struct LIBSPADES_PACKED PacketProgressBar {
582 uint8_t packetID;
583 uint8_t entityID;
584 uint8_t capturingTeam;
585 int8_t rate;
586 float progress;
587};
588
590struct LIBSPADES_PACKED PacketIntelCapture {
591 uint8_t packetID;
592 uint8_t playerID;
593 uint8_t winning;
597};
598
600struct LIBSPADES_PACKED PacketIntelPickup {
601 uint8_t packetID;
602 uint8_t playerID;
603};
604
606struct LIBSPADES_PACKED PacketIntelDrop {
607 uint8_t packetID;
608 uint8_t playerID;
609 Vector3Float position;
610};
611
613struct LIBSPADES_PACKED PacketRestock {
614 uint8_t packetID;
615 uint8_t playerID;
616};
617
619struct LIBSPADES_PACKED PacketFogColour {
620 uint8_t packetID;
625 uint8_t a;
627 uint8_t b;
628 uint8_t g;
629 uint8_t r;
630};
631
636struct LIBSPADES_PACKED PacketWeaponReload {
637 uint8_t packetID;
638 uint8_t playerID;
639 uint8_t magazineAmmo;
640 uint8_t reserveAmmo;
641};
642
644struct LIBSPADES_PACKED PacketChangeTeam {
645 uint8_t packetID;
649 uint8_t playerID;
650 uint8_t teamID;
654};
655
657struct LIBSPADES_PACKED PacketChangeWeapon {
658 uint8_t packetID;
664 uint8_t playerID;
665 uint8_t weaponID;
671};
672
676struct LIBSPADES_PACKED PacketMapCached {
677 uint8_t packetID;
678 uint8_t cached;
679};
680
681/* extension packet structs */
682
684struct LIBSPADES_PACKED ExtensionInfoEntry {
685 uint8_t extensionID;
687};
688
693struct LIBSPADES_PACKED PacketExtensionInfo {
694 uint8_t packetID;
695 uint8_t length;
696 struct ExtensionInfoEntry entries[VARIABLE_LENGTH];
698};
699
706struct LIBSPADES_PACKED PacketHandShakeInit {
707 uint8_t packetID;
708 uint32_t challenge;
710};
711
718struct LIBSPADES_PACKED PacketHandShakeReturn { /* just a copy of PacketHandShakeInit but whatever */
719 uint8_t packetID;
720 uint32_t challenge;
722};
723
733struct LIBSPADES_PACKED PacketVersionRequest {
734 uint8_t packetID;
735};
736
748struct LIBSPADES_PACKED PacketVersionResponse {
749 uint8_t packetID;
750 char client;
759 uint8_t versionMajor;
760 uint8_t versionMinor;
762 char operatingSystemInfo[VARIABLE_LENGTH];
782};
783
785struct LIBSPADES_PACKED PacketPlayerProperties {
786 uint8_t packetID;
787 uint8_t subPacketID;
788 uint8_t playerID;
789 uint8_t HP;
790 uint8_t blocks;
791 uint8_t grenades;
792 uint8_t magazineAmmo;
793 uint8_t reserveAmmo;
794 uint32_t score;
795};
796
801struct LIBSPADES_PACKED PacketRequestAuthentication {
802 uint8_t packetID;
803 uint8_t subPacketID;
804};
805
807struct LIBSPADES_PACKED PacketEndAuthentication {
808 uint8_t packetID;
809 uint8_t subPacketID;
810 uint8_t success;
811 char permissionLevel[VARIABLE_LENGTH];
814};
815
817struct LIBSPADES_PACKED PacketSendPublicKey {
818 uint8_t packetID;
819 uint8_t subPacketID;
820 uint8_t publicKey[32];
821};
822
827struct LIBSPADES_PACKED PacketSendNonce {
828 uint8_t packetID;
829 uint8_t subPacketID;
830 uint8_t nonce[VARIABLE_LENGTH];
831};
832
834struct LIBSPADES_PACKED PacketSendSignature {
835 uint8_t packetID;
836 uint8_t subPacketID;
837 uint8_t signature[64];
838};
839
840#ifndef PACK_GCC
841#pragma pack(pop)
842#endif
843
844enum PacketType {
845 PacketTypePositionData = 0, /* Client<->Server */
846 PacketTypeOrientationData = 1, /* usually Client-->Server, but Client<->Server is possible */
847 PacketTypeWorldUpdate = 2, /* Client<--Server */
848 PacketTypeInputData = 3, /* Client<->Server */
849 PacketTypeWeaponInput = 4, /* Client<->Server */
850 PacketTypeHit = 5, /* Client-->Server */
851 PacketTypeSetHP = 5, /* Client<--Server */
852 PacketTypeGrenade = 6, /* Client<->Server */
853 PacketTypeSetTool = 7, /* Client<->Server */
854 PacketTypeSetColour = 8, /* Client<->Server */
855 PacketTypeExistingPlayer = 9, /* Client<->Server */
856 PacketTypeShortPlayerData = 10, /* Client---Server */
857 PacketTypeMoveObject = 11, /* Client<--Server */
858 PacketTypeCreatePlayer = 12, /* Client<--Server */
859 PacketTypeBlockAction = 13, /* Client<->Server */
860 PacketTypeBlockLine = 14, /* Client<->Server */
861 PacketTypeStateData = 15, /* Client<--Server */
862 PacketTypeKillAction = 16, /* Client<--Server */
863 PacketTypeChatMessage = 17, /* Client<->Server */
864 PacketTypeMapStart = 18, /* Client<--Server */
865 PacketTypeMapChunk = 19, /* Client<--Server */
866 PacketTypePlayerLeft = 20, /* Client<--Server */
867 PacketTypeTerritoryCapture = 21, /* Client<--Server */
868 PacketTypeProgressBar = 22, /* Client<--Server */
869 PacketTypeIntelCapture = 23, /* Client<--Server */
870 PacketTypeIntelPickup = 24, /* Client<--Server */
871 PacketTypeIntelDrop = 25, /* Client<--Server */
872 PacketTypeRestock = 26, /* Client<--Server */
873 PacketTypeFogColour = 27, /* Client<--Server */
874 PacketTypeWeaponReload = 28, /* Client<->Server */
875 PacketTypeChangeTeam = 29, /* Client-->Server */
876 PacketTypeChangeWeapon = 30, /* Client<->Server */
877 PacketTypeMapCached = 31, /* Client-->Server */
878
879 /* extension packets. NOTE: for most servers, you must complete the
880 HandShakeInit and Return to gain access to extensions. */
881 PacketTypeHandShakeInit = 31, /* Client<--Server */
882 PacketTypeHandShakeReturn = 32, /* Client-->Server */
883 PacketTypeVersionRequest = 33,
884 /* Client<--Server */ /* sent before extension info is provided */
885 PacketTypeVersionResponse = 34,
886 /* Client-->Server */ /* sendable before extension info is provided */
887
888 PacketTypeExtensionInfo = 60, /* Client<->Server */
889
890 PacketTypePlayerProperties = 64,
891 PacketTypeEd25519Authentication = 65
892 /* I wonder if it would just be better to have all the subpackets for this? */
893};
894
895enum SubPacketType {
896 /* PacketTypePlayerProperties */
897 SubPacketTypePlayerProperties = 0, /* Client<--Server */
898
899 /* PacketTypeEd25519Authentication */
900 SubPacketTypeRequestAuthentication = 0, /* Client<--Server */
901 SubPacketTypeEndAuthentication = 1, /* Client<--Server */
902 SubPacketTypeSendPublicKey = 2, /* Client-->Server */
903 SubPacketTypeSendNonce = 3, /* Client<--Server */
904 SubPacketTypeSendSignature = 4 /* Client-->Server */
905};
906
907enum WeaponType { WeaponTypeRifle = 0, WeaponTypeSMG = 1, WeaponTypeShotgun = 2 };
908
909enum BlockActionType {
910 BlockActionTypeBuild = 0,
911 BlockActionTypeSpadeGunDestroy = 1,
912 BlockActionTypeSpadeSecondaryDestroy = 2,
913 BlockActionTypeGrenadeDestroy = 3
914};
915
916enum HurtType { HurtTypeFall = 0, HurtTypeWeapon = 1 };
917
918enum ChatType { ChatTypeAll = 0, ChatTypeTeam = 1, ChatTypeSystem = 2 };
919
920/* Might or might not want to use the defines instead in new things. Probably doesn't matter too much.
921 * The defines are there since enum uses signed int, which does not work for the CRC32.
922 */
923enum ProtocolVersion { ProtocolVersion75 = 3, ProtocolVersion76 = 4 };
924
925#define LIBSPADES_PROTOCOL_VERSION_10 0
926#define LIBSPADES_PROTOCOL_VERSION_21 0
927#define LIBSPADES_PROTOCOL_VERSION_22 0
928/* Most of these are a CRC32 of client.exe */
929#define LIBSPADES_PROTOCOL_VERSION_26 0x40950dbb
930#define LIBSPADES_PROTOCOL_VERSION_30 0x7965ce91
931#define LIBSPADES_PROTOCOL_VERSION_31 0x7965ce91
932#define LIBSPADES_PROTOCOL_VERSION_32 0x7a8660d4
933#define LIBSPADES_PROTOCOL_VERSION_33 0x709cc6e3
934#define LIBSPADES_PROTOCOL_VERSION_35 0xf39348d7
935#define LIBSPADES_PROTOCOL_VERSION_36 0x4da4f41e
936#define LIBSPADES_PROTOCOL_VERSION_40 0xa3937cd0
937#define LIBSPADES_PROTOCOL_VERSION_41 0xa3937cd0
938#define LIBSPADES_PROTOCOL_VERSION_42 0x09e3c405
939#define LIBSPADES_PROTOCOL_VERSION_46 0x0e240254
940#define LIBSPADES_PROTOCOL_VERSION_47 0x9217d00e
941#define LIBSPADES_PROTOCOL_VERSION_48 0x187532bf
942#define LIBSPADES_PROTOCOL_VERSION_49 0xb2aa66f5
943#define LIBSPADES_PROTOCOL_VERSION_50 0x1fcb39d1
944#define LIBSPADES_PROTOCOL_VERSION_51 0x679b3c4d
945#define LIBSPADES_PROTOCOL_VERSION_52 0x9c8791f8
946#define LIBSPADES_PROTOCOL_VERSION_53 0x2aecbe65
947#define LIBSPADES_PROTOCOL_VERSION_54 0x4e849539
948#define LIBSPADES_PROTOCOL_VERSION_55 0x20791226
949#define LIBSPADES_PROTOCOL_VERSION_58 0xad004b4e
950#define LIBSPADES_PROTOCOL_VERSION_60_009 0x75894111
951#define LIBSPADES_PROTOCOL_VERSION_60_010 0xc7e8dab2
952#define LIBSPADES_PROTOCOL_VERSION_60_011 0xea5e9039
953#define LIBSPADES_PROTOCOL_VERSION_60_014 0x607521b0
954#define LIBSPADES_PROTOCOL_VERSION_60 LIBSPADES_PROTOCOL_VERSION_60_014
955#define LIBSPADES_PROTOCOL_VERSION_61_004 0x16165bae
956#define LIBSPADES_PROTOCOL_VERSION_61_005 0x8ab03b5f
957#define LIBSPADES_PROTOCOL_VERSION_61_006 0x9e592202
958#define LIBSPADES_PROTOCOL_VERSION_61 LIBSPADES_PROTOCOL_VERSION_61_006
959#define LIBSPADES_PROTOCOL_VERSION_62_003 0x13575615
960#define LIBSPADES_PROTOCOL_VERSION_62_006 0x3da3f698
961#define LIBSPADES_PROTOCOL_VERSION_62 LIBSPADES_PROTOCOL_VERSION_62_006
962#define LIBSPADES_PROTOCOL_VERSION_70_008 0x9f4fe987
963#define LIBSPADES_PROTOCOL_VERSION_70_009 0x7a4139b6
964#define LIBSPADES_PROTOCOL_VERSION_70_012 0xb0525b7e
965/* No idea where this number came from. Not a CRC32 of that version's client.exe, anyway. */
966#define LIBSPADES_PROTOCOL_VERSION_70_017 0xdc05cbda
967#define LIBSPADES_PROTOCOL_VERSION_70 LIBSPADES_PROTOCOL_VERSION_70_017
968#define LIBSPADES_PROTOCOL_VERSION_75_003 1
969#define LIBSPADES_PROTOCOL_VERSION_75_004 1
970#define LIBSPADES_PROTOCOL_VERSION_75_007 1
971#define LIBSPADES_PROTOCOL_VERSION_75_009 1
972#define LIBSPADES_PROTOCOL_VERSION_75_010 2
973#define LIBSPADES_PROTOCOL_VERSION_75_011 2
974#define LIBSPADES_PROTOCOL_VERSION_75_013 3
975#define LIBSPADES_PROTOCOL_VERSION_75_015 3
976#define LIBSPADES_PROTOCOL_VERSION_75 LIBSPADES_PROTOCOL_VERSION_75_015
977#define LIBSPADES_PROTOCOL_VERSION_76_010 4
978#define LIBSPADES_PROTOCOL_VERSION_76 LIBSPADES_PROTOCOL_VERSION_76_010
979
980enum ItemType {
981 ItemTypeSpade = 0,
982 ItemTypeBlock = 1,
983 ItemTypeGun = 2,
984 ItemTypeGrenade = 3
985}; /* FIXME: disambiguate item/tool */
986
987enum KillType {
988 KillTypeWeapon = 0,
989 KillTypeHeadshot = 1,
990 KillTypeMelee = 2,
991 KillTypeGrenade = 3,
992 KillTypeFall = 4,
993 KillTypeTeamChange = 5,
994 KillTypeClassChange = 6 /* FIXME: weapon change? */
995};
996
997enum WeaponInputType { WeaponInputTypePrimary = 1, WeaponInputTypeSecondary = 2 };
998
999enum HitType { HitTypeTorso = 0, HitTypeHead = 1, HitTypeArms = 2, HitTypeLegs = 3, HitTypeMelee = 4 };
1000
1001enum KeyStateType {
1002 KeyStateTypeForward = 1,
1003 KeyStateTypeBackward = 2,
1004 KeyStateTypeLeft = 4,
1005 KeyStateTypeRight = 8,
1006 KeyStateTypeJump = 16,
1007 KeyStateTypeCrouch = 32,
1008 KeyStateTypeSneak = 64,
1009 KeyStateTypeSprint = 128
1010};
1011
1014enum ExtensionID {
1015 /* Extensions with packets */
1016 ExtensionIDPlayerProperties = 0,
1019 ExtensionIDEd25519Authentication = 1,
1021
1022 /* Extensions without packets */
1023 ExtensionID256Players = 192,
1024 ExtensionIDMessageTypes = 193,
1026 ExtensionIDKickReason = 194
1029};
1030
1031enum MagazineAmmoSize { MagazineAmmoSizeRifle75 = 10, MagazineAmmoSizeSMG75 = 30, MagazineAmmoSizeShotgun75 = 6 };
1032
1033enum ReserveAmmoSize { ReserveAmmoSizeRifle75 = 50, ReserveAmmoSizeSMG75 = 120, ReserveAmmoSizeShotgun75 = 48 };
1034
1035enum FireDelayMilliseconds {
1036 FireDelayMillisecondsRifle75 = 500,
1037 FireDelayMillisecondsSMG75 = 100,
1038 FireDelayMillisecondsShotgun75 = 1000
1039};
1040
1041enum PelletQuantity { PelletQuantityRifle75 = 1, PelletQuantitySMG75 = 1, PelletQuantityShotgun75 = 8 };
1042
1043enum GamemodeType { GamemodeTypeCTF = 0, GamemodeTypeTC = 1 };
1044
1045#ifdef __cplusplus
1046}
1047#endif
1048#endif
State data for the Capture-the-Flag gamemode.
Definition protocol.h:428
union IntelLocation team1Intel
The location of the first team's intel.
Definition protocol.h:439
uint8_t team2Score
The score (captures) of the second team.
Definition protocol.h:430
uint8_t heldIntels
Which teams have a player holding their intel.
Definition protocol.h:433
uint8_t captureLimit
The score that needs to be reached to finish the game.
Definition protocol.h:431
Vector3Float team1TentPosition
The position of the first team's tent.
Definition protocol.h:445
Vector3Float team2TentPosition
The position of the second team's tent.
Definition protocol.h:446
union IntelLocation team2Intel
The location of the second team's intel.
Definition protocol.h:442
uint8_t team1Score
The score (captures) of the first team.
Definition protocol.h:429
Extension entries for PacketExtensionInfo.
Definition protocol.h:684
uint8_t extensionVersion
The extension's version.
Definition protocol.h:686
uint8_t extensionID
The extension's ID.
Definition protocol.h:685
Definition protocol.h:416
Creates or destroys blocks.
Definition protocol.h:353
int32_t yPosition
The Y position of the block (forward-to-backward)
Definition protocol.h:378
uint8_t actionType
The action to be performed on the block.
Definition protocol.h:357
uint8_t playerID
The ID of the player who created/destroyed the block(s)
Definition protocol.h:355
int32_t zPosition
The Z position of the block (up-to-down)
Definition protocol.h:379
uint8_t packetID
13 (Client<->Server)
Definition protocol.h:354
int32_t xPosition
The X position of the block (left-to-right)
Definition protocol.h:377
Makes a line of blocks.
Definition protocol.h:402
uint32_t endYPosition
The Y position of the end point (forward-to-backward)
Definition protocol.h:411
uint32_t startXPosition
The X position of the start point (left-to-right)
Definition protocol.h:405
uint8_t packetID
14 (Client<->Server)
Definition protocol.h:403
uint32_t startYPosition
The Y position of the start point (forward-to-backward)
Definition protocol.h:407
uint8_t playerID
The ID of the player who made the block line.
Definition protocol.h:404
uint32_t startZPosition
The Z position of the start point (up-to-down)
Definition protocol.h:409
uint32_t endXPosition
The X position of the end point (left-to-right)
Definition protocol.h:410
uint32_t endZPosition
The Z position of the end point (up-to-down)
Definition protocol.h:413
Changes a player's team.
Definition protocol.h:644
uint8_t teamID
The team the player is changing to.
Definition protocol.h:650
uint8_t playerID
The ID of the player who is changing team.
Definition protocol.h:649
uint8_t packetID
29 (Client-->Server*) *OpenSpades supports receiving this packet, just with a very glitchy outcome.
Definition protocol.h:645
Changes a player's weapon.
Definition protocol.h:657
uint8_t packetID
30 (Client<->Server*)
Definition protocol.h:658
uint8_t playerID
The ID of the player who is changing weapon.
Definition protocol.h:664
uint8_t weaponID
The weapon the player is changing to.
Definition protocol.h:665
Sends a message in chat.
Definition protocol.h:524
uint8_t type
The type of message.
Definition protocol.h:527
uint8_t packetID
17 (Client<->Server)
Definition protocol.h:525
uint8_t playerID
The ID of the player who sent the message.
Definition protocol.h:526
char message[VARIABLE_LENGTH]
The contents of the chat message.
Definition protocol.h:533
Spawns and changes properties of a player.
Definition protocol.h:334
float xPosition
The X position of the player (left-to-right)
Definition protocol.h:339
float zPosition
The Z position to move the client player (up-to-down)
Definition protocol.h:342
char name[16]
The name of the player.
Definition protocol.h:344
uint8_t team
The player's team.
Definition protocol.h:338
uint8_t playerID
The ID of the player to spawn/modify.
Definition protocol.h:336
uint8_t packetID
12 (Client<--Server)
Definition protocol.h:335
float yPosition
The Y position to move the client player (forward-to-backward)
Definition protocol.h:340
uint8_t weapon
The player's weapon.
Definition protocol.h:337
Ends the authentication transaction and tells the client its permission level.
Definition protocol.h:807
uint8_t success
Equal to 1 if the client was successfully authenticated.
Definition protocol.h:810
char permissionLevel[VARIABLE_LENGTH]
NULL-terminated string encoded with UTF-8 that contains the permission level granted.
Definition protocol.h:811
uint8_t packetID
65
Definition protocol.h:808
uint8_t subPacketID
1 (Client<--Server)
Definition protocol.h:809
Informs the client of in-game players and the server of the joining client player.
Definition protocol.h:257
uint8_t blue
The blue colour value of the player's block.
Definition protocol.h:277
uint8_t green
The green colour value of the player's block.
Definition protocol.h:278
uint8_t team
The team of the player.
Definition protocol.h:260
uint32_t kills
The amount of points the player has.
Definition protocol.h:275
char name[16]
The name of the player.
Definition protocol.h:280
uint8_t playerID
The ID of the player.
Definition protocol.h:259
uint8_t red
The red colour value of the player's block.
Definition protocol.h:279
uint8_t weapon
The weapon of the player.
Definition protocol.h:262
uint8_t item
The held item of the player.
Definition protocol.h:268
uint8_t packetID
9 (Client<->Server)
Definition protocol.h:258
Tells the peer (client or server) about supported extensions to the AoS protocol.
Definition protocol.h:693
struct ExtensionInfoEntry entries[VARIABLE_LENGTH]
The list of supported extensions and their versions.
Definition protocol.h:696
uint8_t length
The amount of supported extensions.
Definition protocol.h:695
uint8_t packetID
60 (Client<->Server)
Definition protocol.h:694
Changes the colour of the fog.
Definition protocol.h:619
uint8_t packetID
27 (Client<--Server*)
Definition protocol.h:620
uint8_t g
The green colour value of the fog.
Definition protocol.h:628
uint8_t b
The blue colour value of the fog.
Definition protocol.h:627
uint8_t r
The red colour value of the fog.
Definition protocol.h:629
uint8_t a
The alpha colour value of the fog.
Definition protocol.h:625
Creates a grenade somewhere in the world.
Definition protocol.h:202
uint8_t playerID
The ID of the player who threw the grenade.
Definition protocol.h:204
float yVelocity
The Y velocity of the grenade (forward-to-backward)
Definition protocol.h:217
float xVelocity
The X velocity of the grenade (left-to-right)
Definition protocol.h:216
uint8_t packetID
6 (Client<->Server)
Definition protocol.h:203
float yPosition
The Y position to spawn the grenade (forward-to-backward)
Definition protocol.h:213
float fuseLength
The time in seconds from grenade creation until it detonates.
Definition protocol.h:205
float zVelocity
The Z velocity of the grenade (up-to-down)
Definition protocol.h:218
float zPosition
The Z position to spawn the grenade (up-to-down)
Definition protocol.h:215
float xPosition
The X position to spawn the grenade (left-to-right)
Definition protocol.h:212
A packet that must usually be answered with PacketHandShakeReturn to gain access to extensions.
Definition protocol.h:706
uint32_t challenge
4 bytes that must be copied over to the return packet.
Definition protocol.h:708
uint8_t packetID
31 (Client<--Server)
Definition protocol.h:707
The packet used to answer PacketHandShakeInit.
Definition protocol.h:718
uint8_t packetID
32 (Client-->Server)
Definition protocol.h:719
uint32_t challenge
4 bytes that must be copied over from the init packet.
Definition protocol.h:720
Tells the server that a player has been hit.
Definition protocol.h:156
uint8_t hitType
Where/how the player has been hit.
Definition protocol.h:159
uint8_t packetID
5 (Client-->Server)
Definition protocol.h:157
uint8_t playerID
The ID of the player who has been hit.
Definition protocol.h:158
Changes the movement inputs of a player.
Definition protocol.h:127
uint8_t packetID
3 (Client<->Server)
Definition protocol.h:128
uint8_t playerID
The ID of the player whose movement is changing.
Definition protocol.h:129
uint8_t keyStates
What movement is taking place.
Definition protocol.h:130
Informs the client that a player has captured their enemy's intel.
Definition protocol.h:590
uint8_t packetID
23 (Client<--Server)
Definition protocol.h:591
uint8_t playerID
The ID of the player who has captured the intel.
Definition protocol.h:592
uint8_t winning
Whether the capture was the last needed to end the game.
Definition protocol.h:593
Informs the client that a player has dropped their enemy's intel.
Definition protocol.h:606
uint8_t playerID
The ID of the player who has dropped the intel.
Definition protocol.h:608
uint8_t packetID
25 (Client<--Server)
Definition protocol.h:607
Vector3Float position
The position of the intel.
Definition protocol.h:609
Informs the client that a player has picked up their enemy's intel.
Definition protocol.h:600
uint8_t playerID
The ID of the player who has picked up the intel.
Definition protocol.h:602
uint8_t packetID
24 (Client<--Server)
Definition protocol.h:601
Informs the client about the death of a player.
Definition protocol.h:498
uint8_t killType
How the player died.
Definition protocol.h:502
uint8_t respawnTime
The time in seconds until the player respawns.
Definition protocol.h:516
uint8_t playerID
The ID of the player who died.
Definition protocol.h:500
uint8_t killerID
The ID of the killer.
Definition protocol.h:501
uint8_t packetID
16 (Client<--Server)
Definition protocol.h:499
From protocol v0.76.
Definition protocol.h:676
uint8_t cached
Whether the map is stored in the client's cache or not.
Definition protocol.h:678
uint8_t packetID
31 (Client-->Server)
Definition protocol.h:677
Contains chunks of compressed map data.
Definition protocol.h:558
uint8_t mapData[VARIABLE_LENGTH]
The chunk of compressed map data.
Definition protocol.h:560
uint8_t packetID
19 (Client<--Server)
Definition protocol.h:559
A slightly more useful v0.76 equivalent of PacketMapStart.
Definition protocol.h:547
uint32_t crc32
Presumably the CRC32 code for the decompressed map.
Definition protocol.h:550
uint8_t packetID
18 (Client<--Server)
Definition protocol.h:548
uint32_t mapSize
The compressed map size in bytes.
Definition protocol.h:549
char mapName[16]
The name of the map.
Definition protocol.h:552
A seemingly useless packet to signify the start of the map download.
Definition protocol.h:540
uint8_t packetID
18 (Client<--Server)
Definition protocol.h:541
uint32_t mapSize
The size of the zlib stream in bytes.
Definition protocol.h:542
Moves objects.
Definition protocol.h:323
uint8_t packetID
11 (Client<--Server)
Definition protocol.h:324
Changes the orientation of the client player.
Definition protocol.h:83
float xOrientation
The X orientation to rotate the client player.
Definition protocol.h:87
float yOrientation
The Y orientation to rotate the client player.
Definition protocol.h:88
uint8_t packetID
1 (Client<->Server)*
Definition protocol.h:84
float zOrientation
The Z orientation to rotate the client player.
Definition protocol.h:89
Informs the client that a player has left the game.
Definition protocol.h:565
uint8_t packetID
20 (Client<--Server)
Definition protocol.h:566
uint8_t playerID
The ID of the player who left.
Definition protocol.h:567
Informs the client about stats of a player.
Definition protocol.h:785
uint8_t grenades
The amount of grenades the player has.
Definition protocol.h:791
uint8_t playerID
The ID of the player to inform the client about.
Definition protocol.h:788
uint8_t magazineAmmo
The amount of magazine ammunition the player has.
Definition protocol.h:792
uint8_t blocks
The amount of blocks the player has.
Definition protocol.h:790
uint8_t HP
The HP of the player.
Definition protocol.h:789
uint8_t reserveAmmo
The amount of reserve ammunition the player has.
Definition protocol.h:793
uint32_t score
The score the player has.
Definition protocol.h:794
uint8_t subPacketID
0 (Client<--Server)
Definition protocol.h:787
uint8_t packetID
64
Definition protocol.h:786
Changes the position of the client player.
Definition protocol.h:42
float zPosition
The Z position to move the client player (up-to-down)
Definition protocol.h:48
uint8_t packetID
0 (Client<->Server)
Definition protocol.h:43
float yPosition
The Y position to move the client player (forward-to-backward)
Definition protocol.h:46
float xPosition
The X position to move the client player (left-to-right)
Definition protocol.h:44
Definition protocol.h:581
uint8_t packetID
22 (Client<--Server)
Definition protocol.h:582
Requests the client to start an authentication transaction.
Definition protocol.h:801
uint8_t packetID
65
Definition protocol.h:802
uint8_t subPacketID
0 (Client<--Server)
Definition protocol.h:803
Informs the client that a player has restocked.
Definition protocol.h:613
uint8_t playerID
The ID of the player who has restocked.
Definition protocol.h:615
uint8_t packetID
26 (Client<--Server)
Definition protocol.h:614
Sends the client a nonce to sign after receiving its public key.
Definition protocol.h:827
uint8_t packetID
65
Definition protocol.h:828
uint8_t nonce[VARIABLE_LENGTH]
Data to be signed with the client's secret key.
Definition protocol.h:830
uint8_t subPacketID
3 (Client<--Server)
Definition protocol.h:829
Sends the clients's public key to the server in response to the request for authentication.
Definition protocol.h:817
uint8_t packetID
65
Definition protocol.h:818
uint8_t publicKey[32]
Ed25519 public key to be used for authentication.
Definition protocol.h:820
uint8_t subPacketID
2 (Client-->Server)
Definition protocol.h:819
Sends the server back the nonce sent the client, signed with the client's secret key.
Definition protocol.h:834
uint8_t packetID
65
Definition protocol.h:835
uint8_t signature[64]
The nonce sent by the server, signed with the client's secret key.
Definition protocol.h:837
uint8_t subPacketID
4 (Client-->Server)
Definition protocol.h:836
Changes the block colour of a player.
Definition protocol.h:237
uint8_t red
The red colour value of the player's block.
Definition protocol.h:246
uint8_t blue
The blue colour value of the player's block.
Definition protocol.h:240
uint8_t green
The green colour value of the player's block.
Definition protocol.h:245
uint8_t playerID
The ID of the player whose block colour has changed.
Definition protocol.h:239
uint8_t packetID
8 (Client<->Server)
Definition protocol.h:238
Changes the client player's HP.
Definition protocol.h:170
uint8_t HP
The amount of HP to change the client player to.
Definition protocol.h:172
uint8_t packetID
5 (Client<--Server)
Definition protocol.h:171
float sourceX
The X position of the damage source (left-to-right)
Definition protocol.h:178
uint8_t type
The reason for the damage.
Definition protocol.h:173
float sourceZ
The Z position of the damage source (up-to-down)
Definition protocol.h:181
float sourceY
The Y position of the damage source (forward-to-backward)
Definition protocol.h:179
Changes the held tool of a player.
Definition protocol.h:222
uint8_t tool
The held tool.
Definition protocol.h:225
uint8_t packetID
7 (Client<->Server)
Definition protocol.h:223
uint8_t playerID
The ID of the player whose held tool has changed.
Definition protocol.h:224
Switches the client player's team/weapon from spectator mode.
Definition protocol.h:310
uint8_t playerID
The ID of the player who changed weapon/team.
Definition protocol.h:312
uint8_t team
The team to switch the player to.
Definition protocol.h:318
uint8_t packetID
10 (Client-->Server)
Definition protocol.h:311
uint8_t weapon
The weapon to switch the player to.
Definition protocol.h:319
Contains information about the game's state and the client player's ID.
Definition protocol.h:475
uint8_t team1_b
The blue colour value of the first team.
Definition protocol.h:481
union GamemodeData gamemodeData
The data for the gamemode's state.
Definition protocol.h:494
uint8_t team1_r
The red colour value of the first team.
Definition protocol.h:483
char team2Name[10]
The name of the second team.
Definition protocol.h:488
uint8_t team2_b
The blue colour value of the second team.
Definition protocol.h:484
uint8_t team2_g
The green colour value of the second team.
Definition protocol.h:485
uint8_t fog_g
The green colour value of the fog.
Definition protocol.h:479
uint8_t team2_r
The red colour value of the second team.
Definition protocol.h:486
uint8_t fog_r
The red colour value of the fog.
Definition protocol.h:480
uint8_t gamemode
The gamemode.
Definition protocol.h:489
uint8_t team1_g
The green colour value of the first team.
Definition protocol.h:482
uint8_t packetID
15 (Client<--Server)
Definition protocol.h:476
uint8_t playerID
The ID of the client player.
Definition protocol.h:477
uint8_t fog_b
The blue colour value of the fog.
Definition protocol.h:478
char team1Name[10]
The name of the first team.
Definition protocol.h:487
Informs the client that a territory has been captured.
Definition protocol.h:571
uint8_t packetID
21 (Client<--Server)
Definition protocol.h:572
uint8_t territoryID
Corresponds to territory index in StateData.
Definition protocol.h:573
uint8_t team
The team which captured the territory.
Definition protocol.h:575
uint8_t winning
Whether the capture was the last needed to end the game.
Definition protocol.h:574
Requests client information from the client if the Hand Shake was completed (if supported).
Definition protocol.h:733
uint8_t packetID
33 (Client<--Server)
Definition protocol.h:734
Informs the server about the details of the client.
Definition protocol.h:748
char operatingSystemInfo[VARIABLE_LENGTH]
A string intended to contain the operating system the client is running on.
Definition protocol.h:762
uint8_t versionMajor
The major version of the client.
Definition protocol.h:759
char client
A single byte used to identify the client.
Definition protocol.h:750
uint8_t versionMinor
The minor version of the client.
Definition protocol.h:760
uint8_t versionRevision
The revision of the client.
Definition protocol.h:761
uint8_t packetID
34 (Client-->Server)
Definition protocol.h:749
Changes the weapon inputs of a player.
Definition protocol.h:145
uint8_t playerID
The ID of the player whose weapon input is changing.
Definition protocol.h:147
uint8_t packetID
4 (Client<->Server)
Definition protocol.h:146
uint8_t weaponInput
The weapon input state.
Definition protocol.h:148
Informs the client that a player has reloaded their weapon.
Definition protocol.h:636
uint8_t reserveAmmo
The reserve ammunition count of the player who has reloaded.
Definition protocol.h:640
uint8_t packetID
28 (Client<->Server)
Definition protocol.h:637
uint8_t magazineAmmo
The magazine (in-gun) ammunition count of the player who has reloaded.
Definition protocol.h:639
uint8_t playerID
The ID of the player who has reloaded.
Definition protocol.h:638
Regularly sent packet containing positions and orientations of all players.
Definition protocol.h:117
struct PlayerPositionData players[MAX_PLAYERS]
Contains the actual data.
Definition protocol.h:119
uint8_t packetID
2 (Client<--Server)
Definition protocol.h:118
Definition protocol.h:101
Definition protocol.h:92
State data for the Territorial Control gamemode.
Definition protocol.h:458
struct Territory territories[16]
The territories.
Definition protocol.h:460
uint8_t territoryCount
The quantity of territories in the game.
Definition protocol.h:459
Definition protocol.h:449
float yPosition
The Y position of the territory (forward-to-backward)
Definition protocol.h:451
float zPosition
The Z position of the territory (up-to-down)
Definition protocol.h:453
float xPosition
The X position of the territory (left-to-right)
Definition protocol.h:450
uint8_t team
The team of the territory.
Definition protocol.h:454
A union that contains the possible gamemodes for PacketStateData.
Definition protocol.h:467
struct CTFStateData ctfStateData
Capture-the-Flag mode.
Definition protocol.h:468
struct TCStateData tcStateData
Territorial Control mode.
Definition protocol.h:469
Definition protocol.h:422
uint8_t playerID
The ID of the player carrying the intel if any.
Definition protocol.h:423
Vector3Float position
The position of the intel if no player is carrying it.
Definition protocol.h:424