---
title: "Packet 45: StateData"
description: "The per-spawn GameScene snapshot: lighting, physics, mode, teams, class locks, prefabs, static entities, screenshot cameras, and rollover state."
canonical: "https://aosplay.net/protocol-168/packets/45"
markdown: "https://aosplay.net/docs/protocol-168/packets/45.md"
last_updated: "2026-07-16"
protocol: "Ace of Spades Battle Builder 168"
packet_id_decimal: "45"
packet_id_hex: "0x2D"
direction: "S→C"
family: "Replication"
implementation_status: "Sent"
evidence: "Implementation-backed"
wire_size: "Variable: 61-byte shell + strings, arrays, and entities"
---

# Packet 45: StateData

> The per-spawn GameScene snapshot: lighting, physics, mode, teams, class locks, prefabs, static entities, screenshot cameras, and rollover state.

- **Decimal ID:** 45
- **Hex ID:** 0x2D
- **Direction:** S→C
- **Family:** Replication
- **Status:** Sent
- **Evidence:** Implementation-backed
- **Wire size:** Variable: 61-byte shell + strings, arrays, and entities

## Implementation note

VIP and Zombie modes derive their class visibility and locks from this packet; malformed list shapes are crash-sensitive in the retail scene constructor.

## 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 45 (0x2D). | — |
| 1 | `player_id` | u8 | 1 | Receiving player's slot. | — |
| 2 | `fog_color` | BGR888 | 3 | Three colour channels written blue, green, then red. | — |
| 3 | `gravity` | sign-magnitude fixed16 LE (1/64) | 2 | gravity value. | — |
| 4 | `light_color` | BGR888 | 3 | Three colour channels written blue, green, then red. | — |
| 5 | `light_direction` | 3 × fixed16 LE (Z,Y,X) | 6 | Primary light direction written in reverse component order. | — |
| 6 | `back_light_color` | BGR888 | 3 | Three colour channels written blue, green, then red. | — |
| 7 | `back_light_direction` | 3 × fixed16 LE (Z,Y,X) | 6 | Back-light direction. | — |
| 8 | `ambient_light_color` | BGR888 | 3 | Three colour channels written blue, green, then red. | — |
| 9 | `ambient_light_intensity` | sign-magnitude fixed16 LE (1/64) | 2 | ambient light intensity value. | — |
| 10 | `time_scale` | sign-magnitude fixed16 LE (1/64) | 2 | time scale value. | — |
| 11 | `score_limit` | u8 | 1 | score limit value. | — |
| 12 | `mode_type` | u8 | 1 | mode type value. | — |
| 13 | `team_headcount_type` | u8 | 1 | team headcount type value. | — |
| 14 | `team1_name` | NUL-terminated UTF-8 string | N + 1 | team1 name value. | — |
| 15 | `team1_color` | BGR888 | 3 | Three colour channels written blue, green, then red. | — |
| 16 | `team1_score` | i32 LE | 4 | team1 score value. | — |
| 17 | `team1_flags` | u8 | 1 | Lock, visibility, score, infinite-block, class-lock, and score-lock bits. | — |
| 18 | `team1_class_count` | u8 | 1 | team1 class count value. | — |
| 19 | `team1_classes[]` | C1 × u8 | C1 | Allowed class IDs. | — |
| 20 | `team2_name` | NUL-terminated UTF-8 string | N + 1 | team2 name value. | — |
| 21 | `team2_color` | BGR888 | 3 | Three colour channels written blue, green, then red. | — |
| 22 | `team2_score` | i32 LE | 4 | team2 score value. | — |
| 23 | `team2_flags` | u8 | 1 | Lock, visibility, score, infinite-block, class-lock, and score-lock bits. | — |
| 24 | `team2_class_count` | u8 | 1 | team2 class count value. | — |
| 25 | `team2_classes[]` | C2 × u8 | C2 | Allowed class IDs. | — |
| 26 | `global_lock_flags` | u8 | 1 | Bit 0 locks team swap; bit 1 locks spectator swap. | — |
| 27 | `prefab_count` | u8 | 1 | prefab count value. | — |
| 28 | `prefab_padding` | u8 | 1 | Required zero padding. | — |
| 29 | `prefabs[]` | repeated NUL strings | Σ(N + 1) | Available prefab names. | — |
| 30 | `entity_count` | u8 | 1 | entity count value. | — |
| 31 | `entity_padding` | u8 | 1 | Required zero padding. | — |
| 32 | `entities[]` | Entity records | Σ(33 + 4I + 2F) | Static scene entities using the packet-21 inner layout. | — |
| 33 | `camera_point_count` | u8 | 1 | camera point count value. | — |
| 34 | `camera_points[]` | P × 3 × fixed16 LE (Z,Y,X) | 6P | Screenshot camera positions. | — |
| 35 | `camera_rotation_count` | u8 | 1 | camera rotation count value. | — |
| 36 | `camera_rotations[]` | R × 3 × fixed16 LE (Z,Y,X) | 6R | Screenshot camera rotations. | — |
| 37 | `has_map_ended` | boolean u8 | 1 | has map ended value. | — |

## 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/45)
- [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)
