Complete C# server cutover
This commit is contained in:
@@ -1,231 +1,50 @@
|
||||
# Commonwealth Online Qt GUI - Setup Instructions
|
||||
# Setup
|
||||
|
||||
## Quick Setup (3 Steps)
|
||||
## Dedicated server development
|
||||
|
||||
### Step 1: Install Qt6
|
||||
|
||||
1. Download Qt6 from: **https://www.qt.io/download-open-source**
|
||||
2. Run the installer and select:
|
||||
- ✓ Qt 6.8 (or latest 6.x)
|
||||
- ✓ MSVC 2022 64-bit component
|
||||
- Install to default location: `C:\Qt\6.8.0\`
|
||||
|
||||
3. After installation, verify the path exists:
|
||||
```
|
||||
C:\Qt\6.8.0\msvc2022_64\lib\cmake\Qt6
|
||||
```
|
||||
|
||||
### Step 2: Verify Prerequisites
|
||||
|
||||
Run the setup checker:
|
||||
Install the .NET 8 SDK.
|
||||
|
||||
```bash
|
||||
cd host-gui
|
||||
check-setup.bat
|
||||
cd server
|
||||
dotnet build CommonwealthOnline.Server.csproj -c Release
|
||||
dotnet run --project tests/CommonwealthOnline.Server.Tests.csproj -c Release
|
||||
```
|
||||
|
||||
This verifies:
|
||||
- ✓ CMake 3.20+
|
||||
- ✓ Visual Studio 2022
|
||||
- ✓ Qt6 installation
|
||||
|
||||
### Step 3: Build
|
||||
Run from source:
|
||||
|
||||
```bash
|
||||
cd host-gui
|
||||
dotnet run --project CommonwealthOnline.Server.csproj -- serve --config commonwealth-server.json --interactive
|
||||
```
|
||||
|
||||
## Windows Qt Host development
|
||||
|
||||
Required:
|
||||
|
||||
- Visual Studio 2022 with C++ tools
|
||||
- CMake 3.20+
|
||||
- Qt 6.4+ MSVC 2022 package
|
||||
- .NET 8 SDK
|
||||
|
||||
Run:
|
||||
|
||||
```bat
|
||||
check-setup.bat
|
||||
build.bat
|
||||
```
|
||||
|
||||
The script will:
|
||||
1. Auto-detect Qt6 location
|
||||
2. Configure CMake
|
||||
3. Build Release executable
|
||||
4. Output: `host-gui/build/bin/Release/CommonwealthOnlineHost.exe`
|
||||
CMake builds the Qt host and publishes the bundled C# server as a self-contained Windows executable under the staged `server` directory beside the host.
|
||||
|
||||
---
|
||||
## GameNetworkingSockets
|
||||
|
||||
## Detailed Setup (If Quick Setup Fails)
|
||||
The authoritative server is C#. Valve GameNetworkingSockets remains in the native C++ bridge under `server/native_transport`.
|
||||
|
||||
### Manual Qt6 Installation
|
||||
A server with `enable_gns_transport: true` needs the appropriate bridge library beside the server or a valid `gns_bridge_path`.
|
||||
|
||||
1. **Download Qt Online Installer**
|
||||
- Go to https://www.qt.io/download-open-source
|
||||
- Download "Qt Online Installer for Windows"
|
||||
## Ports
|
||||
|
||||
2. **Run Installer**
|
||||
- Create Qt account (free)
|
||||
- Select "Custom installation"
|
||||
- Under "Qt 6.8.0" (or latest):
|
||||
- ✓ MSVC 2022 64-bit
|
||||
- ✓ Qt 5compat (optional)
|
||||
- Under "Developer and Designer Tools":
|
||||
- ✓ CMake (if not already installed)
|
||||
- Click "Install"
|
||||
- Gameplay TCP compatibility: TCP 7777 by default
|
||||
- GNS gameplay: UDP 7777 by default when enabled
|
||||
- LAN discovery: UDP 7778
|
||||
- Admin control: TCP 127.0.0.1:7779 by default
|
||||
|
||||
3. **Verify Installation**
|
||||
- Check that this folder exists:
|
||||
```
|
||||
C:\Qt\6.8.0\msvc2022_64\
|
||||
```
|
||||
- Should contain:
|
||||
```
|
||||
lib\cmake\Qt6\
|
||||
bin\
|
||||
include\
|
||||
plugins\
|
||||
```
|
||||
|
||||
### Manual CMake Installation
|
||||
|
||||
If CMake isn't found:
|
||||
|
||||
1. Download from: https://cmake.org/download/
|
||||
2. Run installer
|
||||
3. When prompted, select "Add CMake to PATH"
|
||||
4. Restart your terminal/command prompt
|
||||
|
||||
### Manual Visual Studio 2022 Installation
|
||||
|
||||
If Visual Studio 2022 isn't found:
|
||||
|
||||
1. Download from: https://visualstudio.microsoft.com/downloads/
|
||||
2. Run installer
|
||||
3. Select "Desktop development with C++"
|
||||
4. Install
|
||||
|
||||
---
|
||||
|
||||
## Building Manually (If Scripts Fail)
|
||||
|
||||
### Command Line Build
|
||||
|
||||
```bash
|
||||
cd host-gui
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
# Configure (replace path with your Qt6 location)
|
||||
cmake .. -G "Visual Studio 17 2022" -DCMAKE_PREFIX_PATH="C:\Qt\6.8.0\msvc2022_64"
|
||||
|
||||
# Build Release
|
||||
cmake --build . --config Release
|
||||
```
|
||||
|
||||
### Visual Studio IDE Build
|
||||
|
||||
1. Open Visual Studio 2022
|
||||
2. File → Open → Folder
|
||||
3. Select `host-gui` folder
|
||||
4. Wait for CMake configuration
|
||||
5. Build → Build All
|
||||
6. Executable at: `host-gui/build/bin/Release/CommonwealthOnlineHost.exe`
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### "Qt6 not found"
|
||||
|
||||
**Solution 1**: Edit `build.bat` and update Qt6 search paths
|
||||
- Find the line with `PATHS_TO_CHECK`
|
||||
- Add your Qt6 installation path
|
||||
|
||||
**Solution 2**: Use manual CMake with explicit path
|
||||
```bash
|
||||
cmake .. -G "Visual Studio 17 2022" -DCMAKE_PREFIX_PATH="C:\path\to\your\Qt6"
|
||||
```
|
||||
|
||||
### "Visual Studio not found"
|
||||
|
||||
Make sure Visual Studio 2022 is installed with C++ development tools:
|
||||
1. Open Visual Studio Installer
|
||||
2. Modify your installation
|
||||
3. Select "Desktop development with C++"
|
||||
4. Click "Modify"
|
||||
|
||||
### "CMake not found"
|
||||
|
||||
Add CMake to PATH:
|
||||
1. Install CMake from cmake.org
|
||||
2. Select "Add CMake to PATH"
|
||||
3. Restart terminal
|
||||
|
||||
### "Build fails with link errors"
|
||||
|
||||
Ensure you're using the matching MSVC version:
|
||||
- Qt6 installed for MSVC 2022 64-bit
|
||||
- Building with "Visual Studio 17 2022" generator
|
||||
- Using Release build configuration
|
||||
|
||||
---
|
||||
|
||||
## Running the Application
|
||||
|
||||
After successful build:
|
||||
|
||||
```bash
|
||||
cd host-gui
|
||||
start build\bin\Release\CommonwealthOnlineHost.exe
|
||||
```
|
||||
|
||||
Or double-click:
|
||||
```
|
||||
host-gui\build\bin\Release\CommonwealthOnlineHost.exe
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Environment Setup (Advanced)
|
||||
|
||||
If you want to set up your environment permanently:
|
||||
|
||||
### Windows Environment Variables
|
||||
|
||||
1. Press `Win + X`, select "System"
|
||||
2. Click "Advanced system settings"
|
||||
3. Click "Environment Variables"
|
||||
4. Add or update:
|
||||
```
|
||||
CMAKE_PREFIX_PATH = C:\Qt\6.8.0\msvc2022_64
|
||||
```
|
||||
5. Restart terminal
|
||||
|
||||
Then you can just run:
|
||||
```bash
|
||||
cd host-gui
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Next Steps After Build
|
||||
|
||||
Once you have a successful build:
|
||||
|
||||
1. **Test the Application**
|
||||
- Launch `CommonwealthOnlineHost.exe`
|
||||
- Click "Start Server"
|
||||
- Verify logs appear
|
||||
|
||||
2. **Connect Clients**
|
||||
- Run fake_client from server directory
|
||||
- Should see client in GUI table
|
||||
|
||||
3. **Customize**
|
||||
- Edit colors/styling in `MainWindow.cpp`
|
||||
- Add admin buttons in `MainWindow.h/cpp`
|
||||
- Extend ServerProcess for more features
|
||||
|
||||
---
|
||||
|
||||
## Support
|
||||
|
||||
If you encounter issues:
|
||||
|
||||
1. Run `check-setup.bat` to verify prerequisites
|
||||
2. Review output and error messages carefully
|
||||
3. Check this troubleshooting guide
|
||||
4. Try manual CMake command with explicit paths
|
||||
The admin port must remain localhost-only.
|
||||
|
||||
Reference in New Issue
Block a user