Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,30 @@ docker run --rm -p 8642:8642 -p 9002-9202:9002-9202/udp \
-v $(pwd)/build/city/tiles:/world:ro -e SKYSIM_TILES=/world skysim
```

`docker-entrypoint.sh` turns `SKYSIM_*` variables into flags: `SKYSIM_API_BIND`,
`SKYSIM_API_PORT`, `SKYSIM_VEHICLES`, `SKYSIM_TILES`, `SKYSIM_STREAM_RADIUS`,
`SKYSIM_STREAM_MAX`, `SKYSIM_DT`, `SKYSIM_TIME_MODE`, `SKYSIM_SPAWN_HOME`, and
`SKYSIM_EXTRA_ARGS` for anything not listed.

**Set `SKYSIM_TIME_MODE=interactive` on a long-lived server.** The default is `strict`,
which is what determinism and CI replays need — a barrier every tick, and an abort when
a vehicle misses it. A server that vehicles join and leave wants the opposite, or one
lagging aircraft takes the fleet down with it. Match `SKYSIM_DT` to the scheduler rate
the vehicles are launched with, too: in lockstep, physics faster than the autopilot's
loop means most ticks miss their deadline.

**`SKYSIM_CAMERA_FPS` is the camera switch.** Without it no frames are rendered and
the camera endpoints serve nothing, whatever else is set. With it, `SKYSIM_CAMERA_SIZE`
(default `256x144`), `SKYSIM_CAMERA_QUALITY`, `SKYSIM_CAMERA_THREADS`,
`SKYSIM_CAMERA_FOV`, `SKYSIM_CAMERA_PITCH` and `SKYSIM_CAMERA_RANGE` apply:

```bash
docker run --rm -p 8642:8642 -p 9002-9202:9002-9202/udp \
-v $(pwd)/build/city/tiles:/world:ro -e SKYSIM_TILES=/world \
-e SKYSIM_CAMERA_FPS=10 -e SKYSIM_CAMERA_SIZE=256x144 skysim
# http://localhost:8642/instances/0/camera.mjpg
Comment on lines +204 to +207

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make the camera example create or reserve a vehicle.

At Line 197, the command leaves SKYSIM_VEHICLES at the Dockerfile default 0. The per-instance route at src/api/control_server.cpp:317-345 therefore has no vehicle-specific frame for the documented instance 0.

Set SKYSIM_VEHICLES=1, or document the POST /vehicles step before opening the URL.

Proposed documentation fix
 docker run --rm -p 8642:8642 -p 9002-9202:9002-9202/udp \
   -v $(pwd)/build/city/tiles:/world:ro -e SKYSIM_TILES=/world \
+  -e SKYSIM_VEHICLES=1 \
   -e SKYSIM_CAMERA_FPS=10 -e SKYSIM_CAMERA_SIZE=256x144 skysim
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
docker run --rm -p 8642:8642 -p 9002-9202:9002-9202/udp \
-v $(pwd)/build/city/tiles:/world:ro -e SKYSIM_TILES=/world \
-e SKYSIM_CAMERA_FPS=10 -e SKYSIM_CAMERA_SIZE=256x144 skysim
# http://localhost:8642/instances/0/camera.mjpg
docker run --rm -p 8642:8642 -p 9002-9202:9002-9202/udp \
-v $(pwd)/build/city/tiles:/world:ro -e SKYSIM_TILES=/world \
-e SKYSIM_VEHICLES=1 \
-e SKYSIM_CAMERA_FPS=10 -e SKYSIM_CAMERA_SIZE=256x144 skysim
# http://localhost:8642/instances/0/camera.mjpg
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 197 - 200, Update the README camera Docker command to
set SKYSIM_VEHICLES=1, ensuring the documented instance 0 has a vehicle-specific
frame available when the camera URL is opened.

```

---

## Control plane (`--api-port`)
Expand Down
39 changes: 34 additions & 5 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ set -euo pipefail

args=(--api-bind "${SKYSIM_API_BIND:-0.0.0.0}" --api-port "${SKYSIM_API_PORT:-8642}")

# One mapping, used by everything below: set the variable, get the flag; leave it
# unset and the binary's own default stands, so a default lives in one place
# rather than being restated here.
add_if_set() { # env-var-name flag
local value="${!1:-}"
if [[ -n "$value" ]]; then
args+=("$2" "$value")
fi
}

# Vehicles are normally spawned on demand over the control plane, so default to
# starting with none rather than skysim's built-in default of one.
args+=(--vehicles "${SKYSIM_VEHICLES:-0}")
Expand All @@ -24,12 +34,31 @@ if [[ -n "${SKYSIM_TILES:-}" ]]; then
fi
fi

if [[ -n "${SKYSIM_DT:-}" ]]; then
args+=(--dt "${SKYSIM_DT}")
fi
add_if_set SKYSIM_DT --dt

# Time mode, which a deployment could not set at all before.
#
# skysim defaults to strict because that is what determinism and CI replays need:
# a barrier every tick, and an abort when a vehicle misses it. A long-lived server
# wants the opposite — vehicles join and leave, some of them lag, and none of that
# should take the fleet down. Without this the only way to say so was
# SKYSIM_EXTRA_ARGS, so every deployment quietly ran strict.
add_if_set SKYSIM_TIME_MODE --time-mode

add_if_set SKYSIM_SPAWN_HOME --spawn-home

if [[ -n "${SKYSIM_SPAWN_HOME:-}" ]]; then
args+=(--spawn-home "${SKYSIM_SPAWN_HOME}")
# Camera. SKYSIM_CAMERA_FPS is the switch — without --camera-fps the render
# service is never built and every other camera setting is inert, which is
# exactly how a deployment ends up serving a control plane with no pictures on
# it. The rest only apply once it is on.
if [[ -n "${SKYSIM_CAMERA_FPS:-}" ]]; then
args+=(--camera-fps "${SKYSIM_CAMERA_FPS}")
add_if_set SKYSIM_CAMERA_SIZE --camera-size
add_if_set SKYSIM_CAMERA_QUALITY --camera-quality
add_if_set SKYSIM_CAMERA_THREADS --camera-threads
add_if_set SKYSIM_CAMERA_FOV --camera-fov
add_if_set SKYSIM_CAMERA_PITCH --camera-pitch
add_if_set SKYSIM_CAMERA_RANGE --camera-range
fi

if [[ -n "${SKYSIM_EXTRA_ARGS:-}" ]]; then
Expand Down