Files
Commonwealth-Online-Public/host-gui/README.md
T
andrewandCursor 98266ec235 Add native C++ Qt6 GUI host application
Introduce production-grade desktop GUI for hosting Commonwealth Online servers.

Features:
- Native C++ Qt6 application with minimal dependencies
- Start/stop server buttons with live status indicator
- Real-time stats display (uptime, clients, packet counts)
- Live connected clients table
- Server log viewer with timestamps
- Fallout 4-inspired dark theme (amber/green accents)
- Subprocess management (server independent of GUI)
- Auto-detection of Python and server directory
- Professional error handling and graceful shutdown

Architecture:
- MainWindow: Qt UI components and layout
- ServerProcess: Manages Python relay subprocess
- Subprocess spawns consumer_server_cli.py
- Real-time log capture and parsing
- Qt signals/slots for UI updates

Build:
- CMake 3.20+ configuration
- Visual Studio 2022 MSVC compiler
- Qt6.4+ required
- Windows 10+ target
- build.bat script for easy compilation

Project structure:
- src/main.cpp - entry point
- src/MainWindow.h/cpp - main UI window
- src/ServerProcess.h/cpp - subprocess and IPC layer
- src/resources/ - Qt resources and icons
- CMakeLists.txt - Qt6 build config
- build.bat - Windows build script
- README.md - user guide
- DEVELOPMENT.md - developer guide

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-09 20:53:16 +12:00

2.7 KiB

Commonwealth Online - Qt GUI Host

Production-ready Qt6 GUI application for hosting Commonwealth Online servers on Windows.

Features

  • Start/Stop Server: One-click server control with live status indicator
  • Real-time Stats: Monitor uptime, connected players, packet rates
  • Client List: Live table showing connected clients and their connection details
  • Server Logs: Real-time log viewer with timestamps
  • Dark Theme: Fallout 4-inspired dark UI with amber/green accents
  • Auto-detection: Automatically finds Python and server directory
  • Subprocess Management: Server runs in separate process; GUI crash doesn't kill server

Requirements

  • Windows 10 or later
  • Qt 6.4+
  • Visual Studio 2022 (MSVC)
  • CMake 3.20+
  • Python 3.9+ (for running the relay server)

Building

From Visual Studio

  1. Clone the repository
  2. Open CMakeLists.txt in Visual Studio
  3. Configure the project (Visual Studio should auto-detect Qt6)
  4. Build → Build All
  5. Run the executable

From Command Line

cd host-gui
mkdir build
cd build
cmake .. -G "Visual Studio 17 2022"
cmake --build . --config Release

First Run

  1. Double-click CommonwealthOnlineHost.exe
  2. Click "▶ Start Server"
  3. Server will bind to 0.0.0.0:7777 (configurable in commonwealth-server.json)
  4. View real-time logs and connected clients

Configuration

Edit commonwealth-server.json in the server folder to customize:

  • host: Bind address
  • port: Server port
  • server_name: Display name
  • max_players: Max player count
  • log_verbosity: debug/info/warning/error

Layout

host-gui/
├── CMakeLists.txt              # Build configuration
├── README.md                   # This file
├── src/
│   ├── main.cpp                # Application entry point
│   ├── MainWindow.h/cpp        # Main window UI and logic
│   ├── ServerProcess.h/cpp     # Subprocess manager for relay server
│   └── resources/
│       ├── resources.qrc       # Qt resource manifest
│       └── icons/
│           └── app.ico         # Application icon
└── build/                      # Build output directory
    └── bin/
        └── CommonwealthOnlineHost.exe

Architecture

The GUI spawns the Python relay server (consumer_server_cli.py) as a subprocess and:

  • Captures stdout/stderr for real-time logs
  • Parses log output to extract stats and client info
  • Provides UI for server control and monitoring
  • Maintains server state even if GUI crashes

Future Enhancements

  • Admin commands (set time/weather directly from GUI)
  • Config file editor in GUI
  • Player kick/ban buttons
  • System tray icon with quick access
  • Settings panel for port customization
  • Server history and logs export