Enable transform broadcast testing and time syncing: server now assigns incrementing player IDs, sends a welcome packet with playerId and serverTime, and appends serverTime/playerId to incoming transform packets before broadcasting them to all other connected clients. Added thread-safe client tracking, send_packet helper, client removal on send errors, and improved logging. Plugin now includes a clientTime timestamp in transform packets. Added server/fake_client.py to receive and print welcome and broadcasted transform packets, and updated server README and dev-log with usage and test notes.
78 lines
1.9 KiB
Markdown
78 lines
1.9 KiB
Markdown
# Server
|
|
|
|
This folder is for the external multiplayer test server.
|
|
|
|
The current server is a tiny local-only TCP test server. It listens on
|
|
`127.0.0.1:7777`, accepts one or more clients, reads newline-separated JSON
|
|
packets, prints received player transform packets, and broadcasts transform
|
|
packets to every other connected client.
|
|
|
|
## Run
|
|
|
|
```bash
|
|
cd server
|
|
python server.py
|
|
```
|
|
|
|
Then launch Fallout 4 through F4SE and move the player. The plugin should keep
|
|
logging player position changes to `Fallout4Together.log`, and this server
|
|
should print matching `transform` packets.
|
|
|
|
If the server is not running, the plugin should log a warning and Fallout 4
|
|
should continue launching normally.
|
|
|
|
## Broadcast Test
|
|
|
|
Terminal 1:
|
|
|
|
```bash
|
|
cd server
|
|
python server.py
|
|
```
|
|
|
|
Terminal 2:
|
|
|
|
```bash
|
|
cd server
|
|
python fake_client.py
|
|
```
|
|
|
|
Then launch Fallout 4 through F4SE and move the player.
|
|
|
|
Expected result:
|
|
|
|
- The server assigns a `playerId` to each connected client and sends each client
|
|
a `welcome` packet.
|
|
- The fake client prints its `welcome` packet.
|
|
- The server prints transform packets received from Fallout 4.
|
|
- The server adds `playerId` and `serverTime` to each transform packet.
|
|
- The server broadcasts those transform packets to connected clients except the
|
|
sender.
|
|
- `fake_client.py` receives and prints the broadcast transform packets.
|
|
|
|
The fake client exists so broadcast behavior can be tested before coordinating a
|
|
second Fallout 4/F4SE instance. It is only a receiver for now and does not send
|
|
movement.
|
|
|
|
## Current Server Goals
|
|
|
|
- Start local server
|
|
- Accept client connections
|
|
- Receive transform packets
|
|
- Assign server-owned player IDs
|
|
- Add server timestamps
|
|
- Broadcast transforms to other connected clients
|
|
- Handle disconnects
|
|
|
|
## Not Planned Yet
|
|
|
|
- Remote actor spawning
|
|
- Gameplay synchronization
|
|
- Authentication
|
|
- Public matchmaking
|
|
- Anti-cheat
|
|
- Persistence
|
|
- Quest state
|
|
- Settlement state
|
|
- Large-scale world simulation
|