---
title: "Packet 4: ClientData"
description: "Buffered client input applied at its matching simulation tick. Bit 7 of the player byte enables the palette; bits 0–6 hold the player ID."
canonical: "https://aosplay.net/protocol-168/packets/4"
markdown: "https://aosplay.net/docs/protocol-168/packets/4.md"
last_updated: "2026-07-16"
protocol: "Ace of Spades Battle Builder 168"
packet_id_decimal: "4"
packet_id_hex: "0x04"
direction: "C→S"
family: "Input"
implementation_status: "Handled"
evidence: "Live-verified"
wire_size: "16, 18, or 20 bytes"
---

# Packet 4: ClientData

> Buffered client input applied at its matching simulation tick. Bit 7 of the player byte enables the palette; bits 0–6 hold the player ID.

- **Decimal ID:** 4
- **Hex ID:** 0x04
- **Direction:** C→S
- **Family:** Input
- **Status:** Handled
- **Evidence:** Live-verified
- **Wire size:** 16, 18, or 20 bytes

## Implementation note

The tolerant runtime decoder bounds all three known payload lengths; the generated writer emits the 18-byte fixed16 form.

## Exact wire layout

The application packet ID is the first byte. The remaining rows are in decode order. Byte sizes exclude ENet headers, wrapper prefixes, LZF chunk framing, and compression effects.

| # | Field | Encoding | Bytes | Purpose | Condition |
| ---: | --- | --- | ---: | --- | --- |
| 0 | `packet_id` | u8 | 1 | Always 4 (0x04). | — |
| 1 | `loop_count` | i32 LE | 4 | Simulation-loop stamp used for ordering, prediction, or reconciliation. | — |
| 2 | `player_and_palette` | u8 | 1 | Bits 0–6 are player_id; bit 7 is palette_enabled. | — |
| 3 | `tool_id` | u8 | 1 | Equipped tool identifier. | — |
| 4 | `orientation_x` | orientation16 LE (1/8192) | 2 | orientation x value. | — |
| 5 | `orientation_y` | orientation16 LE (1/8192) | 2 | orientation y value. | — |
| 6 | `orientation_z` | orientation16 LE (1/8192) | 2 | orientation z value. | — |
| 7 | `opaque_orientation_byte` | u8 | 1 | Retail field retained as `ooo`; exact gameplay meaning remains unknown. | — |
| 8 | `input_flags` | u8 | 1 | 0x01 up, 0x02 down, 0x04 left, 0x08 right, 0x10 jump, 0x20 crouch, 0x40 sneak, 0x80 sprint. | — |
| 9 | `action_flags` | u8 | 1 | 0x01 primary, 0x02 secondary, 0x04 zoom, 0x08 pickup, 0x10 display weapon, 0x20 on fire, 0x40 deployed, 0x80 hover. | — |
| 10 | `weapon_deployment_yaw` | optional fixed16 or f32 LE | 0, 2, or 4 | Known retail variants omit this value or encode it as fixed16/f32. | Remaining payload bytes select the variant. |

## Encoding conventions

- `LE` means least-significant byte first.
- `fixed16` is two-byte sign-magnitude at 1/64 precision.
- `orientation16` uses the measured 1/8192 orientation mapping.
- NUL strings consume their encoded byte length plus one `00` terminator.
- Counted arrays repeat immediately in the documented order.

## Related resources

- [HTML packet page](https://aosplay.net/protocol-168/packets/4)
- [Complete packet catalog](https://aosplay.net/protocol-168/packets)
- [Packet catalog in Markdown](https://aosplay.net/docs/protocol-168/packets.md)
- [Protocol 168 guide](https://aosplay.net/protocol-168)
