The dedicated server runs headless on macOS #30

Merged
agra merged 3 commits from task/3995-the-dedicated-server-runs-headless-on-ma into master 2026-10-31 11:38:24 +02:00
Owner

Tracker: #3995

Delivers server.sx, the dedicated server: step 1's serve loop (src/sim/host.sx) on its main thread over baked/first_map.hbw alone, with no window, GPU or SDL.

  • tools/sx build server.sx -o sx-out/macos/hulken-server builds it (configureServerBuild in build.sx bakes first, as the app's build does); tools/run_tests.sh runs that build, so the gate does. otool -L lists only /usr/lib/libSystem.B.dylib: no SDL3, Metal or QuartzCore.
  • It binds UDP on the default port 27960, or the one --port names; --join or any other argument prints its usage and exits 2 (serving() in src/net/launch.sx). A held port or a missing world file prints why and exits 1.
  • The server records each player that joins and leaves in its tick (PlayerEvent: joined, left, or silent for 10 s), and the serve loop prints them, in the dedicated server and in a hosting app's server thread alike.
  • It ticks at 60 Hz until SIGINT or SIGTERM stops it, then prints stopped and exits 0.
  • tests/dedicated_server.sx checks otool -L, starts the binary as a process on a free port, joins a scripted client over UDP, walks it for a second and sees its player move in the snapshots at 60 Hz, sees the join and leave printed, and stops it with SIGINT. net_handshake pins the join, leave and silent records; net_launch pins serving().
  • README: a "Dedicated server" section on building it, running it and joining it with --join 127.0.0.1.

In the app: run sx-out/macos/hulken-server in Terminal, then start two apps with open -n sx-out/macos/Hulken.app --args --join 127.0.0.1; both play on it.

Tracker: [#3995](https://sak.swipelab.com/tasks/3995) Delivers `server.sx`, the dedicated server: step 1's serve loop (`src/sim/host.sx`) on its main thread over `baked/first_map.hbw` alone, with no window, GPU or SDL. - `tools/sx build server.sx -o sx-out/macos/hulken-server` builds it (`configureServerBuild` in `build.sx` bakes first, as the app's build does); `tools/run_tests.sh` runs that build, so the gate does. `otool -L` lists only `/usr/lib/libSystem.B.dylib`: no SDL3, Metal or QuartzCore. - It binds UDP on the default port 27960, or the one `--port` names; `--join` or any other argument prints its usage and exits 2 (`serving()` in `src/net/launch.sx`). A held port or a missing world file prints why and exits 1. - The server records each player that joins and leaves in its tick (`PlayerEvent`: joined, left, or silent for 10 s), and the serve loop prints them, in the dedicated server and in a hosting app's server thread alike. - It ticks at 60 Hz until SIGINT or SIGTERM stops it, then prints `stopped` and exits 0. - `tests/dedicated_server.sx` checks `otool -L`, starts the binary as a process on a free port, joins a scripted client over UDP, walks it for a second and sees its player move in the snapshots at 60 Hz, sees the join and leave printed, and stops it with SIGINT. `net_handshake` pins the join, leave and silent records; `net_launch` pins `serving()`. - README: a "Dedicated server" section on building it, running it and joining it with `--join 127.0.0.1`. In the app: run `sx-out/macos/hulken-server` in Terminal, then start two apps with `open -n sx-out/macos/Hulken.app --args --join 127.0.0.1`; both play on it.
agra merged commit 01b7e2ff29 into master 2026-10-31 11:38:24 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sx/hulken!30
No description provided.