Refactor server into reusable core and GUI

Split the monolithic test server into a reusable server core and a thin terminal launcher, and add a PySide6 developer GUI. Added server_core.py (FalloutTogetherServer) with lifecycle control, thread-safe client snapshots, stats and log listener support; added client_session.py for per-client state; added dev_server_app.py GUI and requirements.txt. Updated server.py to use the new server core, and revised server/README.md and docs/dev-log.md to document the new structure, usage, and validation steps. Protocol behavior (welcome/transform/disconnect handling and newline-separated JSON) remains unchanged.
This commit is contained in:
2026-06-02 14:30:20 +12:00
parent a0563a6849
commit fff6680fe5
7 changed files with 956 additions and 220 deletions
+96
View File
@@ -882,6 +882,102 @@ Player position: X=2048.00, Y=2048.00, Z=0.00, AngleZ=0.00
---
## 2026-06-02 - Reusable Server Core Refactor
### What Changed
- Split the Python relay server into a reusable server core and a thin terminal
launcher.
- Added `server/client_session.py` to track connected client state, packet
counters, last packet time, and last transform snapshots.
- Added `server/server_core.py` with `FalloutTogetherServer` lifecycle methods,
log listeners, client snapshots, server stats, and thread-safe shared state.
- Updated `server/README.md` with the new server structure and validation
commands.
### What Worked
- The terminal command remains `cd server` followed by `python server.py`.
- The server still defaults to `127.0.0.1:7777`.
- Newline-separated JSON handling, welcome packets, transform mutation,
transform relay, disconnect relay, and unknown transform field preservation
remain protocol-compatible.
- The refactor prepares the server for a future desktop dev-server UI without
adding PySide6, fake-player management, movement scripts, or gameplay
features.
### What Broke
- Nothing recorded during implementation.
### Notes
- The future UI can use `FalloutTogetherServer.start()`, `stop()`,
`is_running()`, `get_clients()`, `get_stats()`, and log listener callbacks
without scraping terminal output.
- Fallout 4 plugin code and network protocol fields were left unchanged.
### Next Steps
- Run compile checks for the server files.
- Validate server startup, fake-client welcome handling, transform relay, and
disconnect relay with fake clients and Fallout 4 plugin clients.
---
## 2026-06-02 - Dev Server GUI
### What Changed
- Added a PySide6 desktop developer GUI for the reusable Python server core.
- Added a Server Console tab with start/stop controls, live server logs, live
stats, and a connected-client table.
- Added a Fake Clients tab placeholder for future fake-client management and
movement-script controls.
- Added a server-local requirements file for the GUI dependency.
- Updated server documentation with GUI install and run instructions while
preserving the terminal server flow.
### What Worked
- The GUI uses `FalloutTogetherServer` instead of duplicating networking logic.
- Server logs flow through `add_log_listener(...)` and a Qt signal bridge rather
than stdout scraping.
- Stats and connected-client snapshots are refreshed through `get_stats()` and
`get_clients()` on a `QTimer`.
- The terminal launcher, fake client, network protocol, and plugin code were
left unchanged.
### What Broke
- Nothing recorded during implementation.
### Notes
- Fake client spawning and movement scripts remain intentionally unimplemented.
- Full GUI interaction and Fallout 4/F4SE validation still need to be run
manually on the desktop.
### Testing
- Ran `python -m py_compile server.py server_core.py client_session.py fake_client.py dev_server_app.py`
from `server`; it succeeded.
- Checked IDE lints for the new GUI and edited docs; no diagnostics were
reported.
- Checked the current Python environment for `PySide6`; it is not installed, so
`pip install -r requirements.txt` is required before launching the GUI.
- Did not start a duplicate terminal server because an existing `python
server.py` session and `python fake_client.py` session were already present.
### Next Steps
- Run `python dev_server_app.py`, click `Start Server`, and connect
`fake_client.py`.
- Launch Fallout 4 through F4SE and confirm the plugin appears in the GUI client
table with transform stats updating.
---
## Entry Template
Use this format for future updates: