From aaaef9ecff49c8b20813906d2da70b11e93238c6 Mon Sep 17 00:00:00 2001 From: yallex Date: Sun, 9 Aug 2026 10:54:42 +0300 Subject: [PATCH 1/3] Let a deployment turn the camera on MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit skysim renders camera frames and no deployment can ask it to: the entrypoint maps SKYSIM_TILES, SKYSIM_DT and the rest into flags but has no camera mapping, so --camera-fps is never passed and the render service is never built. That is the state on dev — the service is running the rendering build, the gateway is pointed at it, and there are no pictures. SKYSIM_CAMERA_FPS is the switch, matching the CLI where --camera-fps is what decides whether the render service exists at all. Size, quality, threads, fov, pitch and range apply once it is on. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_017cgM68QE3FDz7S2pQAfTaZ --- README.md | 17 +++++++++++++++++ docker-entrypoint.sh | 21 +++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/README.md b/README.md index 4acc4d5..ee4d5cf 100644 --- a/README.md +++ b/README.md @@ -183,6 +183,23 @@ 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_SPAWN_HOME`, and `SKYSIM_EXTRA_ARGS` for +anything not listed. + +**`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 +``` + --- ## Control plane (`--api-port`) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 6035a59..8fe7db8 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -32,6 +32,27 @@ if [[ -n "${SKYSIM_SPAWN_HOME:-}" ]]; then args+=(--spawn-home "${SKYSIM_SPAWN_HOME}") fi +# 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. +add_if_set() { # env-var-name flag + local value="${!1:-}" + if [[ -n "$value" ]]; then + args+=("$2" "$value") + fi +} + +if [[ -n "${SKYSIM_CAMERA_FPS:-}" ]]; then + args+=(--camera-fps "${SKYSIM_CAMERA_FPS}") + args+=(--camera-size "${SKYSIM_CAMERA_SIZE:-256x144}") + 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 # shellcheck disable=SC2206 # deliberate word splitting: caller supplies flags extra=(${SKYSIM_EXTRA_ARGS}) From b0672d40184aebeeef1ecd85d43918222aa960d3 Mon Sep 17 00:00:00 2001 From: yallex Date: Sun, 9 Aug 2026 11:05:58 +0300 Subject: [PATCH 2/3] Let a deployment choose the time mode too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit skysim defaults to strict — barrier every tick, abort on a miss — because that is what determinism and CI replays need. A long-lived server wants the opposite: vehicles join and leave, some lag, and none of that should take the fleet down. There was no way to say so. The entrypoint mapped --dt but not --time-mode, so every containerised deployment ran strict unless it hand-wrote SKYSIM_EXTRA_ARGS. Dev does run strict, and it is why a vehicle that reserved its slot correctly then vanished from the fleet: its 200 Hz scheduler answers one tick in four of an 800 Hz world, and strict mode drops the straggler. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_017cgM68QE3FDz7S2pQAfTaZ --- README.md | 11 +++++++++-- docker-entrypoint.sh | 11 +++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ee4d5cf..e152b81 100644 --- a/README.md +++ b/README.md @@ -185,8 +185,15 @@ docker run --rm -p 8642:8642 -p 9002-9202:9002-9202/udp \ `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_SPAWN_HOME`, and `SKYSIM_EXTRA_ARGS` for -anything not listed. +`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` diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 8fe7db8..9b817a0 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -28,6 +28,17 @@ if [[ -n "${SKYSIM_DT:-}" ]]; then args+=(--dt "${SKYSIM_DT}") fi +# 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. +if [[ -n "${SKYSIM_TIME_MODE:-}" ]]; then + args+=(--time-mode "${SKYSIM_TIME_MODE}") +fi + if [[ -n "${SKYSIM_SPAWN_HOME:-}" ]]; then args+=(--spawn-home "${SKYSIM_SPAWN_HOME}") fi From a97cc82c601ebc432316310fa0904ca2eb384c1c Mon Sep 17 00:00:00 2001 From: yallex Date: Sun, 9 Aug 2026 14:47:24 +0300 Subject: [PATCH 3/3] One env-to-flag mapping, used by all of them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add_if_set was introduced and then only the camera block used it — the same change hand-wrote SKYSIM_TIME_MODE in the old three-line form, next to SKYSIM_DT and SKYSIM_SPAWN_HOME already written that way. Hoisted above first use; nine lines become three. --camera-size stops restating 256x144, which src/main.cpp already defaults to. Written out in the entrypoint, the README and the terraform task definition, it meant changing the default in main.cpp would silently change nothing in a container. Verified by running the entrypoint with exec stubbed, for camera off, everything set, and camera on with size unset. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_017cgM68QE3FDz7S2pQAfTaZ --- docker-entrypoint.sh | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 9b817a0..e52c0af 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -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}") @@ -24,9 +34,7 @@ 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. # @@ -35,28 +43,17 @@ fi # 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. -if [[ -n "${SKYSIM_TIME_MODE:-}" ]]; then - args+=(--time-mode "${SKYSIM_TIME_MODE}") -fi +add_if_set SKYSIM_TIME_MODE --time-mode -if [[ -n "${SKYSIM_SPAWN_HOME:-}" ]]; then - args+=(--spawn-home "${SKYSIM_SPAWN_HOME}") -fi +add_if_set SKYSIM_SPAWN_HOME --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. -add_if_set() { # env-var-name flag - local value="${!1:-}" - if [[ -n "$value" ]]; then - args+=("$2" "$value") - fi -} - if [[ -n "${SKYSIM_CAMERA_FPS:-}" ]]; then args+=(--camera-fps "${SKYSIM_CAMERA_FPS}") - args+=(--camera-size "${SKYSIM_CAMERA_SIZE:-256x144}") + 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