ngspades-client Checklist
This is a checklist for people writing a client of Ace of Spades: the classic 0.75 and 0.76 protocol, the community's 0.75 extensions, and the 1.0 protocol of ngspades-server. It is written in the spirit of the AoS 0.75.015 Canon Client Doc: a numbered list of requirements, each testable, each with a line on what breaks if you skip it. It says what a client must do and links to the protocol documentation for where each packet is specified, so it does not repeat the packet tables.
A-NET-1), a Why line, a Check line and the status of ngspades-client in the conformance matrix (section H). The document describes behaviour you can observe on the wire; where it names a number, it came from the public protocol pages or the public server.Parts. A: protocol 0.75 and 0.76. B: the 0.75 extensions. C: protocol 1.0. D: server lists and queries. E: optional improvements of ngspades-client. F: reference tables (CP437, palette). G: how to test. H: the conformance matrix.
A. Protocol 0.75 and 0.76
The classic wire, spoken by every public Ace of Spades server. 0.76 changes three things, marked [0.76] below. The packets themselves are specified in the protocol 0.75 page, and this part says what a client has to do with them.
A.1 Transport
A-NET-1Connect with ENet 1.3, one channel, range codersupported
enet_host_compress_with_range_coder) before connecting. The default port is 32887. See Connection.Why: Servers compress every packet with ENet's range coder; a host without it cannot read a single one.
Check: Connect to a 0.75 server and log the first Map Start (id 18).
A-NET-2Pick the protocol with the connect datasupported
3 for 0.75 and 4 for 0.76. A client that speaks both SHOULD try one, and on reason 3 (or 11) try the other.Why: A wrong value is answered with disconnect reason 3 and nothing else.
Check: Against a 0.76 server, connect data 3 must be refused with reason 3 or 11 and your client must retry with 4.
A-NET-3One game packet per ENet packet, one id byte firstin progress
Why: There is no length field; the ENet packet length is the framing.
Check: Feed a truncated packet of every id to the decoder; none may read past the end.
A-NET-4Everything reliable except World Updatesupported
World Update (id 2) as unreliable and every other id as reliable.Why: A lost reliable packet is resent; World Update is superseded by the next one, so resending it only adds delay.
Check: Capture your own traffic and confirm only id 2 is unreliable on the server's side.
A-NET-5Handle Map Start at any timesupported
Map Start (18) at any moment after the join, drop the current world and start the download again.Why: Servers change map mid-match; a client that only expects a map once stays on the old one.
Check: Run a server with a two-map rotation and end a round while connected.
A-ADDR-1Parse aos:// addresses as a little-endian integersupported
aos://ADDRESS[:PORT][SUFFIX]: ADDRESS is the IPv4 address as one decimal number whose low byte is the first octet. PORT defaults to 32887. A suffix such as :0.75 or /0.76 names a version; an unknown suffix means 0.75. A client SHOULD also accept a dotted address and a bare host:port. See About Addresses.Why: aos://16777343 is 127.0.0.1; reading the number big-endian gives 1.0.0.127.
Check: Parse aos://16777343:32887 and aos://16777343 (default port).
A-DISC-1Know the 0.75 disconnect reasons and show unknown ones as unknownpartial
The table below is the union of the public protocol page and the community's usage. A client MUST show a value it does not know as "unknown" and MUST NOT use it as an array index. A system Chat Message from player 255 sent just before the disconnect is the kick text and SHOULD be shown instead of the generic reason.
| Value | Meaning | Note |
|---|---|---|
| 0 | timeout / unspecified | ENet uses 0 for a timeout too |
| 1 | banned | |
| 2 | kicked | some servers use it for "too many connections from your address" |
| 3 | wrong protocol version | connect data was not 3 or 4 |
| 4 | server full | |
| 5 | server shutting down | |
| 8, 9, 10, 11 | banned, full, kicked, wrong version | the same, sent after the map download; Voxlap only knows 0..4 before it |
| 20 | invalid name | |
| 61 | server shutting down | alternative value |
Why: Reason 0 is also what ENet reports for a timeout, and some servers send values outside the table; indexing a message table with the raw value crashes.
Check: Make your server disconnect with 77 and with 0xFFFFFFFF.
A.2 Data conventions
A-TYPE-1Little-endian, packed, no paddingsupported
Why: Reading a struct straight from memory works until a compiler pads it or a big-endian host reads it.
Check: Round-trip every packet of the protocol page through your codec and compare bytes.
A-TYPE-2Colours are B, G, Rsupported
Terrain Update is the one place that uses R, G, B: see C-MAP-6.)Why: Swapped channels turn a red team blue and every block purple; the error is invisible in code review.
Check: Place a pure red block (255,0,0) and read it back from the server.
A-COORD-1Axes: x east, y south, z downsupported
512 x 512 x 64. z grows downwards: 0 is the top of the world, 63 is the bottom (water) layer. An engine with y up SHOULD convert only at the protocol boundary: engine = (x, 63 - z, y) and back (x, z, 63 - y) for positions. A look vector's oz is negative when looking up. See About Coordinates.Why: Every coordinate bug in this game is a mirrored z.
Check: Spawn, look straight up and check that oz is negative.
A-COORD-2Voxel from float: floor each axis; positions are the eyesupported
(0,0,0) is the corner of voxel (0,0,0) and (0.5,0.5,0.5) its centre. To get the voxel, floor each axis. A player's position is its eye. Models (players, tents, intels) are not wrapped; tents and intels sit on top of their z.Why: Rounding instead of flooring shifts every hit and every block by one half cell; and the player's position is the camera, not the feet.
Check: Stand on the centre of a block and compare the voxel you compute with the server's.
A-COORD-3Wrap the terrain for drawing, not for rulespartial
0..511 on x and y is drawn as a copy of the map (toroidal). Block placement, block destruction, block gravity and player movement MUST NOT wrap. Grenade physics MUST wrap. Cells with z >= 62 cannot be dug.Why: Players, block edits and block physics do not wrap; grenades do. Treating them alike lets a block be built on the far side of the map.
Check: Throw a grenade across x = 0 and place a block at x = −1 (the latter must be ignored).
A-TEXT-1Decode text as UTF-8 only after 0xFF, otherwise CP437partial
0xFF and is valid UTF-8 afterwards is UTF-8 (drop the 0xFF). Anything else is CP437 (table in section F.2). Do not write your own UTF-8 decoder: use the platform's, or a well-tested state machine, because a hand-rolled one tends to accept invalid sequences. NUL ends a string. See About Text.Why: Classic servers send CP437 bytes; newer ones send 0xFF followed by UTF-8. Treating CP437 as UTF-8 or the reverse corrupts every accent.
Check: Send 0xFF + é in UTF-8 and the single byte 0x82: both must show é.
A-TEXT-2Send CP437 when everything fits, 0xFF + UTF-8 only to a server that reads itsupported
0xFF + UTF-8, but only to a server known to read it: the server asked for the feature flags in an extended Version Get, or it sent a 0xFF line itself (B-UTF8-1).Why: A server that has never heard of UTF-8 shows the bytes as garbage.
Check: Send ação to a classic server (CP437) and to one that asked for feature flags (UTF-8).
A-TEXT-3Colour control bytes in chatin progress
0x01 team 1, 0x02 team 2, 0x03 spectators, 0x04 red, 0x05 green, 0x06 normal (white), 0x07 grey, 0x08 yellow. \n and \r break the line. Other bytes below 0x20 SHOULD be drawn as a replacement character. A colour byte MUST NOT change what you store as the player's name.Why: Real servers put these bytes in names and lines; a client that prints them verbatim shows boxes, one that mishandles them can recolour the whole screen.
Check: Feed lines with each of 0x01..0x08 and with \r and \n.
A.3 Joining
A-JOIN-1Follow the join ordersupported
client server
ENet connect (3 or 4) ---------------->
<----------------------- Map Start (18) [0.76: size + CRC32 + name]
<----------------------- Map Chunk (19) x N
<----------------------- Version Get (33), Handshake Init (31) (optional)
Version Send (34), Handshake Return (32) ->
<----------------------- Existing Player (9) x players already in
<----------------------- State Data (15) (download done)
Existing Player (9): team, weapon, name -> (team/weapon menu)
<----------------------- Create Player (12) (you spawn)
<----------------------- World Update (2) ... (the match)The client MUST append Map Chunk payloads until the byte count in Map Start is reached, inflate the zlib stream, load the VXL map only on State Data, then show the team menu. Chunks may be any size.
Why: State Data ends the download. Loading the map earlier, or opening the team menu before it, makes the player join a map that is not there yet.
Check: Log the packet ids of a join against a reference server and compare the order.
A-JOIN-2Join with Existing Player; accept Short Player Data on the server's side onlysupported
Existing Player (9) with your player id from State Data, team (0, 1, or 255 spectator), weapon (0 rifle, 1 SMG, 2 shotgun), tool = gun, zero kills, block colour and name. The server answers with Create Player (12). Short Player Data (10) is the older form; servers accept both. Changing team or weapon later uses Change Team (29) and Change Weapon (30); a team change is a death (kill kind 5).Why: Joining with the wrong id or an invalid team is silently ignored, so the screen just stays on the menu.
Check: Join as spectator (team 255) and as each team and weapon.
A-JOIN-3Existing Player has no positionin progress
Existing Player from the server carries no position. A client MUST keep that player hidden until a World Update or Create Player places them.Why: Placing the player at the packet's (absent) position puts everyone at the origin until the next update.
Check: Join a server with bots and check nobody is drawn at the map corner.
A-JOIN-4Create Player: reset and restockin progress
Create Player (12) the player is alive unless the team is spectator, faces east for team 1 and west for team 2, has its block colour reset to (111,111,111) and is restocked: full health, 50 blocks, 3 grenades, full magazine and reserve. The packet is 15 + name bytes, or 16 with an empty name; an empty one MUST keep the name already known. Use the position as given (the original Voxlap client subtracts 2 from z; modern clients do not).Why: Stale ammo or colour from the last life carries over otherwise.
Check: Die, respawn, and compare health, blocks, grenades and ammo with the server's values.
A-JOIN-5Answer Version Get, Handshake Init and Ext Info; never require themsupported
Handshake Init with Handshake Return (32, the same four bytes) and Version Get (33) with Version Send (34: client letter, three version bytes, 64-byte OS string). The extended forms are in section B. Nothing in the join may wait for them.Why: Some servers fingerprint clients and kick those that stay silent; a client that blocks on them hangs on servers that never ask.
Check: Join a server that sends Handshake Init (31) and one that does not.
A.4 Packets the server sends
A-IN-1Dispatch every inbound id and validate before usein progress
player_id is 0..255 and in use where that matters, and map out-of-range enums to the safe default (team: spectator; weapon: rifle; tool: spade; territory team: neutral). The inbound ids are 0 Position, 1 Orientation, 2 World Update, 3 Input, 4 Weapon Input, 5 Set HP, 6 Grenade, 7 Set Tool, 8 Set Color, 9 Existing Player, 11 Move Object, 12 Create Player, 13 Block Action, 14 Block Line, 15 State Data, 16 Kill Action, 17 Chat, 18 Map Start, 19 Map Chunk, 20 Player Left, 21 Territory Capture, 22 Progress Bar, 23 Intel Capture, 24 Intel Pickup, 25 Intel Drop, 26 Restock, 27 Fog Color, 28 Weapon Reload, 31 Handshake Init, 33 Version Get, 60 Ext Info, 64 to 127 extension packets.Why: A packet that is shorter than its layout, or names a player or team that does not exist, is how a hostile server crashes a client.
Check: Fuzz each id with lengths 0..size+8 and random bytes; run under a sanitizer.
A-IN-2Position Data and Orientation Data are corrections to youin progress
Position Data (0, 13 bytes) sets the receiver's eye position, zeroes its velocity and keeps its look. Orientation Data (1, 13 bytes) sets the receiver's look vector. Neither may be interpolated, and neither writes into a different field than its own.Why: They carry no player id. Applying a position to the wrong slot, or interpolating a teleport, shows up as rubber-banding.
Check: Teleport yourself with an admin command; the view must jump, not slide.
A-IN-3World Update: skip yourself, keep the last position on zerossupported
{position, orientation} (24 bytes) per slot, indexed by player id; [0.76] sends {id, position, orientation} (25 bytes) for each present player. The packet is 1 + 24n or 1 + 25n bytes. A client MUST skip its own entry, MUST treat a zero position as "not visible, keep the last position", and SHOULD interpolate between updates (about 60 per second).Why: Servers send zeros for dead players, players beyond the fog and free slots. Teleporting them to the corner looks like a bug.
Check: Stand with a bot just past the fog distance; it must not flash at (0,0,0).
A-IN-4Input Data and Weapon Input describe other playerssupported
Input Data (3): player_id and key bits 1 forward, 2 back, 4 left, 8 right, 16 jump, 32 crouch, 64 sneak, 128 sprint; for yourself only the jump bit matters. Weapon Input (4): bit 0 primary, bit 1 secondary; a server sends 0 while a player sprints, switches or reloads. Use it for tracers, swings and flashes of that player and ignore it for yourself.Why: They drive legs, tracers and swings of other players; applying them to yourself fights your own prediction.
Check: Watch a bot walk, sprint and fire from a second client.
A-IN-5Set HP, Kill Action, Restockpartial
Set HP (5, 15 bytes): new health 0..100, type (0 fall, 1 other), source position; flash the screen on a drop. Kill Action (16, 5 bytes): victim, killer, kind (0 weapon, 1 headshot, 2 melee, 3 grenade, 4 fall, 5 team change, 6 weapon change), respawn seconds; the killer scores unless it is the victim. Restock (26): that player gets full health, 50 blocks, 3 grenades and full reserve; ignore it for yourself while dead.Why: The HP and the kill feed are the player's only feedback; a client that trusts its own damage prediction disagrees with the server at once.
Check: Shoot yourself with a second client and compare HP, kill feed and respawn counter.
A-IN-6Grenade: velocity is in blocks per 1/32 ssupported
Grenade (6, 30 bytes): thrower, fuse in seconds, position, velocity in blocks per 1/32 second (blocks_per_second / 32). Gravity is 32 blocks/s squared. The server does not send a grenade back to its thrower.Why: Treating it as blocks per second makes grenades 32 times too slow.
Check: Throw one and compare your landing point with the server's explosion.
A-IN-7Set Tool and Set Color are kept for every playerpartial
Set Tool (7): tool 0 spade, 1 block, 2 gun, 3 grenade; ignore a value above 3. Set Color (8): B, G, R; keep it for players that are not alive or not joined yet.Why: Later block packets use the colour of the player who sent them, even one that is not alive yet.
Check: Join a match where someone has picked a colour before you arrived.
A-IN-8State Data: 83 bytes for CTF, 32 + 13n for TCpartial
0 CTF, 1 TC; treat an unknown mode as TC). CTF adds scores, capture limit, an intel-state byte and, for each intel, 12 bytes ({carrier, 11 padding} when held, else a position), then both bases. TC adds the territory count and {position, team} per territory.Why: This is where the player id, fog, team names and mode come from; a wrong offset misnames both teams.
Check: Join one CTF and one TC server and print every decoded field.
A-IN-9CTF and TC objectsin progress
Move Object (11): CTF object 0/1 intels, 2/3 tents (moving an intel also drops it from its carrier, silently); TC territory index with its owner. Intel Pickup (24), Intel Drop (25, with the position), Intel Capture (23: winning 1 ends the round; 10 points to the player and 1 to the team). Territory Capture (21), Progress Bar (22: rate is per 50 s; advance 0.05 * rate a second). A team value other than 0, 1 in a territory or object packet MUST be treated as neutral.Why: Intel and tents live on the map, not in the player list; a client that only reads State Data never sees them move.
Check: Capture an intel and check the tent, the intel and the scores.
A-IN-10Chat Message typessupported
Chat Message (17, 3 + text bytes): player id (255 = the server), type (0 all, 1 team, 2 system; 3 big, 4 info, 5 warning, 6 error with B-MSG-1), text. A client sends types 0 and 1 only.Why: Types 3 to 6 only arrive when the extension was agreed; showing them as normal chat or dropping them hides server notices.
Check: Send each type 0..6 from a probe.
A-IN-11Fog Color, Weapon Reload, Player Leftsupported
Fog Color (27): alpha (unused) and B, G, R. Weapon Reload (28, 4 bytes): for yourself it settles the ammo, for another player it plays the sound and refills your view of their clip (otherwise you stop drawing their shots when your count reaches 0). Player Left (20): clear the slot.Why: Small packets, but each one is a place a stale value stays on screen.
Check: Reload with a second client and check the first one hears it.
A.5 Packets the client sends
A-OUT-1Report position and orientationpartial
Position Data (0) about once a second while alive and right after a teleport. Send Orientation Data (1) when the look changed by more than about 0.5 degrees (up to about 120 times a second) and immediately before each shot, so the server validates the hit against the right direction.Why: The server compares your position with its own simulation; a client that never reports is corrected into the ground.
Check: Walk for a minute and count corrections from the server.
A-OUT-2Report input and buttons when they changesupported
Input Data (3) whenever the movement keys change and Weapon Input (4) whenever a button changes, except while sprinting. Send Set Tool (7) when the held tool changes and Set Color (8) when the colour does.Why: The server simulates you from these bits.
Check: Hold forward and sprint, release; the server's view of your keys must follow.
A-OUT-3Report only hits you sawsupported
Hit (5, 3 bytes): victim and part (0 torso, 1 head, 2 arms, 3 legs, 4 melee) for every hit your shot or spade made.Why: The server decides damage, but checks distance, line of sight and fire rate; sending guesses gets the player flagged.
Check: Shoot at a wall and at a body; only the latter may produce a Hit.
A-OUT-4Throw grenades with the fuse that is leftsupported
Grenade (6): fuse left (up to 3 s), the position it leaves the hand and velocity in blocks per 1/32 second.Why: Resetting the fuse to 3 s on every throw makes a held grenade explode late for everyone else.
Check: Hold a grenade for 2 s, throw it and check where it explodes.
A-OUT-5Reload and chatsupported
Weapon Reload (28) when a reload starts and wait for the server's answer before adding ammo. Send chat (17) as {player id, type 0 or 1, text} in CP437 or 0xFF + UTF-8 (A-TEXT-2).Why: The server owns the ammo; your count is a prediction until it answers.
Check: Reload, switch tool mid-reload, and compare the ammo.
A.6 Game rules the client must know
A-RULE-1Block action semanticspartial
Block Action (13, 15 bytes: player, action, cell). Actions: 0 build one block in the player's colour (a repaint when the cell is already solid), 1 destroy one, 2 spade (the block and those above and below: 1 x 1 x 3), 3 grenade (3 x 3 x 3, silently), 4 destroy one (gun), 5 destroy one (spade). Actions 2 and 3 leave z >= 62 alone, and cells outside the map are ignored. Block Line (14, 26 bytes: player, start, end) builds a 3D DDA line, skipping solid cells, and costs |dx| + |dy| + |dz| + 1 blocks. A player carries at most 50 blocks; a build costs one, a spade destroy gives one back.Why: Actions 2 and 3 change more than one cell; counting only the named cell leaves holes.
Check: Spade a three-high column and grenade a wall; compare with the server's map.
A-RULE-2Batch the edits that arrive together: creates first, then destroysin progress
enet_host_service pass, or one datagram) MUST NOT touch the map one by one. Record each affected cell in a table keyed by position, last operation wins (create with its colour, or destroy). When the batch is complete, apply all creates, then all destroys, then run block gravity once. Sound and effects may play immediately.Why: Servers implement block painting as "destroy, then create the same cell"; applied one by one, the destroy briefly removes support and the block-gravity check drops a structure that never fell.
Check: Repaint the block under a pillar; the pillar must stay up.
A-RULE-3Block gravitypartial
z >= 62, nothing happens. Otherwise everything that fill reached is detached: it falls and is removed. A cell that was already empty inside a spade or grenade area MUST NOT start a check. Gravity does not wrap (A-COORD-3).Why: This is what makes bridges fall; the server never sends the falling cells in 0.75.
Check: Cut the only support of a floating block; it must fall. Spade a column next to a free-standing block; it must not.
A-RULE-4Fog is a cylinder of radius 128supported
State Data, Fog Color). 0.75 has no fog-distance field.Why: Drawing players past the fog is a wallhack, and servers do send their positions.
Check: Check that a player 130 blocks away is not drawn although the server sent its position.
A-RULE-5Cast rays with a DDAsupported
Why: Stepping along a ray in fixed increments skips thin walls and corners; every shot, colour pick and block target depends on it.
Check: Fire along an exact axis, along a diagonal and through a one-block corner; compare with a reference.
A-RULE-6Sectorssupported
A to H from floor(x / 64) and a digit 1 to 8 from floor(y / 64) + 1. Servers may protect sectors from building and digging.Why: Territory captures and the minimap grid use these names.
Check: Convert the four map corners and the centre.
A-RULE-7The 64-colour block palettepartial
Set Color.Why: Players expect the classic palette and arrow-key navigation; copying a colour must select the matching square.
Check: Pick every square and send Set Color; copy a block's colour and check the cursor.
A-RULE-8Colour copypartial
Set Color); if it faces none, use the fog colour. It SHOULD work even when a block is not in hand.Why: The classic bind (E) is how players match terrain.
Check: Look at a block 100 blocks away, then at the sky.
A-RULE-9Player physics is the server's; predict it, do not invent itsupported
Position Data as a correction. Fall damage is the server's decision; the client plays the fall sound.Why: The server compares your reported position with its own simulation. Different gravity, friction or step-up rules give a correction every few seconds.
Check: Run flat, jump, climb one-block steps, fall from 10 blocks and count position corrections.
A.7 What 0.76 changes
A-076-1Connect data 4supported
4 for a 0.76 server (A-NET-2).Why: A 0.76 server refuses 3.
Check: Connect to a 0.76 server with each value.
A-076-2Map Start carries size, CRC32 and namesupported
Map Start is 73 bytes: Uint32 size, Uint32 CRC32 of the compressed stream, then a 64-byte NUL-padded map name.Why: Without the CRC32 a client cannot tell whether it already has the map.
Check: Join the same server twice; the second time no Map Chunk may arrive.
A-076-3Answer Map Cached; cache by CRC32supported
Map Cached (31, client to server, 2 bytes: 1 = have it) when you hold a map with that CRC32 and 0 otherwise; on 1 the server sends no Map Chunk. The client SHOULD store a downloaded map only after the CRC32 of the received stream matches, and MUST NOT trust a cache file that fails its own check.Why: A cached map saves megabytes; a wrong answer loads the wrong map.
Check: Corrupt a cache file and check that you still join.
A-076-4World Update has player idssupported
World Update entry is {Uint8 id, position, orientation} (A-IN-3).Why: The 24-byte slot layout reads garbage from a 0.76 server.
Check: Join a 0.76 server with 8 players.
A.8 The classic server list
A-LIST-1Read serverlist.json defensivelysupported
/serverlist.json. Each row has at least name, identifier (aos://...), map, game_mode, country (ISO 3166-1 alpha-2), latency (ms, measured by the list), players_current, players_max, last_updated (Unix seconds) and game_version ("0.75", "0.76" or another string). A client MUST ignore unknown keys, MUST NOT treat duplicates as an error, and MUST treat a body that is not a JSON array as "unreachable". Fetch over HTTPS when the host offers it.Why: The classic lists are old, duplicate rows are common and fields are added over time.
Check: Feed a row with unknown keys, a duplicate and a non-JSON body.
B. The community's 0.75 extensions
Servers and clients agree on optional packets through Ext Info, as the aosprotocol specification describes. The registry and what our server sends is on the protocol site; the byte layouts of the larger extensions (Damage Markers, Teamplay pings, Pie Menu) are in the specification, which is the source of truth for them.
B.1 Negotiation
B-EXT-1Answer Ext Info with the intersection, never moresupported
Ext Info (packet id 60, 0x3C) after the join. The client MUST store the offered list, and MUST reply with an Ext Info containing only extensions that are both offered and implemented. An extension's packets are sent only to clients that agreed. See Ext Info and Protocol Flow.Why: Naming an extension you do not implement makes the server send packets you cannot parse; naming one it did not offer is ignored at best.
Check: Offer an extension your client lacks (for instance 0x31) and check it is not in the reply.
B-EXT-2Layout: count, then (id, version) pairssupported
Ext Info is [60, count, (id, version) x count], size 2 + 2n. Our server writes, and our client reads, count as the number of entries. The aosprotocol page words it as "length, then length + 1 entries". A client reading an unknown server SHOULD treat the field as a count and, only when the first entry is not a known id while count - 1 entries parse cleanly to the end of the packet, fall back to the other wording. Use version 1 for every extension unless a server says otherwise.Why: The specification words the count differently from what real servers write, and a reader that is off by one drops the last extension or reads a byte of the next packet.
Check: Parse a packet with 3 entries from our server and from a ZeroSpades-based one.
B-EXT-3Extension packets: id 64 + extension id, then a sub-packet bytesupported
0 to 191) uses legacy packet id 64 + extension id and one extra byte after the id, the sub packet id, even when it has only one packet. Extensions 192 to 255 are packetless: they change how existing packets are written and are known by the agreement alone. Packet 64 is Player Properties once agreed; without the agreement it is not an extension packet (some servers used it for their own status).Why: Packets 64 to 127 share one id space; forgetting the sub id desynchronises every extension.
Check: Send each extension's sub-packets and check no other packet changes meaning.
B-EXT-4Know the registrysupported
The extensions our client answers (when offered):
| Id | Name | Packet | Requirements |
|---|---|---|---|
0x00 | Player Properties | 64 | B-PROP-1 |
0x20 | Damage Markers | 96 | B-DMG-1 |
0x30 | Teamplay | 112 | B-TEAM-1, B-TEAM-2 |
0x31 | Pie Menu | 113 | B-PIE-1 |
0x32 | Flashlight | 114 | B-LIGHT-1, B-LIGHT-2 |
0x33 | Daytime and Weather | 115 | B-SKY-1 |
0x35 | Player Outfit (a draft) | 117 | B-OUTFIT-1 |
0xC0 | Player Limit | none | B-LIMIT-1 |
0xC1 | Message Types | none | B-MSG-1 |
0xC2 | Kick Reason | none | B-KICK-1 |
Why: Ignoring an id is safe; mistaking one for another is not.
Check: Print the ids you answered with.
B.2 Extensions with packets
B-PROP-1Player Properties (0x00)supported
Uint32, kills plus score). Sent on change, at most every 100 ms per player. Keep ammo and score of everyone; keep health, blocks and grenades of your own player only. See Player Properties.Why: The ammo of other players decides whether you draw their shots.
Check: Fire from a second client; the first must keep drawing the shots after its count would reach 0.
B-DMG-1Damage Markers (0x20)supported
Why: Without it a client shows no hit confirmation on servers that rely on it.
Check: Hit a bot and watch for the marker and the number.
B-TEAM-1Teamplay Config (0x30, sub 0)supported
Why: Config is the server's permission slip; drawing a compass or teammates through walls the server did not allow is a wallhack.
Check: Join with Config flags 0 and with all three bits.
B-TEAM-2Teamplay pings and ESP markssupported
0 removes, infinite until removed), colour, label and the surfaces to draw on (world, map, compass). Sub 2 ESP Mark (server to client): a target, life, whether to show the name, colour and label; it survives a death and may end at the respawn. The server's own pings come from player id 255. A client sends a ping only when Config allows it. Drop pings that arrive while the map loads.Why: They are the quick-chat of the team.
Check: Send a ping with a label and a life from a probe, and an ESP mark of a dead player.
B-PIE-1Pie Menu (0x31)supported
Why: Parsing a half-valid menu leaves rings the player cannot use.
Check: Send a menu with a short string and a trailing byte; both must be refused whole.
B-LIGHT-1Flashlight (0x32): ask, and draw only what the server switched onsupported
Why: A light the server never accepted is a light nobody else sees; a client that lights itself on its own cheats nobody but disagrees with everyone.
Check: Toggle your light with and without the extension agreed.
B-LIGHT-2A light goes off silentlysupported
Create Player, Kill Action, Player Left and on a new map, with no packet from the server.Why: No packet announces it; a client that keeps lights on after a respawn shows ghost beams.
Check: Die with the light on and respawn.
B-SKY-1Daytime and Weather (0x33)supported
Uint16 time (0 night, 720 noon, other values are the day) and four reserved bytes (the draft's weather; version 1 has a day and a night). Sent after the agreement and after every map. A client that agreed and has received no sky yet SHOULD draw the night (black fog and sky) with flashlights as the only light. A new server starts by day. See Daytime and Weather.Why: A client that agreed and ignores the packet draws a day the server meant as night.
Check: Send Time 0 and Time 720; check fog, sky and light.
B-OUTFIT-1Player Outfit (0x35, a draft)supported
Why: It decides whether a team looks like soldiers or zombies.
Check: Send Set Outfit 64 for a player, then leave and rejoin.
B.3 Packetless extensions
B-LIMIT-1Player Limit (0xC0)supported
Ext Info only: the number of players the server accepts. Size per-slot state for 256 anyway.Why: It sizes the World Update.
Check: Join a server that offers it with 64 slots.
B-MSG-1Message Types (0xC1): chat types 3 to 6supported
Chat Message may have type 3 (big), 4 (info), 5 (warning) or 6 (error). Show them as popups of increasing urgency.Why: Without the agreement the server sends type 2 instead.
Check: Send types 3, 4, 5 and 6 from a probe.
B-KICK-1Kick Reason (0xC2)supported
Chat Message from player 255 sent just before a disconnect is the kick text; keep it and show it as the reason. (A server lets it leave the queue before disconnecting.)Why: The only reason a player ever sees for a kick is this line.
Check: Kick yourself from the server console.
B.4 Extra packets and UTF-8 chat
B-VER-1Extended Version Get and Version Sendsupported
Version Get (33) with bytes after the id asks for the extended answer: reply with Existing Player (9) whose first byte after the id is 'x' (0x78), which no player id can be, then for each requested property, in ascending order, id, length, payload, one packet per property, each repeating the ones before. Properties: 0 application (for example BetterSpades 0.1.5), 1 language (en_us, pt_br), 2 feature flags (bit 0: reads UTF-8 chat). An unknown id gets an empty payload. See Extended Version Get.Why: This is how a server learns your language and whether you read UTF-8.
Check: Send Version Get with property ids 0, 1, 2 and 9 and read the answers.
B-UTF8-1UTF-8 chat announcementsupported
0xFF + UTF-8 lines (A-TEXT-1). A client MAY consider a server as reading UTF-8 once it has sent a 0xFF line itself.Why: A server only sends 0xFF lines to clients that said they read them.
Check: Receive a 0xFF line and send one back.
C. Protocol 1.0
The protocol of ngspades-server: ENet or WebRTC, a binary codec with varints and masks, the map as ngmap or VXL, entities with delta updates and string commands for the rare things. It is specified in the protocol 1.0 page, and the dependency-free C and Godot examples implement the codec this part requires.
C.1 Transport
C-NET-1Connect with the 1.0 magic and two channelssupported
135272729 (0x08101919). The default port is 32887, the same as 0.75. The server accepts IPv4 and IPv6 peers on one socket, so an IPv6-only client works. ENet encryption MUST NOT be enabled: it changes the wire. See Connection.Why: A different connect value is taken for another protocol; one channel loses the unreliable body updates.
Check: Connect to a 1.0 server; the first packet must be Greeting (id 1).
C-NET-2Channel 0 reliable, channel 1 unreliable for your bodysupported
Client Side Entity Update, and an Entity Update carrying only a trajectory) goes unreliable on channel 1. Everything else goes reliable on channel 0. An update that must be seen before an action goes reliable on channel 0 (C-OWN-2).Why: The server's entity deltas are reliable; yours are positions, and an old one is useless.
Check: Capture a minute of play and check where the movement packets go.
C-NET-3Treat connect refusal as not 1.0 and fall backsupported
3 with no Kick reconnect with connect data 3. A 1.0 connection only counts once Greeting has arrived; if any other packet id arrives first (a 0.75 server that accepted the magic), the client MUST drop it and retry as 0.75. Wait a few seconds for the Greeting; a far server's refusal can come late.Why: Public 0.75 servers refuse the 1.0 magic with reason 3 and no Kick; some accept any connect data and then speak 0.75.
Check: Join a public 0.75 server; you must end up on 0.75 without a hung screen.
C-NET-4Strict decoder: reject, ignore, never guesssupported
Generic Command, an unknown world parameter or map key. Primitives: little-endian fixed-width values, Varint (unsigned LEB128, at most 10 bytes), Svarint (zigzag then varint), Bytes (varint length, at most 1 MiB), String (UTF-8 bytes, no NUL), Map (key and value strings, ended by an empty key). See Data Types.Why: Masks are not self-describing: one unknown bit makes the rest of the packet unmeasurable.
Check: Run the codec's golden vectors and the truncation, unknown-bit and oversize cases from the example test suite.
C-NET-5Disconnect reasons of 1.0 are another tablesupported
The reason is a Uint32 in the ENet disconnect (or the WebRTC text disconnect <reason>). A Kick packet (5) with the text precedes reason 3: show the text.
| Value | 1.0 meaning | Note |
|---|---|---|
| 0 | unknown | also an ENet timeout |
| 1 | internal server error | |
| 2 | server full | |
| 3 | kicked | a Kick with the text came first. Without one, on a 0.75 connection attempt it means wrong protocol |
| 4 | server stopped | |
| 5 | timeout | a handshake step took too long |
| 6 | malformed packet | |
| 7 | protocol mismatch | the protocol name was not ours |
Why: The same field means something else on each protocol, and 3 is both "kicked" (1.0) and "wrong protocol" (vanilla).
Check: Kick yourself and check you show the Kick text; connect to a full server.
C-NET-6Be ready for a handshake and map timeoutsupported
Greeting and the Client Certificate, and MUST send its Map Data Acknowledge as soon as the map is decoded. The exact budgets are in the server's documentation and have been tightened over time: do not depend on a figure, answer promptly. There is no game-time timeout; ENet's peer timeout applies.Why: A client that stalls between steps is dropped; the server does not wait for slow starts.
Check: Delay each handshake step on a test client and note when the server disconnects.
C.2 Handshake
C-HS-1Follow the handshake ordersupported
client server
connect (0x08101919) or WebRTC "connect" ->
<---------------------------- Greeting (1)
Initiate Connection (2) --------------->
<---------------------------- Server Certificate (3)
Client Certificate (4) ---------------->
<---------------------------- Game State Header (6)
<---------------------------- Map Data (7) x N, Map Data Final (11)
Map Data Acknowledge (10) -------------> (after decoding)
<---------------------------- Game State Final (8)
Generic Command "join <team> <weapon>" ->
<---------------------------- Generic Command "local-player <id>"
<---------------------------- Entity Update / Player Update / Terrain UpdateSee Handshake.
Why: Skipping a step times the connection out.
Check: Print the ids sent and received on a join.
C-HS-2Initiate Connection fieldssupported
"WorldOfSpades 1.0", Uint16 major 1, minor 3 (the protocol revision, informational), Uint16 revision (your build), package (at most 256 bytes), environment (at most 1024), locale such as pt_BR (at most 256), player name (UTF-8, at most 63 bytes), a nonce of 256 random bytes and a Uint8 map quality (0 = send VXL, 1..100 = ngmap is fine, clamped by the server). The Greeting's nonce of 128 random bytes is what a connect token signs (C-HS-3).Why: A different protocol name is refused with reason 7.
Check: Send each field at its limit (256-byte package, 1024-byte environment, 63-byte name).
C-HS-3Certificates: isValid 0, or a connect tokensupported
Server Certificate (3) and Client Certificate (4) are Uint8 isValid (0: nothing follows) or isValid != 0 with certificate and signature as Bytes. A client that only needs local play sends isValid = 0. To join a public server over UDP, after the Greeting the client asks the master for a connect token (POST /v1/token with the server address and the base64 Greeting nonce) and sends the answer as the client certificate with isValid = 1. A token is one connection: never cache it. WebRTC joins and local addresses need none. See Connect tokens.Why: A UDP join from a non-local address is only admitted with a token from the master; without it the server sends Kick.
Check: Join a public server from a non-local address with and without the token request.
C-HS-4The world may restart at any timesupported
Game State Header after the game has started means a world change: drop every entity, the map and the mode state, take the new map, and join again. Packets in flight are dropped, not an error.Why: A new round restarts the transfer at Game State Header; a client that keeps its old state mixes two worlds.
Check: End a round on a test server while connected.
C.3 The map
C-MAP-1Read the Game State Headersupported
Map of strings: map-name, map-format (ngmap or vxl), map-size (512,512,64 or 1024,1024,64), map-bytes (stream size, for a progress bar), map-crc32 (CRC32, zlib's, of the exact stream, 8 hex digits). map-format decides the decoder, not the quality you asked for. Accept only the map sizes the client supports and refuse the rest before decoding.Why: The header decides which decoder runs and whether the map can be skipped.
Check: Log every key of a header.
C-MAP-2Skip a map you already have: map-cachedsupported
Generic Command "map-cached 1" if you hold a stream with that CRC32 and byte count, else map-cached 0. The server waits about 3 seconds. On 1 no Map Data is sent: go straight to Map Data Final, then the rest. The key is the stream (its CRC32 and size): two qualities of one map, or the same map after an edit, are different entries. Store a received stream only when its CRC32 matches the header's, and never answer from the cache while recording a demo or on your own local server's map. This is the 1.0 counterpart of 0.76's Map Cached (A-076-3).Why: A cached map is instant; the CRC32 must be of the stream, not of the map, or an edited map loads stale.
Check: Join twice; the second join must receive 0 map bytes. Change the map quality and check you download again.
C-MAP-3Assemble the stream; keep Terrain Updates until the map is readysupported
Map Data (7) fragment in order; Map Data Final (11, empty) ends the stream. Decode the map, apply the Terrain Updates that arrived meanwhile in order, then acknowledge. The server keeps broadcasting edits to loading connections.Why: Edits made during the transfer arrive as Terrain Update; discarding them leaves a hole where someone built.
Check: Dig continuously with a second client while a third one joins.
C-MAP-4Always acknowledgesupported
Map Data Acknowledge (10, one byte, no payload). It is mandatory, also after a cache hit.Why: Game State Final is only sent after it.
Check: Delay the decode by 5 s and check the server waits.
C-MAP-5Decode vxl with the 0.75 loader; ngmap with a port, not a rewritesupported
vxl is the zlib-compressed VXL exactly as 0.75 sends in Map Chunk, so one loader serves both. ngmap is a zlib stream (signature 0x1145148A, width, height, depth at most 64, quality, column geometry, JPEG colour tiles, colour blocks). A client that cannot decode it MUST send map quality 0 and use VXL. Otherwise port the reference codec; do not re-implement it from the summary. See Map Formats.Why: ngmap is about 1,900 lines of codec with JPEG tiles; a summary is not enough to re-implement it.
Check: Decode a map from the maps repository and compare it voxel by voxel with its VXL.
C-MAP-6Terrain Update: cursor deltas, R G B, one gravity passsupported
Int8 dx, dy, dz relative to a cursor starting at (0,0,0); dx = -128 moves the cursor: read cx, cy, cz (unsigned varints) then dx again. The cursor does not follow the edits: deltas are relative to the last explicit cursor. Then Uint8 health (0 = destroyed, else created), and for a creation R, G, B and a create type (0 unspecified, 1 player), for a destruction a destroy type (0 unspecified, 1 damage, 2 collapse). Health below 100 is a cracked block: draw the crack. Cells marked collapse are falling structures: remove them and build the falling piece from their colours and connections without running a gravity search. Apply a whole packet, then run block physics once. See Terrain Update.Why: Its colour order is the only R, G, B on the 1.0 wire, and its cursor does not follow the edits.
Check: Run the two worked examples of the protocol page and a batch that moves the cursor.
C.4 Game state and entities
C-STATE-1Game State Final and world parameterssupported
Map of world parameters, then every entity and every player already in the match, each as an item with Create. After it the connection is in the game. Parameters are strings parsed as numbers: player-jump-vel (default 0.36), fall-damage-vel (0.58), fall-damage-fatal-vel (1), fog-distance (96, 32 to 256), fog-color, gamemode, team names and colours, capture-limit, aim-assist, the jetpack figures and sentry-lifetime. Unknown keys are ignored. Predict your own movement with these numbers.Why: Jump height, fall damage and the fog come from the server; defaults only apply when it says nothing.
Check: Start a server with a different jump velocity and check the prediction matches.
C-ENT-1Entity Update: a delta against the last valuesupported
Uint8 forced, then items to the end of the packet. An item is Varint entity id, Uint8 mask, and the parts the mask names. Keep the last value of every part and change only what the mask announces. An item for an unknown id without Create is ignored. A body has the same id as its player (0..255); every other entity uses 256 and up.Why: Treating an item as a full state resets everything it did not mention.
Check: Replay a recorded stream and compare the final entity table with the server's.
C-ENT-2Field order is not bit ordersupported
0, 1, 2, 3, 4, 5, 6). For Player Update items the order is Create (name), Score, Flags, Team, Stats, Ping, Perks. Take both orders from the protocol page, not from the bit numbers.Why: Reading parts in bit order desynchronises the whole packet at the first item that has both Tool and Trajectory.
Check: Decode the golden vector with Create, Trajectory and Tool all set.
C-ENT-3Ignore parts for your own entity, unless forced or Createsupported
forced is set or the item has Create; that is how the server corrects you.Why: Applying the server's old copy of your body fights your prediction and jitters the view.
Check: Walk straight while another client shoots near you; the view must not shudder.
C-ENT-4Trajectories, including the compact player formsupported
0 Constant, 1 Linear, 2 Gravity with g = (0,0,32), 3 Player, 4 Rigid Body, 5 Player Compact), bit 7 a parent follows. Player Compact is 17 bytes: origin x and y as Uint16 * 64, origin z as Int16 * 64 rounded up (toward the sky), velocity as Int16 * 1024, pitch * 32767 / (pi/2), yaw * 32767 / pi, then the parent. Decode it as an ordinary player trajectory. A client sends its own trajectory as floats. Entity flags: bit 0 playerClip, 1 weaponClip, 2 fly, 3 jetpack; bits 4 to 7 are invalid. Player input: bit 0 primary, 1 secondary, 2 chat, 3 sprint, 4 jetpack thrust, 6 to 7 stance (0 stand, 1 crouch, 2 prone); xmove, ymove in −127..127.Why: A body arrives as one of six kinds; the compact one rounds z up so a resting body is not inside the floor.
Check: Decode type 5 and re-extrapolate; a standing body must not bob.
C-ENT-5Entity Event, Entity Die, Entity Remove, Damagesupported
Entity Event (31): id, type (0 Jump, 1 Reload Weapon, 2 Suicide, 3 Explode, 4 Fire, 5 Use Perk), param. Entity Die (32): id, death type, param (for a player reason | respawn << 8), and an optional damage info: check for the end of the packet before reading it. Entity Remove (33): remove at once. Damage (92): the victim, a type byte (low 7 bits, bit 7 means a source id follows), source, target, fire and hit positions and the amount, for the hit indicator; the authoritative health is the body's Health part. Explosions happen on Explode, not on a fuse.Why: Kill feed, respawn and explosions are driven by these four.
Check: Die, explode a grenade, and take damage from a source with and without a killer.
C-ENT-6Player Update and Player Removesupported
0, 1, 255 spectator), kills and deaths, ping, and your own perks. Packet 51 is a list of varint ids to remove. The client's own slot arriving among the spectators means it has no body and should start its free camera.Why: A player and its body are different things: a spectator has a player and no body.
Check: Join as a spectator and check the score board.
C.5 Your own player
C-OWN-1Join, then report your body at a steady ratesupported
Generic Command "join <team> <weapon> [<class>]" (team 0/1, 255 spectator; weapon 0 rifle, 1 SMG, 2 shotgun). The server replies local-player <id>: that id is your player and entity. Then send Client Side Entity Update (35) at about 30 Hz, unreliable on channel 1: your trajectory (position, velocity, euler angles) and your input when it changed, tool and block colour. Never send Create. Movement is client-authoritative but checked: the new position must be within about 0.1 block of the server's extrapolation along the old velocity, and the velocity within 0.1, or you receive a forced correction. A change of trajectory type is refused.Why: Until join there is no player; until the first report there is no movement.
Check: Join and move; the server must log your entity.
C-OWN-2Send the input before the actionsupported
Hit Entity, Hit Terrain, Build Block or Build Line, send an update carrying the input or tool change, reliably on channel 0.Why: A hit or a build that arrives before the update showing you fired or holding the block tool is refused.
Check: Fire a burst and check no shot is refused for "not firing".
C-OWN-3Report hits, builds and throwssupported
Hit Entity (90): entity, hit type (0 unspecified, 1 torso, 2 head, 3 limb), damage type (7 Weapon1 or 8 Weapon2: the slot fired from; 4 melee), your eye as fire position and the point hit. Hit Terrain (91): the cell, damage type (5 dig, 4 melee, 7..9 a gun), positions. A gun sends one for every pellet that meets a block; the server keeps the block's health and the break happens at 100. Build Block (93) and Build Line (94): cell(s) and a colour in B, G, R (the server answers with a Terrain Update). Throw Grenade (95, 29 bytes): origin, velocity in blocks per second, fuse 0 to 3. Show your own grenade from the throw until Explode. A refused build is answered with a Terrain Update that restores the cell.Why: The server decides damage and edits; it refuses what it cannot see in your own report.
Check: Shoot, dig, build and throw; check what the server accepts and what it refuses, and why.
C-OWN-4Actions on your body: Player Actionsupported
Player Action (60): event type (0 Jump, 1 Reload Weapon, 2 Suicide, 5 Use Perk) and a varint param. Wait for the Entity Event before treating a reload as done.Why: Jump, reload, respawn and perk placement are requests; the server answers with an Entity Event.
Check: Press jump during a zombie leap and a reload.
C-OWN-5Chatsupported
Chat Message (70): Uint8 channel (0 all, 1 team), String UTF-8 up to 255 bytes. Chat Broadcast (71): Varint sender (0xFFFFFFFF = the server), channel (0, 1, 2 system), text. There is no CP437 in 1.0.Why: Channel 2 is the server's: a client that could send it would forge notices.
Check: Send 255 bytes and 256 bytes of chat.
C.6 Commands and game modes
C-GEN-1Generic Commands: send the ones you use, ignore the restsupported
parts[0] is the command. A client sends join, leave, map-cached, team <n>, weapon <n>, class <n>, ping <info|danger> x y z [n], ping spot <target> x y z, squad <n>, squad-rally, light <0|1>, device <platform> <input> and host ... (permission checked). The server's commands (hit, kill, perk-*, sky, fog, outfit, squad, light, device, match-*, classes, wallet and others, listed in the protocol page) are optional: ignore the ones you do not use. See Generic Command.Why: New markers and notices are added without a new packet id.
Check: Send an unknown command from a test server; the client must keep running.
C-MODE-1Game Mode State: snapshot or deltasupported
Map of strings. A packet whose first entry is mode is a snapshot: forget all mode state, then apply. Any other packet is a delta: each key replaces its value and an empty value removes it. A snapshot follows Game State Final and starts every round. Numbers are decimal, lists comma-separated, positions block cells. A mode you do not know: show the scores and nothing else.Why: A snapshot forgets everything; applying one as a delta keeps a dead mode's state.
Check: End a round and compare the scores before and after the snapshot.
C-MODE-2Objectives are entitiessupported
Flag, tents Command Post, a hill or a territory a Checkpoint, with fixed ids from 0x7FFF0000: +0 team 1's intel, +1 team 2's, +2 and +3 the tents, +4 the hill, +5 + i territory i. A carried intel has its trajectory's parent set to the carrier. The server sends the objective's Entity Update before the Game Mode State that goes with it. Extrapolate a territory as permille + rate * elapsed, clamped to 0..1000.Why: A client that waits for a key to move the intel never sees it move.
Check: Capture an intel and watch the carrier, the base and the scores.
C.7 Browsers: WebRTC
C-WRT-1Two DataChannels, created before the offersupported
reliable (defaults, channel 0) and unreliable (ordered: false, maxRetransmits: 0, channel 1) before createOffer. A text message is control; a binary message is exactly one 1.0 packet, at most 16 KB. See WebRTC.Why: The server closes a channel with another label, and a channel opened later is not in the offer.
Check: Open a third channel; it must be closed by the server.
C-WRT-2Signal through the master, without trickle ICEsupported
iceGatheringState == "complete", then POST /v1/servers/{id}/offer (or /v1/join/{code}/offer) with {"sdp": ...} and set the returned answer. Do not post more than 10 offers a minute. See the offer.Why: The master relays one offer and one answer; a candidate that arrives later is lost.
Check: Join a server whose UDP port is closed.
C-WRT-3Send connect before Initiate Connectionsupported
connect 135272729 on reliable, and only then the Initiate Connection. The server ends a connection with the text disconnect <reason>. A binary message before connect is dropped.Why: The handshake times out otherwise.
Check: Delay the text message and watch the server's not initiated timeout.
D. Server lists and server queries
How a client finds servers: our master over HTTPS and the classic list (section A.8), and the raw UDP queries a server answers. Specified in Master Server and Ping.
D-LIST-1Read our list: GET /v1/serverssupported
https://master.shootanddestroy.obex.pw; everything is HTTPS and JSON, with Access-Control-Allow-Origin: *. GET /v1/servers returns an array, most players first. Each row has name, identifier (IPv4 when present, else IPv6), identifier6, map, game_mode, players_current, players_max (bots count), game_version ("1.0" or "0.75"), id, key, webrtc (true when the server takes browsers), dtls_fingerprint, info (the HELLOINFO answer, may be absent), ice_servers, country and last_seen. GET /v1/servers/{id} is one row. Use a timeout (5 s) and one retry; a body that is not JSON means "unreachable". Fetch when the player opens the list and on Refresh; never poll faster than every 10 s; rows vanish within 90 s of a server stopping.Why: Rows of our master carry the classic keys plus the fields a 1.0 join needs; a parser that only knows the classic ones cannot join a 1.0 server.
Check: Fetch https://master.shootanddestroy.obex.pw/v1/servers and join a 1.0 row and a 0.75 row.
D-LIST-2Merge with the classic list, ours winningsupported
Why: A server announced to both lists would otherwise appear twice, and the classic row cannot be joined over 1.0.
Check: Run a server that announces to both lists and count its rows.
D-LIST-3The row decides the protocolsupported
game_version "1.0" is aos10://host:port with connect data 0x08101919 (IPv6 hosts in brackets); "0.75" is aos:// with connect data 3. A client on an IPv6-only machine uses identifier6, on a dual-stack machine identifier.Why: Joining a 0.75 server with the 1.0 magic works only when the server refuses it.
Check: Join one row of each version.
D-CODE-1Join codessupported
ABC-DEF, never containing I, L, O, Q, 0 or 1). GET /v1/join/{code} returns the server's row (404 {"error": ...} when nobody holds it) and POST /v1/join/{code}/offer is the WebRTC offer by code (C-WRT-2). Accept the code as pasted. Players see plain words ("Nobody is playing under that code"), never protocol terms.Why: A friend hosting at home has no open port; the code is how they are reached.
Check: Type abc-def, ABC DEF and ABCDEF; all must resolve the same.
D-PING-1Ping with HELLO, ask details with a padded HELLOINFOsupported
HELLO (5 bytes) is answered by HI (2 bytes). HELLOINFO MUST be padded to 1200 bytes (any bytes after the word): padded gets 5 answers a second (burst 10), bare 0.5 (burst 3). The answer is JSON with kind: "info", name, map, map_shape, map_preview, protocol, counts, teams, features, rotation and up to 32 players. Only ask servers of ours: a third-party 0.75 server does not answer. Try three times, 1.5 s apart.Why: UDP proves no address: an unpadded query gets 0.5 answers a second and a forged source could use us as an amplifier.
Check: Send the bare 9-byte HELLOINFO ten times and the padded form ten times and compare the answers.
D-PING-2LAN discoverysupported
HELLOLAN (8 bytes) as a broadcast and to 127.0.0.1 on ports 32882 to 32897. A server answers only local addresses with a JSON row (name, players_current, players_max, map, map_shape, game_mode, game_version).Why: Local games need no master.
Check: Start a server on the LAN and list it with no internet.
D-PREV-1Map preview by chunkssupported
info.map_preview is not 0, ask HELLOPREVIEW + Uint32 offset padded to 1200 bytes. Answers are "SDPC", total, offset, the 64 hex digits of the shape and data, never larger than the query. Keep up to 8 chunks in flight, ask again every 0.5 s, give up after 3 s without a chunk. The stream is "SDP1", width, height and zlib RGB rows (256 x 256). Verify the magic, the size and the inflate, and cache by map_shape. A browser cannot send UDP and has no preview.Why: A small picture is worth a page of text, but a naive reader hangs on a slow link.
Check: Ask for a preview over a link with 150 ms of latency.
E. Optional improvements of ngspades-client
Things ngspades-client does beyond the minimum, limited to what is visible on the wire or in a server's behaviour. None is needed to join a game.
E-IPV6-1Dual-stack socketssupported
IPV6_V6ONLY off, fall back to IPv4 where IPv6 is missing, and accept IPv4 peers as IPv4-mapped addresses (::ffff:a.b.c.d) that you unmap before showing or comparing. Choose identifier over identifier6 while IPv4 is reachable (D-LIST-3). The LAN broadcast stays IPv4.Why: A host or player with IPv6 only must still play.
Check: Join a server by an IPv6 literal on a machine with no IPv4 route.
E-UTF8-1UTF-8 names and chat, both wayssupported
? when the server does not read UTF-8.Why: Names with accents or Cyrillic must survive the trip.
Check: Chat ação and Привет on 1.0 and on a 0.75 server that reads UTF-8.
E-RELOAD-1On 0.75/0.76, ammo is the server'ssupported
Weapon Reload (28) answers. A shotgun animates shell by shell while unconfirmed shells never overfill the magazine; a shot aborts the reload; no answer in 5 s gives up. A server that answers with nothing loaded ends the reload. (On 1.0, the Reload Weapon event is the confirmation.)Why: A timer-based reload disagrees with the server after a tool switch or a shot and leaves the player with ammo that does not shoot.
Check: Reload, switch tool mid-reload and shoot during a shotgun reload; compare the ammo with the server's.
E-AIM-1Aim assist only when the server allows itsupported
aim-assist is 1 on a 1.0 server.Why: An assist the server did not agree to is an advantage the other players cannot get.
Check: Join with and without the aim-assist world parameter.
E-DEMO-1Record and play back packetssupported
map-cached 1. Playback sends nothing and joins as a spectator.Why: A demo must replay what the server sent, not what a cache invented.
Check: Record a join with a cached map, then play it back.
E-DEV-1Announce your input devicesupported
Generic Command "device <platform> <input>" (platform desktop android iphone console browser, input kbm pad touch) when either changes.Why: The score board can show who plays with a pad, and servers can tell touch from mouse.
Check: Plug in a pad and watch the server's log.
E-CACHE-1Housekeeping for the map cachesupported
<CRC32>-<bytes>), trim least recently used entries over a size limit at start-up, and treat a cache file whose CRC32 no longer matches as missing.Why: An unbounded cache fills a phone.
Check: Fill the cache past its limit and restart.
F. Reference tables
F.1 Team, weapon and tool numbers
| Value | 0.75 / 0.76 wire | 1.0 wire |
|---|---|---|
| Team | 0 team 1, 1 team 2, -1 (255) spectator; in territory and object packets any other value is neutral | 0, 1, 255 spectator |
| Weapon | 0 rifle, 1 SMG, 2 shotgun (anything else: rifle) | the same in join; the guns and their parameters come from Create and weapon parameters |
| Tool | 0 spade, 1 block, 2 gun, 3 grenade (anything else: spade) | slots: 0 melee, 1 block, 2 weapon 1, 3 weapon 2, 4 weapon 3 |
F.2 The CP437 table
Bytes 0x20 to 0x7E are ASCII, 0x7F is a house (U+2302) and 0xFF is a no-break space. Bytes 0x01 to 0x08 in chat are colour codes (A-TEXT-3), not glyphs. Bytes 0x80 to 0xFF map to Unicode as below (row = high nibble, column = low nibble).
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8x | Ç | ü | é | â | ä | à | å | ç | ê | ë | è | ï | î | ì | Ä | Å |
9x | É | æ | Æ | ô | ö | ò | û | ù | ÿ | Ö | Ü | ¢ | £ | ¥ | ₧ | ƒ |
Ax | á | í | ó | ú | ñ | Ñ | ª | º | ¿ | ⌐ | ¬ | ½ | ¼ | ¡ | « | » |
Bx | ░ | ▒ | ▓ | │ | ┤ | ╡ | ╢ | ╖ | ╕ | ╣ | ║ | ╗ | ╝ | ╜ | ╛ | ┐ |
Cx | └ | ┴ | ┬ | ├ | ─ | ┼ | ╞ | ╟ | ╚ | ╔ | ╩ | ╦ | ╠ | ═ | ╬ | ╧ |
Dx | ╨ | ╤ | ╥ | ╙ | ╘ | ╒ | ╓ | ╫ | ╪ | ┘ | ┌ | █ | ▄ | ▌ | ▐ | ▀ |
Ex | α | ß | Γ | π | Σ | σ | µ | τ | Φ | Θ | Ω | δ | ∞ | φ | ε | ∩ |
Fx | ≡ | ± | ≥ | ≤ | ⌠ | ⌡ | ÷ | ≈ | ° | ∙ | · | √ | ⁿ | ² | ■ |
F.3 The block palette
Eight rows of eight, in the classic order (grey ramp, then red, orange, yellow, green, cyan, blue and magenta, dark to light). Colours are R, G, B here; the wire sends B, G, R.
0f0f0f | 2f2f2f | 4f4f4f | 6f6f6f | 8f8f8f | afafaf | cfcfcf | efefef |
1f0000 | 5f0000 | 9f0000 | df0000 | ff1f1f | ff5f5f | ff9f9f | ffdfdf |
1f0f00 | 5f2f00 | 9f4f00 | df6f00 | ff8f1f | ffaf5f | ffcf9f | ffefdf |
1f1f00 | 5f5f00 | 9f9f00 | dfdf00 | ffff1f | ffff5f | ffff9f | ffffdf |
001f00 | 005f00 | 009f00 | 00df00 | 1fff1f | 5fff5f | 9fff9f | dfffdf |
001f1f | 005f5f | 009f9f | 00dfdf | 1fffff | 5fffff | 9fffff | dfffff |
00001f | 00005f | 00009f | 0000df | 1f1fff | 5f5fff | 9f9fff | dfdfff |
1f001f | 5f005f | 9f009f | df00df | ff1fff | ff5fff | ff9fff | ffdfff |
F.4 Disconnect codes at a glance
The 0.75 table is in A-DISC-1 and the 1.0 table in C-NET-5. The same field means different things on each, so decide by the protocol the connection was opened with. The one ambiguous case: connecting to a vanilla server with the 1.0 magic gives 3 and no Kick. ngspades-client names the reasons it knows (banned, connection limit, wrong protocol, server full, shutting down, kicked, invalid name) and shows every other number as unknown.
G. Testing your client
Against ngspades-server. The server is public (ngspades/server). Build it with make server and start it from the server folder: build/ngspades-server speaks protocol 1.0, build/ngspades-server --profile 075 speaks 0.75/0.76 with the extensions of section B. Both can run at once on one machine. Set SP_MASTER=0 so a test server never announces itself on the public list. make probe-proto10 runs the server's own 1.0 handshake probe (VXL and ngmap, and the error paths: wrong protocol, idle, garbage, early packet).
Against the protocol repository's examples. examples/c has a dependency-free 1.0 codec with golden vectors (make test), a real ENet client for both protocols and a master list reader; examples/godot has the same in GDScript plus a WebRTC client. Use them as a second opinion: when your client and the example disagree on a packet, one of them has a bug.
A conformance session. (1) Join a 0.75 server, a 0.76 server and a 1.0 server and walk the order of A-JOIN-1, C-HS-1. (2) Join the same server twice and check no map bytes on the second join (A-076-3, C-MAP-2). (3) Fuzz every inbound id (A-IN-1, C-NET-4). (4) Kick yourself and read the reason (A-DISC-1, C-NET-5). (5) Dig under a bridge and repaint a block under a pillar (A-RULE-2, A-RULE-3). (6) Chat with accents on a CP437 server and on a UTF-8 one (A-TEXT-1, A-TEXT-2). (7) Run the master requests of section D with a bad network and with a non-JSON answer.
H. Conformance matrix of ngspades-client
Status of ngspades-client against every requirement above, as of the date of the build. Supported means the behaviour is implemented and has been played; partial means a common case works and a documented corner does not; in progress means a known gap that is being worked on; not means not implemented. Rows describe behaviour that a server or a player can observe.
116 requirements: 97 supported, 11 partial, 8 in progress, 0 not implemented.
| Id | Requirement | ngspades-client | Note |
|---|---|---|---|
| A-NET-1 | Connect with ENet 1.3, one channel, range coder | supported | |
| A-NET-2 | Pick the protocol with the connect data | supported | |
| A-NET-3 | One game packet per ENet packet, one id byte first | in progress | length checks before decoding are being added |
| A-NET-4 | Everything reliable except World Update | supported | |
| A-NET-5 | Handle Map Start at any time | supported | |
| A-ADDR-1 | Parse aos:// addresses as a little-endian integer | supported | also accepts dotted and bare host:port |
| A-DISC-1 | Know the 0.75 disconnect reasons and show unknown ones as unknown | partial | most reasons known; 0, 8, 9, 11 and 61 still show as unknown |
| A-TYPE-1 | Little-endian, packed, no padding | supported | |
| A-TYPE-2 | Colours are B, G, R | supported | |
| A-COORD-1 | Axes: x east, y south, z down | supported | converts to y-up at the boundary |
| A-COORD-2 | Voxel from float: floor each axis; positions are the eye | supported | |
| A-COORD-3 | Wrap the terrain for drawing, not for rules | partial | terrain drawing wraps; grenade wrap not independently checked |
| A-TEXT-1 | Decode text as UTF-8 only after 0xFF, otherwise CP437 | partial | also guesses UTF-8 when the 0xFF prefix is missing |
| A-TEXT-2 | Send CP437 when everything fits, 0xFF + UTF-8 only to a server that reads it | supported | |
| A-TEXT-3 | Colour control bytes in chat | in progress | yellow (0x08) is not drawn yet |
| A-JOIN-1 | Follow the join order | supported | |
| A-JOIN-2 | Join with Existing Player; accept Short Player Data on the server's side only | supported | |
| A-JOIN-3 | Existing Player has no position | in progress | players are not yet parked out of sight until placed |
| A-JOIN-4 | Create Player: reset and restock | in progress | a 16-byte packet still clears the name |
| A-JOIN-5 | Answer Version Get, Handshake Init and Ext Info; never require them | supported | |
| A-IN-1 | Dispatch every inbound id and validate before use | in progress | length and enum validation in progress |
| A-IN-2 | Position Data and Orientation Data are corrections to you | in progress | Orientation Data handling being fixed |
| A-IN-3 | World Update: skip yourself, keep the last position on zeros | supported | zero positions keep the last one |
| A-IN-4 | Input Data and Weapon Input describe other players | supported | |
| A-IN-5 | Set HP, Kill Action, Restock | partial | hurt effect only for gun damage; restock accepted while dead |
| A-IN-6 | Grenade: velocity is in blocks per 1/32 s | supported | |
| A-IN-7 | Set Tool and Set Color are kept for every player | partial | out-of-range values are not all normalized |
| A-IN-8 | State Data: 83 bytes for CTF, 32 + 13n for TC | partial | an unknown mode is not yet treated as TC |
| A-IN-9 | CTF and TC objects | in progress | neutral handling of invalid team values in progress |
| A-IN-10 | Chat Message types | supported | |
| A-IN-11 | Fog Color, Weapon Reload, Player Left | supported | |
| A-OUT-1 | Report position and orientation | partial | thresholds differ slightly from the classic client |
| A-OUT-2 | Report input and buttons when they change | supported | |
| A-OUT-3 | Report only hits you saw | supported | |
| A-OUT-4 | Throw grenades with the fuse that is left | supported | |
| A-OUT-5 | Reload and chat | supported | |
| A-RULE-1 | Block action semantics | partial | actions 4 and 5 are ignored |
| A-RULE-2 | Batch the edits that arrive together: creates first, then destroys | in progress | per-batch application being added |
| A-RULE-3 | Block gravity | partial | runs on a worker; checks around already-empty cells being fixed |
| A-RULE-4 | Fog is a cylinder of radius 128 | supported | 128 by default, adjustable by the player up to the server's fog on 1.0 |
| A-RULE-5 | Cast rays with a DDA | supported | |
| A-RULE-6 | Sectors | supported | |
| A-RULE-7 | The 64-colour block palette | partial | row change at the edges differs from the classic cursor |
| A-RULE-8 | Colour copy | partial | only works with a block in hand |
| A-RULE-9 | Player physics is the server's; predict it, do not invent it | supported | |
| A-076-1 | Connect data 4 | supported | |
| A-076-2 | Map Start carries size, CRC32 and name | supported | |
| A-076-3 | Answer Map Cached; cache by CRC32 | supported | |
| A-076-4 | World Update has player ids | supported | |
| A-LIST-1 | Read serverlist.json defensively | supported | |
| B-EXT-1 | Answer Ext Info with the intersection, never more | supported | |
| B-EXT-2 | Layout: count, then (id, version) pairs | supported | |
| B-EXT-3 | Extension packets: id 64 + extension id, then a sub-packet byte | supported | |
| B-EXT-4 | Know the registry | supported | |
| B-PROP-1 | Player Properties (0x00) | supported | |
| B-DMG-1 | Damage Markers (0x20) | supported | |
| B-TEAM-1 | Teamplay Config (0x30, sub 0) | supported | |
| B-TEAM-2 | Teamplay pings and ESP marks | supported | |
| B-PIE-1 | Pie Menu (0x31) | supported | |
| B-LIGHT-1 | Flashlight (0x32): ask, and draw only what the server switched on | supported | |
| B-LIGHT-2 | A light goes off silently | supported | |
| B-SKY-1 | Daytime and Weather (0x33) | supported | |
| B-OUTFIT-1 | Player Outfit (0x35, a draft) | supported | |
| B-LIMIT-1 | Player Limit (0xC0) | supported | |
| B-MSG-1 | Message Types (0xC1): chat types 3 to 6 | supported | |
| B-KICK-1 | Kick Reason (0xC2) | supported | |
| B-VER-1 | Extended Version Get and Version Send | supported | |
| B-UTF8-1 | UTF-8 chat announcement | supported | |
| C-NET-1 | Connect with the 1.0 magic and two channels | supported | |
| C-NET-2 | Channel 0 reliable, channel 1 unreliable for your body | supported | |
| C-NET-3 | Treat connect refusal as not 1.0 and fall back | supported | |
| C-NET-4 | Strict decoder: reject, ignore, never guess | supported | |
| C-NET-5 | Disconnect reasons of 1.0 are another table | supported | |
| C-NET-6 | Be ready for a handshake and map timeout | supported | |
| C-HS-1 | Follow the handshake order | supported | |
| C-HS-2 | Initiate Connection fields | supported | |
| C-HS-3 | Certificates: isValid 0, or a connect token | supported | |
| C-HS-4 | The world may restart at any time | supported | |
| C-MAP-1 | Read the Game State Header | supported | 512 and 1024 square maps |
| C-MAP-2 | Skip a map you already have: map-cached | supported | |
| C-MAP-3 | Assemble the stream; keep Terrain Updates until the map is ready | supported | |
| C-MAP-4 | Always acknowledge | supported | |
| C-MAP-5 | Decode vxl with the 0.75 loader; ngmap with a port, not a rewrite | supported | |
| C-MAP-6 | Terrain Update: cursor deltas, R G B, one gravity pass | supported | |
| C-STATE-1 | Game State Final and world parameters | supported | |
| C-ENT-1 | Entity Update: a delta against the last value | supported | |
| C-ENT-2 | Field order is not bit order | supported | |
| C-ENT-3 | Ignore parts for your own entity, unless forced or Create | supported | |
| C-ENT-4 | Trajectories, including the compact player form | supported | |
| C-ENT-5 | Entity Event, Entity Die, Entity Remove, Damage | supported | |
| C-ENT-6 | Player Update and Player Remove | supported | |
| C-OWN-1 | Join, then report your body at a steady rate | supported | |
| C-OWN-2 | Send the input before the action | supported | |
| C-OWN-3 | Report hits, builds and throws | supported | |
| C-OWN-4 | Actions on your body: Player Action | supported | |
| C-OWN-5 | Chat | supported | |
| C-GEN-1 | Generic Commands: send the ones you use, ignore the rest | supported | |
| C-MODE-1 | Game Mode State: snapshot or delta | supported | |
| C-MODE-2 | Objectives are entities | supported | |
| C-WRT-1 | Two DataChannels, created before the offer | supported | browser build and desktop join codes |
| C-WRT-2 | Signal through the master, without trickle ICE | supported | |
| C-WRT-3 | Send connect before Initiate Connection | supported | |
| D-LIST-1 | Read our list: GET /v1/servers | supported | |
| D-LIST-2 | Merge with the classic list, ours winning | supported | |
| D-LIST-3 | The row decides the protocol | supported | |
| D-CODE-1 | Join codes | supported | |
| D-PING-1 | Ping with HELLO, ask details with a padded HELLOINFO | supported | |
| D-PING-2 | LAN discovery | supported | |
| D-PREV-1 | Map preview by chunks | supported | not in the browser (no UDP) |
| E-IPV6-1 | Dual-stack sockets | supported | |
| E-UTF8-1 | UTF-8 names and chat, both ways | supported | |
| E-RELOAD-1 | On 0.75/0.76, ammo is the server's | supported | |
| E-AIM-1 | Aim assist only when the server allows it | supported | |
| E-DEMO-1 | Record and play back packets | supported | |
| E-DEV-1 | Announce your input device | supported | |
| E-CACHE-1 | Housekeeping for the map cache | supported |
I. Credits and sources
Written from the public protocol pages (protocol documentation), the public server repository and its implementer guides, and the aosprotocol specification. The idea of a numbered checklist of client requirements, and several of its good rules (a forewarning about references, "do not write your own UTF-8 decoder", DDA ray casting, batching block edits), come from the AoS 0.75.015 Canon Client Doc by "not a burner"; the text here is our own. Text: CC BY 4.0.