Skip to content

Instantly share code, notes, and snippets.

@FireyFly
Created August 4, 2015 21:12
Show Gist options
  • Save FireyFly/a7e4ee3099f8679fcb91 to your computer and use it in GitHub Desktop.
Save FireyFly/a7e4ee3099f8679fcb91 to your computer and use it in GitHub Desktop.
Hockey? protocol
struct hock_header {
uint32_t magic; /* 0x6b636f48 = 'Hock' */
uint8_t command;
} __attribute__((packed));
struct hock_01 { /* server status request/response */
uint8_t version;
uint32_t timestamp;
uint8_t players;
uint8_t gamemode;
char name[32];
} __attribute__((packed));
struct hock_02 { /* join server */
uint8_t version;
char nick[32];
} __attribute__((packed));
struct hock_04 { /* client-to-server update */
uint32_t my_id;
float blade_angle; /* ±1.00 (step 0.2) */
float move_x; /* -1, +1 */
float unk1;
float move_y; /* -1, +1 */
float stick_x; /* ±π/2 */
float stick_y; /* ~ -1..+0.4 */
float head_x; /* ±2.75 */
float head_y; /* ±π/2 */
uint32_t buttons; /* bitmask: 01: space (jump); 02: ctrl (fall); 04: 1 (join red); */
/* 08: 2 (join blue); 10: shift (slow down); 20: 0 (leave team) */
uint32_t time_played; /* unit: ?? */
} __attribute__((packed));
struct hock_05 { /* server-to-client update */
uint32_t my_id;
uint32_t unk2;
uint8_t blue_score; /* ×2 */
uint8_t red_score; /* ×2 */
uint32_t time_left; /* unit: 200s of a second */
uint16_t period; /* ×2 */
uint8_t unk6;
uint32_t msgid;
uint32_t parid;
} __attribute__((packed));
struct hock_06 {
uint32_t my_id;
} __attribute__((packed));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment