Files
Commonwealth-Online-Public/server
andrew 52d934dab0 Broadcast disconnects; update fake client
Implement server-side disconnect lifecycle and update client handling. Added disconnect_client and broadcast_disconnect in server.py to remove clients, close sockets, and notify remaining clients with a disconnect packet; broadcast_transform now uses disconnect_client for failed recipients and logs delivery counts. Updated fake_client.py to handle disconnect packets, remove remote players from its in-memory table, and improve logging. Documentation (docs/dev-log.md and server/README.md) updated to record the change and next steps.
2026-05-31 19:23:36 +12:00
..
2026-05-30 18:13:54 +12:00
2026-05-30 18:13:54 +12:00

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

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:

cd server
python server.py

Terminal 2:

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.
  • fake_client.py stores the latest remote player state for each playerId in memory and prints a readable state summary after each transform update.
  • When a client disconnects, the server removes that client and broadcasts a disconnect packet with the departed playerId to the remaining clients.
  • fake_client.py removes disconnected players from its in-memory remote_players table and prints the remaining tracked players.

The fake client exists so broadcast behavior can be tested before coordinating a second Fallout 4/F4SE instance. It stores remote player transform state only; it does not spawn remote actors or 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