Add a networking receive loop and in-plugin remote-player storage. Introduces F4TRemotePlayerState (header + implementation) to track assigned playerId and remote player snapshots with thread-safe access. Expands F4TNetworking to start/stop a background receive thread, parse newline-separated JSON packets (welcome, transform, disconnect), validate fields, update remote state, throttle logs, and handle socket/thread synchronization. Add nlohmann_json to xmake and plugin build. Update docs and dev log to reflect the new receive behavior and current prototype scope.
3.1 KiB
Packet Types
This document describes the currently implemented local prototype packet types for Fallout 4 Together.
The current protocol is newline-separated JSON over a local TCP connection to
127.0.0.1:7777.
Implemented packet types:
welcometransformdisconnect
The current system is still a local networking prototype. It is not playable multiplayer yet.
Implemented
Welcome Packet
Sent from the server to a newly connected client after the server assigns a
playerId.
Example:
{
"type": "welcome",
"playerId": 1,
"serverTime": 1780212098.457079
}
Fields:
type Packet type. Always "welcome".
playerId Server-assigned player ID for this connection.
serverTime Server timestamp when the welcome packet was created.
The Fallout 4 plugin and server/fake_client.py receive this packet. The plugin
stores the assigned playerId for filtering its own future transform echoes.
Transform Packet
Sent by the Fallout 4 plugin to the local server when the local player's
transform changes. The server adds playerId and serverTime, then broadcasts
the processed packet to other connected clients.
Example after server processing:
{
"type": "transform",
"playerId": 2,
"x": -81781.26,
"y": 87962.61,
"z": 7696.05,
"angleZ": 3.20,
"movementType": "normal",
"cellId": "0000DD60",
"worldspaceId": "0000003C",
"clientTime": 1780212128.301,
"serverTime": 1780212128.3011043
}
Fields:
type Packet type. Always "transform".
playerId Server-assigned player ID for the sender.
x Local player X position.
y Local player Y position.
z Local player Z position.
angleZ Local player Z rotation angle.
movementType Movement classification for this transform update.
cellId Current cell form ID as a string.
worldspaceId Current worldspace form ID as a string.
clientTime Timestamp generated by the sending plugin.
serverTime Timestamp added by the server before broadcast.
Possible movementType values:
normal
cell_change
worldspace_change
teleport
cell_change and worldspace_change are currently represented through
movementType inside transform packets. They are not separate packet types yet.
Disconnect Packet
Sent by the server to remaining connected clients when a client disconnects.
Example:
{
"type": "disconnect",
"playerId": 2,
"serverTime": 1780212134.0
}
Fields:
type Packet type. Always "disconnect".
playerId Server-assigned player ID that disconnected.
serverTime Server timestamp when the disconnect packet was created.
The Fallout 4 plugin and server/fake_client.py use this packet to remove
remote players from their in-memory state tables.
Receiver Behavior
The Fallout 4 plugin and fake client both receive:
welcome
transform
disconnect
The plugin receive loop runs on a background networking thread. It stores plain remote-player state only and does not spawn actors or touch Fallout 4 game objects.
Planned Later
- Remote actor spawning.
- Gameplay synchronization.