## aot-wine-x11-novnc-docker Overview ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/skylord123/aot-wine-x11-novnc-docker/latest) ![Docker Pulls](https://img.shields.io/docker/pulls/skylord123/aot-wine-x11-novnc-docker) This Docker image facilitates running the AgeOfTime game client within an Ubuntu container, utilizing Wine for application compatibility. It includes a noVNC server for browser-based application access, and employs Supervisor for process management to ensure failed processes are automatically restarted. **Key Features:** - **Automated Process Management:** Implements a script designed to automatically terminate the game process upon detection of a Wine "Program Error" dialog. This ensures that in the event of a crash, where Age Of Time might not exit cleanly and thus remain unresponsive, the system intervenes to stop the process, enabling Supervisor to recognize the failure and restart the application as needed. - **CPU Usage Control:** Employs `cpulimit` on the AgeOfTime.exe process based on the `AOT_CPU_LIMIT` environment variable (when defined and non-zero), ensuring efficient CPU resource utilization. **Components:** - **Xvfb:** Provides an X11 server within a virtual framebuffer. - **x11vnc:** A VNC server capturing the X11 server output for remote access. - **[noVNC](https://kanaka.github.io/noVNC/):** A web-based VNC viewer utilizing HTML5 canvas for display. - **PulseAudio:** An audio server to handle game audio requirements. Note: AgeOfTime experiences crashes without proper audio support. - **Audio Streaming (Under Development):** Components like audiostream and websockify_audio aim to forward audio to the VNC web session, though currently non-functional. - **Fluxbox:** A lightweight window manager to manage application windows. - **AgeOfTime.exe:** The game's executable file. - **aot-monitor.sh:** A background script ensuring the game process is terminated upon detecting "Program Error" dialogs. This script also manages the application of `cpulimit` based on the `AOT_CPU_LIMIT` environment variable. This Docker image is available as a [trusted build on Docker Hub](https://registry.hub.docker.com/u/skylord123/aot-wine-x11-novnc-docker/), ensuring easy deployment and reliability. ## Environment Variables The container supports several environment variables that you can set to customize its behavior: - **`AOT_CPU_LIMIT`**: Specifies the percentage of CPU allowed for the container's use, mimicking the `-l` option of `cpulimit`. Acceptable values are from 1 upwards, typically ranging from 1 to 100, though values can exceed 100 on multi-core CPUs. The default setting is `0`, indicating no specific limit. However, it's recommended to manage CPU access by limiting the number of available CPUs to the container via `docker-compose.yaml` (e.g., to one or two cores) rather than solely relying on this variable. If a value is set, it is recorded in the `AgeOfTime` directory within a file named `aot_cpu_limit`, which is utilized to dynamically control the CPU limit (updated every second). - **`RESOLUTION`**: Sets the display resolution for X11 (and Age of Time if `AOT_AUTO_RES` is enabled), with a default value of `1024x768x24`. This impacts the display resolution of both the X11 environment and the Age of Time game when `AOT_AUTO_RES` is set to `true`. - **`AOT_AUTO_RES`**: By default set to `true`, this variable ensures that upon container startup, the `baes/client/prefs.cs` file within Age of Time is updated with the resolution specified by the `RESOLUTION` environment variable. It also enables fullscreen mode for the Age of Time game. - **`AOT_MINIMIZED`**: With a default value of `false`, setting this variable to `true` will cause the game to start in a minimized state. This action halts rendering processes, thus conserving CPU resources. It achieves this by switching focus to the `AgeOfTime.exe` console window. ## Run It Modify your `docker-compose.yml` file to your liking then: docker compose up Or using docker run docker run \ -p 8080:8080 \ -e "AOT_CPU_LIMIT=0" \ -e "RESOLUTION=640x480x24" \ skylord123/aot-wine-x11-novnc-docker Run with existing AgeOfTime folder (replace `/path/on/host`): docker run \ -p 8080:8080 \ -e "AOT_CPU_LIMIT=0" \ -e "RESOLUTION=640x480x24" \ --volume "/path/on/host:/root/prefix32/drive_c/Program Files (x86)/AgeOfTime" \ skylord123/aot-wine-x11-novnc-docker Go to `http://localhost:8080` in your browser and you should see AgeOfTime boot up. ## Issues * Audio isn't working correctly. Keeps crashing when supservisor tries to start it and shortly gives up. * Console output of game isn't being sent to the contrainer stdout (would be nice to fix this so the container logs show the game logs)