Introduce a server-authoritative world-state packet to control weather and time from the dev server GUI. Adds protocol docs and message type (serverWorldState), a new Weather/Time tab in dev_server_app.py, server-side broadcasting in server_core.py, and preset utilities in server/world_state_presets.py. Plugin changes (F4TNetworking.cpp, F4TWorldStateSync.*) queue and apply incoming serverWorldState on the game thread, run `set gamehour` for all clients, and run `fw <8-digit-id>` on the assigned player 1 then force the host to relay a worldState snapshot. Also includes parsing/validation of hex form IDs, logging improvements, and minimal fake client handling. This ensures consistent server-driven time/weather and documents usage and presets.
62 lines
1.5 KiB
Markdown
62 lines
1.5 KiB
Markdown
# Protocol Overview
|
|
|
|
The Commonwealth Online protocol defines the messages sent between Fallout 4 clients and the external server.
|
|
|
|
Early versions should stay simple and easy to debug.
|
|
|
|
## Early Design
|
|
|
|
The first version can use human-readable packets during testing.
|
|
|
|
Long-term versions may move to a binary protocol if performance becomes a problem.
|
|
|
|
## First Required Messages
|
|
|
|
- `welcome`
|
|
- `transform`
|
|
- `worldState`
|
|
- `worldStateHost`
|
|
- `serverWorldState`
|
|
- `disconnect`
|
|
- `ping`
|
|
- `pong`
|
|
|
|
## LAN Discovery (UDP)
|
|
|
|
Local server discovery uses a separate UDP channel so clients can find
|
|
Commonwealth Online relays on the LAN without scanning every TCP port.
|
|
|
|
- **Discovery port:** `7778` (UDP)
|
|
- **Game port:** `7777` (TCP) by default
|
|
|
|
### `discover` (client → server, UDP)
|
|
|
|
```json
|
|
{"type":"discover","protocol":"commonwealth-online","version":1}
|
|
```
|
|
|
|
### `discoverResponse` (server → client, UDP)
|
|
|
|
```json
|
|
{
|
|
"type": "discoverResponse",
|
|
"protocol": "commonwealth-online",
|
|
"version": 1,
|
|
"name": "Commonwealth Online Server",
|
|
"port": 7777,
|
|
"players": 2,
|
|
"maxPlayers": 16
|
|
}
|
|
```
|
|
|
|
Clients should connect to the **source IP** of the UDP response using the
|
|
`port` from the response body.
|
|
|
|
If UDP discovery is unavailable, the plugin may fall back to probing
|
|
`127.0.0.1:7777` and the local LAN IPv4 address with a short TCP connect and
|
|
`welcome` handshake check.
|
|
|
|
## Main Rule
|
|
|
|
The protocol should be testable outside Fallout 4 before it is used inside the F4SE plugin.
|