create_room
Create a new game room and become the host. Transition from lobby to active room by specifying a scenario. Configure optional settings for max turns, team assignments, and turn time limits.
Instructions
Create a new room, seating the caller in slot A as the host.
Transitions the caller from IN_LOBBY to IN_ROOM. Fails if the caller isn't IN_LOBBY or already has a room, if the scenario doesn't load, or if the config fields don't validate.
If max_turns is not provided, defaults to whatever the
scenario declares in its YAML rules block.
── Locking ── Field validation + scenario load happen OUTSIDE state_lock (pure I/O on YAML). The actual registration (rooms.create + conn_to_room write + conn.state flip + heartbeat_state write) is done atomically under state_lock with a re-check of the caller's state so a concurrent transition can't slip us into a torn state.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| connection_id | Yes | ||
| scenario | Yes | ||
| max_turns | No | ||
| team_assignment | No | fixed | |
| host_team | No | blue | |
| fog_of_war | No | none | |
| turn_time_limit_s | No |