# dzima92/far-lone-sail-coop architecture

> Architecture diagram of the GitHub repository dzima92/far-lone-sail-coop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dzima92/far-lone-sail-coop
- Repository: https://github.com/dzima92/far-lone-sail-coop

## Overview

FAR: Lone Sails LAN Co-op is a BepInEx Unity plugin for two-player cooperative play. The player-facing workflow starts in the in-game panel or hotkeys: one player hosts, the other discovers or enters an address and joins; CoopManager handles sessions and messages, then applies remote player, vehicle, item, and interactive-part state in the game. Separate sync modules cover buttons, levers, hoses, covers, and live vehicle details. The README documents discovery, server lists, pause coordination, teleport, and startup resume behavior; those capabilities are represented where implementation evidence is limited. Edges are limited to relationships visible in excerpts, the source index, or README.

Main entry points: [`CoopManager.cs`](https://github.com/dzima92/far-lone-sail-coop/blob/main/CoopManager.cs) (Co-op session), [`FarCoopPlugin.cs`](https://github.com/dzima92/far-lone-sail-coop/blob/main/FarCoopPlugin.cs) (Plugin bootstrap), [`GameAccess.cs`](https://github.com/dzima92/far-lone-sail-coop/blob/main/GameAccess.cs) (Game object access), [`VehicleSync.cs`](https://github.com/dzima92/far-lone-sail-coop/blob/main/VehicleSync.cs) (Vehicle physics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_plugin["Plugin and session"]
  node_plugin["Plugin bootstrap<br/>[FarCoopPlugin.cs]"]
  node_session["Co-op session<br/>[CoopManager.cs]"]
end

subgraph group_network["Networking"]
  node_network["Transport and discovery<br/>[CoopNet.cs]"]
  node_connection["Peer connection<br/>[Connection.cs]"]
  node_protocol["Message protocol<br/>[Protocol.cs]"]
  node_clock["Sync clock<br/>[NetClock.cs]"]
end

subgraph group_players["Players and input"]
  node_partnerinput["Partner input<br/>[PartnerInput.cs]"]
  node_puppet["Partner body<br/>[PartnerPuppet.cs]"]
  node_avatar["Remote avatar<br/>[RemoteAvatar.cs]"]
end

subgraph group_world["World synchronization"]
  node_vehicle["Vehicle physics<br/>[VehicleSync.cs]"]
  node_items["Items and boxes<br/>[ItemSync.cs]"]
  node_live["Live vehicle parts<br/>[LiveSync.cs]"]
  node_buttons["Vehicle buttons<br/>[ButtonSync.cs]"]
  node_hose["Fuel hose<br/>[HoseSync.cs]"]
  node_cover["Vehicle cover<br/>[CoverSync.cs]"]
end

subgraph group_support["Runtime support"]
  node_gameaccess["Game object access<br/>[GameAccess.cs]"]
  node_telemetry["Telemetry<br/>[Telemetry.cs]"]
  node_vehicleprobe["Vehicle inspection<br/>[VehicleProbe.cs]"]
  node_window["Window placement<br/>[WindowPlacer.cs]"]
end

node_player(("Game player"))

node_player -->|"starts plugin"| node_plugin
node_plugin -->|"creates session"| node_session
node_player -->|"hosts or joins"| node_session
node_session -->|"starts discovery"| node_network
node_session -->|"sends frames"| node_connection
node_session -->|"dispatches messages"| node_protocol
node_connection -->|"classifies messages"| node_protocol
node_session -->|"updates sync"| node_clock
node_plugin -->|"installs patches"| node_partnerinput
node_session -->|"reads input"| node_partnerinput
node_session -->|"manages body"| node_puppet
node_session -->|"tracks players"| node_avatar
node_partnerinput -->|"blocks controls"| node_puppet
node_session -->|"syncs physics"| node_vehicle
node_session -->|"syncs items"| node_items
node_session -->|"syncs parts"| node_live
node_plugin -->|"installs patches"| node_buttons
node_plugin -->|"installs patches"| node_hose
node_plugin -->|"installs patches"| node_cover
node_vehicle -->|"buffers poses"| node_clock
node_vehicle -->|"finds bodies"| node_gameaccess
node_items -->|"scans objects"| node_gameaccess
node_live -->|"resolves parts"| node_gameaccess
node_avatar -->|"reads character"| node_gameaccess
node_session -->|"records events"| node_telemetry
node_session -->|"inspects vehicle"| node_vehicleprobe
node_plugin -->|"places window"| node_window
node_player -->|"opens panel"| node_session
node_player -->|"teleports partner"| node_session
node_session -.->|"coordinates pause"| node_session
node_plugin -.->|"skips resume"| node_session

click node_plugin "https://github.com/dzima92/far-lone-sail-coop/blob/main/FarCoopPlugin.cs"
click node_session "https://github.com/dzima92/far-lone-sail-coop/blob/main/CoopManager.cs"
click node_network "https://github.com/dzima92/far-lone-sail-coop/blob/main/Net/CoopNet.cs"
click node_connection "https://github.com/dzima92/far-lone-sail-coop/blob/main/Net/Connection.cs"
click node_protocol "https://github.com/dzima92/far-lone-sail-coop/blob/main/Net/Protocol.cs"
click node_clock "https://github.com/dzima92/far-lone-sail-coop/blob/main/Net/NetClock.cs"
click node_partnerinput "https://github.com/dzima92/far-lone-sail-coop/blob/main/PartnerInput.cs"
click node_puppet "https://github.com/dzima92/far-lone-sail-coop/blob/main/PartnerPuppet.cs"
click node_avatar "https://github.com/dzima92/far-lone-sail-coop/blob/main/RemoteAvatar.cs"
click node_vehicle "https://github.com/dzima92/far-lone-sail-coop/blob/main/VehicleSync.cs"
click node_items "https://github.com/dzima92/far-lone-sail-coop/blob/main/ItemSync.cs"
click node_live "https://github.com/dzima92/far-lone-sail-coop/blob/main/LiveSync.cs"
click node_buttons "https://github.com/dzima92/far-lone-sail-coop/blob/main/ButtonSync.cs"
click node_hose "https://github.com/dzima92/far-lone-sail-coop/blob/main/HoseSync.cs"
click node_cover "https://github.com/dzima92/far-lone-sail-coop/blob/main/CoverSync.cs"
click node_gameaccess "https://github.com/dzima92/far-lone-sail-coop/blob/main/GameAccess.cs"
click node_telemetry "https://github.com/dzima92/far-lone-sail-coop/blob/main/Telemetry.cs"
click node_vehicleprobe "https://github.com/dzima92/far-lone-sail-coop/blob/main/VehicleProbe.cs"
click node_window "https://github.com/dzima92/far-lone-sail-coop/blob/main/WindowPlacer.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_plugin,node_session toneBlue
class node_network,node_connection,node_protocol,node_clock toneAmber
class node_partnerinput,node_puppet,node_avatar toneMint
class node_vehicle,node_items,node_live,node_buttons,node_hose,node_cover toneRose
class node_gameaccess,node_telemetry,node_vehicleprobe,node_window,node_player toneIndigo
```

## Components

### Plugin and session

- [Plugin bootstrap](https://github.com/dzima92/far-lone-sail-coop/blob/main/FarCoopPlugin.cs): `FarCoopPlugin.cs`
- [Co-op session](https://github.com/dzima92/far-lone-sail-coop/blob/main/CoopManager.cs): `CoopManager.cs`

### Networking

- [Transport and discovery](https://github.com/dzima92/far-lone-sail-coop/blob/main/Net/CoopNet.cs): `Net/CoopNet.cs`
- [Peer connection](https://github.com/dzima92/far-lone-sail-coop/blob/main/Net/Connection.cs): `Net/Connection.cs`
- [Message protocol](https://github.com/dzima92/far-lone-sail-coop/blob/main/Net/Protocol.cs): `Net/Protocol.cs`
- [Sync clock](https://github.com/dzima92/far-lone-sail-coop/blob/main/Net/NetClock.cs): `Net/NetClock.cs`

### Players and input

- [Partner input](https://github.com/dzima92/far-lone-sail-coop/blob/main/PartnerInput.cs): `PartnerInput.cs`
- [Partner body](https://github.com/dzima92/far-lone-sail-coop/blob/main/PartnerPuppet.cs): `PartnerPuppet.cs`
- [Remote avatar](https://github.com/dzima92/far-lone-sail-coop/blob/main/RemoteAvatar.cs): `RemoteAvatar.cs`

### World synchronization

- [Vehicle physics](https://github.com/dzima92/far-lone-sail-coop/blob/main/VehicleSync.cs): `VehicleSync.cs`
- [Items and boxes](https://github.com/dzima92/far-lone-sail-coop/blob/main/ItemSync.cs): `ItemSync.cs`
- [Live vehicle parts](https://github.com/dzima92/far-lone-sail-coop/blob/main/LiveSync.cs): `LiveSync.cs`
- [Vehicle buttons](https://github.com/dzima92/far-lone-sail-coop/blob/main/ButtonSync.cs): `ButtonSync.cs`
- [Fuel hose](https://github.com/dzima92/far-lone-sail-coop/blob/main/HoseSync.cs): `HoseSync.cs`
- [Vehicle cover](https://github.com/dzima92/far-lone-sail-coop/blob/main/CoverSync.cs): `CoverSync.cs`

### Runtime support

- [Game object access](https://github.com/dzima92/far-lone-sail-coop/blob/main/GameAccess.cs): `GameAccess.cs`
- [Telemetry](https://github.com/dzima92/far-lone-sail-coop/blob/main/Telemetry.cs): `Telemetry.cs`
- [Vehicle inspection](https://github.com/dzima92/far-lone-sail-coop/blob/main/VehicleProbe.cs): `VehicleProbe.cs`
- [Window placement](https://github.com/dzima92/far-lone-sail-coop/blob/main/WindowPlacer.cs): `WindowPlacer.cs`

### Other components

- **Game player**

## Connections

- Game player → Plugin bootstrap: starts plugin (evidence: `README.md`)
- Plugin bootstrap → Co-op session: creates session (evidence: `FarCoopPlugin.cs`)
- Game player → Co-op session: hosts or joins (evidence: `README.md`)
- Co-op session → Transport and discovery: starts discovery (evidence: `CoopManager.cs`)
- Co-op session → Peer connection: sends frames (evidence: `CoopManager.cs`)
- Co-op session → Message protocol: dispatches messages (evidence: `CoopManager.cs`)
- Peer connection → Message protocol: classifies messages (evidence: `Net/Connection.cs`)
- Co-op session → Sync clock: updates sync (evidence: `CoopManager.cs`)
- Plugin bootstrap → Partner input: installs patches (evidence: `FarCoopPlugin.cs`)
- Co-op session → Partner input: reads input (evidence: `CoopManager.cs`)
- Co-op session → Partner body: manages body (evidence: `CoopManager.cs`)
- Co-op session → Remote avatar: tracks players (evidence: `CoopManager.cs`)
- Partner input → Partner body: blocks controls (evidence: `PartnerInput.cs`)
- Co-op session → Vehicle physics: syncs physics (evidence: `CoopManager.cs`)
- Co-op session → Items and boxes: syncs items (evidence: `CoopManager.cs`)
- Co-op session → Live vehicle parts: syncs parts (evidence: `CoopManager.cs`)
- Plugin bootstrap → Vehicle buttons: installs patches (evidence: `FarCoopPlugin.cs`)
- Plugin bootstrap → Fuel hose: installs patches (evidence: `FarCoopPlugin.cs`)
- Plugin bootstrap → Vehicle cover: installs patches (evidence: `FarCoopPlugin.cs`)
- Vehicle physics → Sync clock: buffers poses (evidence: `VehicleSync.cs`)
- Vehicle physics → Game object access: finds bodies (evidence: `VehicleSync.cs`)
- Items and boxes → Game object access: scans objects (evidence: `ItemSync.cs`)
- Live vehicle parts → Game object access: resolves parts (evidence: `LiveSync.cs`)
- Remote avatar → Game object access: reads character (evidence: `RemoteAvatar.cs`)
- Co-op session → Telemetry: records events (evidence: `CoopManager.cs`)
- Co-op session → Vehicle inspection: inspects vehicle (evidence: `CoopManager.cs`)
- Plugin bootstrap → Window placement: places window (evidence: `FarCoopPlugin.cs`)
- Game player → Co-op session: opens panel (evidence: `README.md`)
- Game player → Co-op session: teleports partner (evidence: `README.md`)
- Co-op session → Co-op session: coordinates pause (evidence: `README.md`)
- Plugin bootstrap → Co-op session: skips resume (evidence: `README.md`)
