Skip to content

Added Server Browser and Lobby Server (#10, #45, #35), in-game chat (#8) and minor bug fixes (#36)#46

Open
AMacro wants to merge 654 commits into
Insprill:masterfrom
AMacro:beta
Open

Added Server Browser and Lobby Server (#10, #45, #35), in-game chat (#8) and minor bug fixes (#36)#46
AMacro wants to merge 654 commits into
Insprill:masterfrom
AMacro:beta

Conversation

@AMacro

@AMacro AMacro commented Jul 14, 2024

Copy link
Copy Markdown

@Insprill

This is a consolidation PR that covers multiple issues.

Work is ongoing for #6 and #11.

Jarnster pushed a commit to Jarnster/dv-multiplayer that referenced this pull request Nov 27, 2024
Fix project board link in the README
@AMacro
AMacro force-pushed the beta branch 3 times, most recently from 1e8fee4 to 48e900a Compare March 2, 2025 10:27
AMacro added 20 commits June 14, 2025 19:20
Rather than using late updates and relying on the client to send the value, use the fill/drain started and stopped events. set a flag when filling/draining starts and then on server tick, communicate the latest fill value for all resources filling or draining.

Upon release clear the flag and send the final value.

Server side tracking of which resources are being interacted with is required for updating players entering the culling zone
Allows mods to report their compatibility with multiplayer either through their `info.json` or through a call to `MultiplayerAPI.Instance.SetModCompatibility()`
AMacro added 30 commits July 5, 2026 21:00
Add a lobby metadata check in both join-request and invite handlers so only lobbies tagged with the multiplayer mod key are processed. This prevents reacting to unrelated Steam lobby requests.
Pre-size `itemBaseToNetworkedItem` with a capacity of 4096 to reduce dictionary reallocations, and change `GetAll()` to return the dictionary `ValueCollection` directly instead of allocating a filtered list. This cuts per-call allocations and improves access performance for cached networked items.
Preallocate common collections in `NetworkedItemManager`, reduce a few allocations, and quiet noisy debug logging. Also switch the item cache error path to error-level logging so failures are more visible.
Delay host initialization for networked junctions and turntables until Start when the server may not be running during Awake, while still handling already-running servers. Also prevent duplicate ID components with DisallowMultipleComponent and switch the turntable patch to GetOrAddComponent to avoid adding duplicate NetworkedTurntable instances.
Adds a new `FastTravelAdvancesTime` gameplay setting and propagates it from server to clients via `ClientboundGameParamsPacket`.
Use `pwsh` instead of `powershell` on non-Windows platforms, with forward-slash paths and `ContinueOnError=true` to handle missing PowerShell gracefully.
Prevent clients and host (when other players are connected) from fast travelling with loco. This can be re-enabled once fast travel has been:
1. Made server authoritative
2. Can teleport locos safely, without causing de-syncs (refer to Work Trains code for a possible method)
Adds a Harmony postfix patch on SaveLoadController.RefreshInterface to disable the load save button when not in the main menu, preventing a softlock that occurs when loading a save game mid-session.
Add a server-side flag for whether fast travel should advance time, and import the world patch namespace needed to support that behavior.
commit e36d604
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sun Jul 12 19:09:51 2026 +1000

    Refactor player position sync and add VR tracking

    Replaced per-field position packets with a `PlayerTrackingData` payload that serializes only changed tracking fields, and wired it through client/server packet handling and player state storage.

    Local player tracking was consolidated into a shared base flow with non-VR/VR-specific hooks, including VR hand pose deltas and controller re-init logic.

    Added a `NetworkedPlayerIKHandler` and enabled IK pass in the locomotion animator so remote VR hand targets can drive avatar IK.

    Enabled IK pass in the locomotion controller to allow IK data to be used.

commit 9a4031c
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sun Jul 12 19:05:25 2026 +1000

    Collect VR flag at player login

    Add an `IsVR` field across the login and player-join flow so VR state is sent by clients, stored on `ServerPlayer`, and broadcast to other clients. Client-side player creation now receives and stores this flag on `NetworkedPlayer` for downstream VR-specific behavior.

commit b9d1ced
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sun Jul 12 19:03:05 2026 +1000

    Move PlayerPreference to Player namespace

    Relocated `PlayerPreference` to `Networking/Data/Player` and changed its namespace to `Multiplayer.Networking.Data.Player` to better group player-specific data. Updated all affected references/usings in server/client managers and preference packet classes to match the new location.

commit 56b0e7b
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sun Jul 12 06:48:11 2026 +1000

    Refactor CustomFirspersonControllerPatch

    Create a LocalPlayerTrackerNonVR and LocalPlayerTrackerVR class to replace CustomFirstpersonControllerPatch functionality.

commit 801bfa1
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sat Jul 11 21:37:53 2026 +1000

    Add Sit Logic

    Adds sit animations, updates the locomotion controller and animation handler and implements transmission of sit height

commit 92c3009
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sat Jul 11 13:37:41 2026 +1000

    Add Lean poses

commit 8717f1f
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sat Jul 11 13:18:53 2026 +1000

    Fix debug logs

commit a8aa027
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Tue Jul 7 19:40:49 2026 +1000

    Send player posture

    Replace the old packed jump/car bitfield with explicit posture flags and a separate on-car field.

commit 39eba9b
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Tue Jul 7 17:54:17 2026 +1000

    Fix foot offset in sit and crouch pose

commit f1de4c6
Author: AMacro <andrew@andrewcraigmackenzie.com>
Date:   Sat May 10 14:40:02 2025 +1000

    Continue work on Locomotions Controller

commit 0af88f0
Author: AMacro <andrew@andrewcraigmackenzie.com>
Date:   Mon May 5 12:28:04 2025 +1000

    Tidied up animations

commit c5bc16b
Author: AMacro <andrew@andrewcraigmackenzie.com>
Date:   Mon May 5 12:17:30 2025 +1000

    Added swimming and fixed crouch walk

commit 5694197
Author: AMacro <andrew@andrewcraigmackenzie.com>
Date:   Mon May 5 11:24:36 2025 +1000

    Crouch walk working

commit 9f5f547
Author: AMacro <andrew@andrewcraigmackenzie.com>
Date:   Mon May 5 09:49:29 2025 +1000

    Fix easing poses

commit cf86923
Author: AMacro <andrew@andrewcraigmackenzie.com>
Date:   Mon May 5 00:26:49 2025 +1000

    Add crouch and sit poses

commit 72aa965
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Tue Jul 7 12:53:52 2026 +1000

    Improve player head tracking

    Switch networked player head tracking to the animated head bone instead of a fixed child lookup.

    Update local player head tracking to work with VR

commit 9189e88
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sat Jun 6 21:12:00 2026 +1000

    Add handling for nonVR player head and item pitch

commit d6af0b1
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sun Jul 5 20:47:43 2026 +1000

    Fix preview camera and VR model rotation

    Moves `ModelRotator` into the UI settings namespace and extends drag handling for both flat and VR pointer workflows.

    Updates character preview camera setup/lifecycle (render texture descriptor, enable/disable timing, and cleanup)

    Makes `PlayerModelRegistry` reloadable - returning to main menu causes assets to be unloaded and prefabs become null.

commit 3232b98
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sun Jul 5 20:09:37 2026 +1000

    Split tooltips for character selector

commit c028e83
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sat Jul 4 19:24:45 2026 +1000

    Update localisation strings

commit 8b25ab3
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sun Jun 28 21:04:37 2026 +1000

    Update models

    Fix prefab naming convention and create a new model for a Tic Tac for nostalgia with Patrick van Halm's original DV MP mod

commit 88c61c3
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sun Jun 28 21:01:40 2026 +1000

    Add support for players choosing a character model

    Allow players to choose and change character models as desired

commit 25e2448
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sun Jun 28 20:34:34 2026 +1000

    Add player model registry and fallback logic

    Create a centralised player model registry for future support of custom models.

commit 8861fc7
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sat Jun 27 23:17:02 2026 +1000

    Add key bind UI for chat key setting

    Implements a KeyBindInterface singleton that shows a fullscreen overlay and captures keyboard input with a countdown timeout. Wires it into the multiplayer settings menu so users can rebind the chat key. Also adds a locale key for the overlay text and excludes Escape/SysReq from valid key bind targets.

commit b6245a4
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sat Jun 27 23:07:49 2026 +1000

    Fix character selector settings sync

    Align the character selector with saved settings, keep Apply state in sync with the selected character, and preserve the menu state when returning from discard/apply. Also removes stale selector cleanup and debug code now covered by the new flow.

commit a280a34
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sat Jun 27 23:07:07 2026 +1000

    Reorganise server browser UI components

    Move server browser and grid view classes into dedicated UI namespaces and folders

commit a322139
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sat Jun 27 17:51:03 2026 +1000

    Refactor the spawning of UI Controls

commit 7d08286
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Tue Jun 23 23:02:34 2026 +1000

    Improve character selector UI and settings

    Refactor and enhance the multiplayer character selector and settings UI:

    - CharacterSelectorMenu: resize preview render target (512->435), adjust layout padding/alignment, extract BuildCharacterSelector, rename vars to previewModel/selectedIndex, add OnEnable/OnDisable to wire BottomButtons and Apply/Discard handlers, add SettingsChanged stub, add tooltips, and stubbed Apply/Discard methods. Also tweak preview camera, anchors, and model handling (ensure animators/springs/blinkers handled for unscaled time).
    - SettingsControllerPatch: create separate Multiplayer and Character panes, add MultiplayerSettingsMenu component, wire menu indices and bottom buttons, create CreateBottomButtons helper, move left menu into a ScrollView (MoveMenuToScrollView) to avoid overflow/VR issues, and replace some Object.Destroy calls with GameObject.Destroy. Add rich UI debugging helpers (LogUIHierarchy, AppendUINode, AppendComponentInfo).
    - Settings: add CharacterId property to persist selected character.

    These changes improve layout/preview behavior, add Apply/Discard button wiring, make the character selector accessible from multiplayer settings, and provide utilities for inspecting UI hierarchies.

commit e79643e
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Tue Jun 23 23:01:02 2026 +1000

    Create Multiplayer Settings Menu

    Base menu, requires code to manage settings

commit f4b5b4b
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sun Jun 21 00:55:08 2026 +1000

    Client: instantiate player model and name tag

    Refactor client-side player creation and NetworkedPlayer to support dynamic models.

    - NetworkedPlayer: add a playerModel field, expose ChangeModel(GameObject) to instantiate/destroy models, derive animationHandler from the instantiated model, use null-conditional calls for nameTag updates, and use transform via a property instead of caching selfTransform.
    - ClientPlayerManager: replace single prefab with a player tag prefab and an array of player prefabs; create a parent GameObject for each player, instantiate the name tag as a child, attach NetworkedPlayer, and call ChangeModel to set the visual model. AddPlayer signature now accepts a prefabId (currently passed as empty string).
    - NetworkClient: forward the prefabId argument (as empty string for now) when handling player-joined packets.
    - Minor whitespace tweak in Multiplayer.cs.

    These changes prepare the client codebase for multiple player models and decouple the visible model from the NetworkedPlayer component.

commit f0ed0af
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sun Jun 21 00:53:23 2026 +1000

    Add character selector UI and settings pane

    Introduce an in-settings character selector and preview system.

    - Add CharacterSelectorMenu (Multiplayer/Components/MainMenu) to build a UI panel with a RenderTexture preview, preview camera/light, and populate selectable character list from AssetIndex. Ensures animations run in unscaled time and sets item layers for isolated rendering.
    - Add ModelRotator to allow pointer drag rotation with inertia for the preview model.
    - Patch SettingsController to inject a new "Multiplayer" settings pane by cloning the Gameplay pane, add the character selector component, wire up the menu button, localization key, and icon.
    - Add settings locale keys in Locale.cs and update locale.csv with settings/char_select entries and tooltips.
    - Minor cleanup in RightPaneControllerPatch usings.

    This enables players to preview and pick cosmetic characters from the settings menu.

commit d36ddf8
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Sun Jun 21 00:51:29 2026 +1000

    Update models

    Add blink and hair animations as well as an model metadata system

commit 65e1de1
Author: Macka <andrew@andrewcraigmackenzie.com>
Date:   Fri Jun 19 17:33:32 2026 +1000

    Create & Rig New Player Models
Reworked player-in-car tracking to use explicit server/client occupancy sets on `NetworkedTrainCar` and updated player/car transitions to add and remove players reliably. `NetworkServer` now updates car membership when `CarID` changes, and `NetworkedPlayer` now tracks occupied networked cars and notifies car state changes.

`HasPlayers` was replaced with a method using the new tracking, and all delete/rerail checks were updated to call it. `CarVisitChecker.OnPlayerCarChanged()` patched to utilise the `HasPlayers()` method to track if any player is on the vehicle.
Implement InUse() check on NetworkedTrainCar.
Rework Work Train spawn requests to use NetworkedTrainCars.InUse.
Clear the recently visited flag on Work Trains cleared by the comms radio
Introduce an inventory root and explicit right/left hand item tracking for NetworkedPlayer. Adds AddItemToInventory, expanded HoldItem (now sets parent, disables GrabHandlerItem physics/interaction, and disables colliders while recording them), and DropItem (re-enables colliders, restores GrabHandlerItem, reparents to OriginShiftParent). Replaces the old itemHeld field with RightHandItemGO, adds lists to track disabled colliders, and creates an inventory GameObject in Awake.

TODO: extend support for left-hand and dual-hand items.
* Improve tracking of players on TrainCars

Reworked player-in-car tracking to use explicit server/client occupancy sets on `NetworkedTrainCar` and updated player/car transitions to add and remove players reliably. `NetworkServer` now updates car membership when `CarID` changes, and `NetworkedPlayer` now tracks occupied networked cars and notifies car state changes.

`HasPlayers` was replaced with a method using the new tracking, and all delete/rerail checks were updated to call it. `CarVisitChecker.OnPlayerCarChanged()` patched to utilise the `HasPlayers()` method to track if any player is on the vehicle.

* Rework Work Train in use checks

Implement InUse() check on NetworkedTrainCar.
Rework Work Train spawn requests to use NetworkedTrainCars.InUse.
Clear the recently visited flag on Work Trains cleared by the comms radio
Default raycaster uses 2 metres, to help with lag/minor desync increase this limit to 3 metres and increase the tolerance to 10% compared to the original 5% (effectively 3.15 metres)
* Add player inventory & right-hand item handling

Introduce an inventory root and explicit right/left hand item tracking for NetworkedPlayer. Adds AddItemToInventory, expanded HoldItem (now sets parent, disables GrabHandlerItem physics/interaction, and disables colliders while recording them), and DropItem (re-enables colliders, restores GrabHandlerItem, reparents to OriginShiftParent). Replaces the old itemHeld field with RightHandItemGO, adds lists to track disabled colliders, and creates an inventory GameObject in Awake.

TODO: extend support for left-hand and dual-hand items.

* Increase pluggable object insertion distance

Default raycaster uses 2 metres, to help with lag/minor desync increase this limit to 3 metres and increase the tolerance to 10% compared to the original 5% (effectively 3.15 metres)
Password popup now uses the existing PopupTextInputFieldController with allowEmpty enabled, removingthe need for the custom no-validation controller component.
* Use built-in text input popup

Password popup now uses the existing PopupTextInputFieldController with allowEmpty enabled, removingthe need for the custom no-validation controller component.
Clean up warning logs.

Add null guards for missing overviews and booklets.
Refactor Job Validation
Add per-player tracking for the last high-ping warning tick and gate warning logs behind a 60-second interval. This reduces repeated log spam for persistently high-latency players while keeping visibility into ping issues.
Update StationLocoSpawner patch to safely handle cases where `SpawnCarTypesOnTrack` returns null.
Only start the recently visited countdown when a car transitions from occupied to empty (`playerIsInCar` was true). This prevents the timer from being repeatedly reset when players enter or leave other cars.
…eption

Handle null spawn result in loco spawner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants