Give each running game its own screen, capped at 10 concurrent
Previously every game shared one always-on Xvnc/fluxbox/websockify desktop, so starting two games at once meant they fought over focus on the same screen and the same ALSA device. Now: - server.sh no longer starts a shared desktop at all - it just runs setup_server.py. There's no default display anymore. - start_game() allocates a free display from GAME_DISPLAY_NUMS (:90-:99, one per MAX_CONCURRENT_GAMES=10 slot), spins up a fresh Xvnc+fluxbox+websockify for it, and launches the game with DISPLAY set to that display. All four processes are tracked together per game. - stop_game() tears down all four; is_running() does the same lazily if the game exited on its own (crash/quit), so a slot doesn't stay stuck just because nobody clicked Stop. - Starting past the 10-slot cap is refused with an error shown on that game's row instead of silently failing. - Each running game's row gets its own "Open Screen" link (client-side JS, since the port is only known once the game is actually started) instead of one global noVNC link. - run.sh publishes the whole 8090-8099 noVNC port range up front, since Docker can't add port mappings to an already-running container. Verified end-to-end: two different games running concurrently get fully independent Xvnc/fluxbox/websockify/game process sets and noVNC endpoints; stopping one leaves the other untouched; the capacity guard correctly refuses a start at the limit. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NiNnj78HGx1KWyCCo39HSz
This commit is contained in:
+1
-1
@@ -2,7 +2,6 @@
|
||||
FROM ich777/novnc-baseimage
|
||||
|
||||
ENV DISPLAY_NUM=99
|
||||
ENV DISPLAY=:${DISPLAY_NUM}
|
||||
ENV GAMES_HOME=/opt/games
|
||||
ENV SCRIPTS_HOME=/opt/scripts
|
||||
ENV PATH=${PATH}:${SCRIPTS_HOME}
|
||||
@@ -25,6 +24,7 @@ WORKDIR /
|
||||
|
||||
EXPOSE 60${DISPLAY_NUM}
|
||||
EXPOSE 70${DISPLAY_NUM}
|
||||
EXPOSE 8090-8099
|
||||
EXPOSE 5900
|
||||
|
||||
ENTRYPOINT ["/opt/scripts/server_start.sh", "/opt/scripts/server.sh"]
|
||||
|
||||
Reference in New Issue
Block a user