Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 242 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
242 commits
Select commit Hold shift + click to select a range
e23d522
Begin creating the server browser menu
Insprill Aug 8, 2023
764bfc7
Fixed minor issue with CSV parsing so that unix/windows line breaks d…
AMacro May 11, 2024
6daa671
Enhanced "join" interface
AMacro May 12, 2024
e1a3e97
Reworked the saving of last direct connection details
AMacro May 12, 2024
c691e32
refactoring und updating
morm075 May 25, 2024
a6ab704
Merge branch 'feature/server-browser' into feature/server-browser-update
morm075 May 26, 2024
44471ca
Fix CSV.cs
N95JPL May 26, 2024
c43328b
Merge branch 'Localisation-Parsing-Fix' into CSV-Key-Fix
N95JPL May 26, 2024
0c9d431
Dynamic DNS
N95JPL May 26, 2024
bb69a06
Correct UriKind Check
N95JPL May 26, 2024
a4c8453
Continuing to update server browser
morm075 Jun 16, 2024
af9cd6d
Minor fixes and improvements
AMacro Jun 16, 2024
0455990
Merge branch 'updated-server-browser' into updated-server-browser
AMacro Jun 16, 2024
bcf5735
Merge pull request #1 from AMacro/updated-server-browser
morm075 Jun 16, 2024
81aa6ba
Minor adjustments and commenting
morm075 Jun 18, 2024
6e721e5
added button icons
AMacro Jun 20, 2024
c66ee37
minor correction
morm075 Jun 22, 2024
d236a90
PHP and Rust servers implemented
AMacro Jun 22, 2024
0e373f4
Merge branch 'updated-server-browser' of https://github.com/morm075/d…
AMacro Jun 22, 2024
c190545
another correction
morm075 Jun 22, 2024
4b2c6bb
Fixed SSL compilation issues
AMacro Jun 23, 2024
76f5aee
Merge branch 'updated-server-browser' of https://github.com/morm075/d…
morm075 Jun 23, 2024
492938e
Update Read Me.md
AMacro Jun 23, 2024
94f344f
Improved servers and server browser code
AMacro Jun 27, 2024
8329b63
Updates to locale.csv
morm075 Jun 30, 2024
a7ae049
Server browser and lobby server working
AMacro Jun 30, 2024
499dacf
Merge branch 'updated-server-browser' of https://github.com/morm075/d…
AMacro Jun 30, 2024
0fa44a6
Minor UI fixes and version update
AMacro Jun 30, 2024
e5051da
Updated default server to https
AMacro Jul 1, 2024
eb3b948
Refactored server browser for consistency
AMacro Jul 1, 2024
6e8df46
Added auto refresh
AMacro Jul 6, 2024
a99179a
Server details displayed in pane
AMacro Jul 6, 2024
86f8245
Updated translations for server browser details pane
AMacro Jul 6, 2024
30c5988
Fixed translation issue
AMacro Jul 6, 2024
252745d
Updated default server browser text.
AMacro Jul 6, 2024
ab36de5
Reorganised UI components
AMacro Jul 6, 2024
830cd1c
Initial commit
AMacro Jul 7, 2024
ea633a3
Added hotbar blocking and aligned chat window with lower left corner
AMacro Jul 7, 2024
2d3d2df
Bug fixes
AMacro Jul 12, 2024
14e5aae
Added chat commands
AMacro Jul 13, 2024
9ee085c
Added sent message history
AMacro Jul 13, 2024
13184b8
Added auto complete for whisper usernames, enforced some username con…
AMacro Jul 13, 2024
9925783
General tidy up and QoL for server browser
AMacro Jul 13, 2024
00359ad
Bug fixes for lobby server redirects
AMacro Jul 13, 2024
2458ed2
Merge pull request #3 from morm075/updated-server-browser
AMacro Jul 14, 2024
18333e4
Merge pull request #4 from morm075/in-game-chat
AMacro Jul 14, 2024
2b666d4
Merge pull request #6 from AMacro/feature/updated-server-browser
AMacro Jul 14, 2024
c6f795f
Merge pull request #7 from AMacro/feature/in-game-chat
AMacro Jul 14, 2024
db77e3d
Merge pull request #1 from N95JPL/CSV-Key-Fix
AMacro Jul 14, 2024
0871556
Merge branch 'beta' into Localisation-Parsing-Fix
AMacro Jul 14, 2024
fa0fbfb
Merge pull request #8 from AMacro/Localisation-Parsing-Fix
AMacro Jul 14, 2024
1827ded
Minor update to CSV parsing
AMacro Jul 14, 2024
9d3fb99
Squashed commit of the following:
AMacro Jul 14, 2024
36db54a
Squashed commit of the following:
AMacro Jul 14, 2024
24b6f58
Rectified conflicts
AMacro Jul 14, 2024
33592fd
Merge branch 'beta' into Join-Menu-Improvements
AMacro Jul 14, 2024
dc1235d
Merge pull request #2 from N95JPL/Join-Menu-Improvements
AMacro Jul 14, 2024
5f8e730
Add CSV parsing check and log
AMacro Jul 14, 2024
dc93e10
Merge branch 'beta' of https://github.com/AMacro/dv-multiplayer into …
AMacro Jul 14, 2024
13a265f
Preparing for v0.16.0
AMacro Jul 14, 2024
97c10fe
Fixed issue where PHP server does not return correct error code
AMacro Jul 14, 2024
750958e
Fixed issues with servers that prioritise IPV6, disabled job sync code
AMacro Jul 14, 2024
1ebb5f4
Update README.md
morm075 Jul 14, 2024
d2f07ae
Update README.md
morm075 Jul 14, 2024
123cc24
Update README.md
morm075 Jul 14, 2024
6ed3c82
Repair after data loss
AMacro Jul 21, 2024
3219296
Forced connections on IPv4
AMacro Jul 21, 2024
72289e6
Self preservation when deleting cars
AMacro Jul 21, 2024
822c03f
Continuing work on IPv6 and sync issues
AMacro Jul 27, 2024
4a7e195
Multiple bug fixes, sync fix for entering/exiting cars
AMacro Jul 27, 2024
1e09a9f
Optimised car destroy code, improvements to lag due to debug output
AMacro Jul 27, 2024
64a8995
Bug fixes and features
AMacro Jul 28, 2024
298786f
Ready for release
AMacro Jul 28, 2024
2718a78
Fixed brake pressure sync issue
AMacro Aug 2, 2024
0deb0fb
Added example Directory.Build.targets
AMacro Aug 2, 2024
fdf5b7d
Update README.md
AMacro Aug 2, 2024
713e26e
Update README.md
AMacro Aug 2, 2024
08f5e02
Fixed bug where password was not cleared when attempting to join a se…
AMacro Aug 3, 2024
a3aed4e
Merge branch 'beta' of https://github.com/AMacro/dv-multiplayer into …
AMacro Aug 3, 2024
aa821aa
Added versioning system to settings to allow upgrades on new version …
AMacro Aug 10, 2024
eedf22f
Fixed bug in RIgidBodySnapshot.Apply()
AMacro Aug 10, 2024
0cf6e43
Steam locomotive sync improvements
AMacro Aug 10, 2024
ac30237
Disabled chat in single player mode
AMacro Aug 10, 2024
22c2ea2
Implemented potential fix for error accumulation and de-sync
AMacro Aug 11, 2024
ffe0313
Cleanup of unused code / variables
AMacro Aug 11, 2024
b924d1a
Refactor and attempt reactivation of locomotive despawning
AMacro Aug 11, 2024
27f8cbf
Continuing attempt to reactivate loco de-spawning
AMacro Aug 11, 2024
8d727fd
Revert "Implemented potential fix for error accumulation and de-sync"
AMacro Aug 16, 2024
ff4245e
Cleanup for 0.1.8.0 release
AMacro Aug 17, 2024
5b85cf9
implemented potential fix for error accumulation and de-sync
AMacro Aug 18, 2024
77f120a
Fix for single player job expiry bug
AMacro Aug 23, 2024
f5f68cf
Continuing Job Sync
AMacro Aug 25, 2024
3a235a8
Update server browser pane to remove dummy servers
AMacro Aug 30, 2024
12ec3a9
Merge branch 'alpha' into beta
AMacro Aug 30, 2024
85c614a
Fix for joining servers with no password
AMacro Aug 31, 2024
310fcfc
Allowed multiple lines to be entered in details text box
AMacro Aug 31, 2024
a673023
Fixed serialisation and deserialisation of jobs
AMacro Aug 31, 2024
0b2fdc7
Continuing job sync code
AMacro Aug 31, 2024
bc807c5
Fix for early game rerails costing >$0
AMacro Sep 1, 2024
de7d252
Remove redundant code
AMacro Sep 1, 2024
3256da2
Added framework for clients to take and complete jobs
AMacro Sep 1, 2024
84161bd
Start work on LAN discovery and server browser ping
AMacro Sep 6, 2024
00e39ab
Fixed MU cable connection bug
AMacro Sep 7, 2024
7d637c3
Fixed issues with obtaining external IPv4 address
AMacro Sep 8, 2024
ff4becc
fix for null reference on TrainCars without MU capabilities
AMacro Sep 8, 2024
7a1524f
Fixed StationController to JobValidator mapping
AMacro Sep 8, 2024
1cee17d
Started work on item sync
AMacro Sep 8, 2024
8e8e333
Continued work on syncing jobs - framework for job validation
AMacro Sep 8, 2024
b6e6658
Added message box for out of date Multiplayer mod
AMacro Sep 8, 2024
53e2180
Fixed RPC timeouts to work in milliseconds rather than seconds
AMacro Sep 8, 2024
7de3768
Fixed error log, ready for release
AMacro Sep 8, 2024
6ae42d0
Fix project board link in the README
matejdro Sep 10, 2024
1cb7b25
Merge pull request #46 from matejdro/patch-1
AMacro Sep 10, 2024
5c4c9ce
Update README.md
AMacro Sep 13, 2024
e82949a
Completed ping functionality for Server Browser
AMacro Sep 15, 2024
503e4a0
General clean up and warnings fixes
AMacro Sep 15, 2024
38eacc4
Added LAN discovery
AMacro Sep 21, 2024
e35f310
Removed extra logging from Ping and LAN discovery
AMacro Sep 21, 2024
d23098c
Minor UI changes
AMacro Sep 22, 2024
1536178
Update HostGamePane.cs
AMacro Sep 22, 2024
2cef3ef
Continuing job and item sync
AMacro Sep 22, 2024
d95229d
Continuation of item sync
AMacro Sep 24, 2024
42573a0
fixed warning
AMacro Sep 24, 2024
79f6140
Continuation of item sync
AMacro Oct 6, 2024
dbc9b78
Enhanced Hosting pane
AMacro Oct 8, 2024
9038906
Fixed issues with deserialisation
AMacro Oct 8, 2024
73bbaeb
Item Sync continued
AMacro Oct 8, 2024
bb02a7d
Allow servers with names up to 25 chars (minor bug)
AMacro Oct 21, 2024
0809fd2
Increased initial update speed
AMacro Oct 21, 2024
3b19f2d
Refactoring and improving item sync
AMacro Oct 21, 2024
352b357
Begin implementation of item sync for distance from player
AMacro Oct 22, 2024
cbbf773
Continuation of item sync
AMacro Nov 14, 2024
3299567
Reworked item sync
AMacro Nov 14, 2024
82e7eb5
Fixed issues with item sync and added more "smart" objects to the syn…
AMacro Nov 19, 2024
dd44f88
Remove excessive logging for jobs
AMacro Nov 21, 2024
08f469a
Add authority to tracked values (Server update vs Common update)
AMacro Nov 21, 2024
c9a5742
Begin implementation of item update validation and ownership
AMacro Nov 22, 2024
7f38fde
Localisation updates
AMacro Nov 24, 2024
b82d477
Compatibility with B99
AMacro Nov 24, 2024
43c4372
Minor localisation updates
AMacro Nov 24, 2024
b00f47a
Updates to localisation
AMacro Nov 29, 2024
8c22379
Fix for 'LocalFruits' Error
AMacro Nov 30, 2024
f133845
Fixes for common post-B99 bugs
AMacro Dec 1, 2024
8e0c67a
Fix ping issues for private LAN games
AMacro Dec 1, 2024
9d1be93
Fix Garage Unlock
AMacro Dec 1, 2024
4bfaf4d
Additional logging to find source of sync issues
AMacro Dec 1, 2024
adb43ca
Minor fixes
AMacro Dec 1, 2024
ff9cbef
Fix lobby server start-up logging
AMacro Dec 14, 2024
d6ce991
Refactor StationLocoSpawner
AMacro Dec 14, 2024
bedd1df
Fixed issue `Undefined packet 34 in NetDataReader`
AMacro Dec 14, 2024
225c2ad
Clean up logging
AMacro Dec 21, 2024
dd51870
Refactor Networking components
AMacro Dec 21, 2024
e2645f0
Fixed issue with overloading cargo on cars
AMacro Dec 22, 2024
2dea876
Added initialisation delay to NetworkedBogie
AMacro Dec 22, 2024
9891cf9
Re-wrote car spawning method and data structures
AMacro Dec 22, 2024
b778c03
Fix item bugs
AMacro Dec 22, 2024
d7f5d4c
Refactored SpawnPart data for easier maintenance
AMacro Dec 22, 2024
8385434
Rework of coupler interaction messages
AMacro Dec 27, 2024
7ca6943
Minor clean-up of LAN discovery packets
AMacro Dec 27, 2024
6a85e68
Updating to include Steam Networhing for NATpunch
morm075 Jan 1, 2025
3274b8b
Remove reliance on RegEx checks
AMacro Jan 1, 2025
cea0970
Add support for Steam player name
AMacro Jan 2, 2025
9c08cda
Update default settings
AMacro Jan 2, 2025
ab238cc
Edited french locale
Harfeur Jan 2, 2025
edee3db
Intellisense Message fixes
AMacro Jan 3, 2025
829aacb
Fix for dictionaries caching deleted cards
AMacro Jan 3, 2025
e5272c7
Intellisense Message fixes
AMacro Jan 4, 2025
deebcdc
Update brake pressure synchronisation
AMacro Jan 4, 2025
1cb5945
Improve logging of NetworkedTrainCar Sim data
AMacro Jan 4, 2025
5dba907
Complete coupler sync update.
AMacro Jan 4, 2025
5f841d5
General tidy up of code and logging
AMacro Jan 4, 2025
dd576f2
Fix issues with job sync and overview spawns
AMacro Jan 4, 2025
537b4a0
Fix issues with cargo sync
AMacro Jan 4, 2025
4bd5a16
Fix issues with deletion of cars on the client
AMacro Jan 4, 2025
4ece2c6
Temporary patch for restoration / demo locos
AMacro Jan 4, 2025
4607b60
Begin work on loco restoration sync
AMacro Jan 4, 2025
f78eb89
Fix for Main Menu braking on clients when exiting a game
AMacro Jan 4, 2025
206c839
Brake sync fix
AMacro Jan 4, 2025
40e7a53
Minor change to logging
AMacro Jan 4, 2025
f301276
Increase time out of connection attempt to match disconnect time out
AMacro Jan 4, 2025
83445a1
Fix for dictionaries not clearing on return to main menu
AMacro Jan 5, 2025
41a9b36
Add in paint theme and basic restoration sync
AMacro Jan 11, 2025
3874c05
Update job registration and plate update process
AMacro Jan 11, 2025
32fb210
Coupler interaction ready for testing
AMacro Jan 11, 2025
c16b500
Fix bug with persistent cache
AMacro Jan 11, 2025
f05eed5
Fix null reference issue on ChatGUI
AMacro Jan 11, 2025
4b18adc
Enhance SendDestroyTrainCar() to allow packets to be sent to a specif…
AMacro Jan 11, 2025
4b15374
Fix fast travel bug deleting cars client and server side
AMacro Jan 11, 2025
96adda5
Fix IPv6 connection issue
AMacro Jan 11, 2025
715d6dd
Prepare for testing and release
AMacro Jan 11, 2025
0e39fa2
Readded quotes
AMacro Jan 11, 2025
0745a28
Merge pull request #60 from Harfeur/patch-1
AMacro Jan 11, 2025
ea42a10
Improve job validation sync
AMacro Jan 12, 2025
64ee11b
Sync brake heating states
AMacro Jan 12, 2025
c0d59d6
Improve job update handling
AMacro Jan 12, 2025
255f104
Improve jittering of derailed cars
AMacro Jan 12, 2025
084df26
Improve position sync when there's a coupling de-sync
AMacro Jan 12, 2025
27dc6a2
Minor logging improvements
AMacro Jan 12, 2025
c3d8957
Fix for job validation state
AMacro Jan 12, 2025
6c49c55
Improve retrieval of steam user account
AMacro Jan 12, 2025
a967ef2
Further work to Steam integration
morm075 Jan 12, 2025
065236c
Merge branch 'feature/steam-networking' into feature/Steam-Integration
AMacro Jan 12, 2025
8efb4e9
Merge pull request #63 from morm075/feature/Steam-Integration
AMacro Jan 12, 2025
45739a8
Update PlayerListGUI behaviour
AMacro Jan 13, 2025
2d28321
Potential fix for null gameObject exception
AMacro Jan 13, 2025
70b39a5
Add check for cached null in NetworkedPlayer
AMacro Jan 14, 2025
64efdc9
Remove unsafe dictionary access, use TryGet()
AMacro Jan 14, 2025
7aca2c3
Added null reference checks for map marker updates
AMacro Jan 15, 2025
83017f5
additional logging and null checks for OnCommonHoseConnectedPacket
AMacro Jan 15, 2025
bb72202
Additional logging for LobbyServerManager WebRequests
AMacro Jan 15, 2025
dbd5108
Additional coupler interaction logging
AMacro Jan 16, 2025
fbffecd
Add delta check to OnFireboxUpdate()
AMacro Jan 16, 2025
3ab2d27
Reduce debug logging for map marker updates
AMacro Jan 16, 2025
c4f358a
Fix UI coupling issues
AMacro Jan 18, 2025
507c240
Add train paint updates
AMacro Jan 18, 2025
894a453
Disable redundant logging
AMacro Jan 18, 2025
2261397
CommsRadioSpawner fixes
AMacro Jan 18, 2025
ff3883c
Fix sync of ports for 0 state
AMacro Jan 18, 2025
bd781e0
Ready for release
AMacro Jan 18, 2025
9d3ae39
Added credit for french translations
AMacro Jan 18, 2025
8fbafe8
Merge branch 'beta' of https://github.com/AMacro/dv-multiplayer into …
AMacro Jan 18, 2025
1ce7ecb
Merge branch 'beta' into feature/steam-networking
AMacro Jan 18, 2025
4a28222
Upgrade to latest LiteNetLib
AMacro Jan 19, 2025
610c3df
Implement TransportLayer interfaces
AMacro Jan 19, 2025
97a2e35
Implement SteamTransportLayer
AMacro Jan 19, 2025
fcb094c
Refactor of login sequence
AMacro Jan 20, 2025
1ab627e
Continuation of TransportLayers
AMacro Jan 20, 2025
5c3fc6d
Remove unused unnecessary logging
AMacro Jan 22, 2025
3f7d75c
Cleanup
AMacro Jan 22, 2025
49c9035
Rework player disconnection flow
AMacro Jan 22, 2025
7a2a561
Fix issues with port sync
AMacro Jan 24, 2025
36551d4
Implement server browser changes to allow relay connections
AMacro Jan 25, 2025
973d393
fix HostGamePane port textbox
AMacro Jan 25, 2025
c3e1d4c
Allow steam invites when game is not running
AMacro Jan 25, 2025
f61bf7f
Refactor MainMenuThingsAndStuff
AMacro Jan 25, 2025
7c6d0a0
Add direct connection and menu invites
AMacro Jan 25, 2025
ed54683
Publicise NetAddress
AMacro Jan 25, 2025
839125a
Enable pings for all mod versions
AMacro Jan 26, 2025
4db640d
Join requests not working if on the Server Browser
AMacro Jan 26, 2025
b279fe5
Allow request to join from Steam Friends
AMacro Jan 26, 2025
0e65d0b
Make non-public games private
AMacro Jan 27, 2025
e24ebe0
Refactor lobby request workflow
AMacro Jan 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed brake pressure sync issue
AMacro committed Aug 2, 2024
commit 2718a78ecb945b0aa8b190fe10b6f0937053fec0
2 changes: 1 addition & 1 deletion Multiplayer/Components/MainMenu/ServerBrowserPane.cs
Original file line number Diff line number Diff line change
@@ -697,7 +697,7 @@ private void AttemptIPv6Punch()

private void AttemptIPv4()
{
Multiplayer.Log($"AttemptIPv4() {address}");
Multiplayer.Log($"AttemptIPv4() {address}, {connectionState}");

if (connectionState == ConnectionState.Aborted)
return;
45 changes: 45 additions & 0 deletions Multiplayer/Components/Networking/Train/NetworkedTrainCar.cs
Original file line number Diff line number Diff line change
@@ -77,6 +77,7 @@ public static bool TryGetFromTrainCar(TrainCar trainCar, out NetworkedTrainCar n
private Dictionary<string, float> lastSentPortValues;
private HashSet<string> dirtyFuses;
private bool handbrakeDirty;
private bool mainResPressureDirty;
public bool BogieTracksDirty;
public int Bogie1TrackDirection;
public int Bogie2TrackDirection;
@@ -150,13 +151,18 @@ private void Start()

brakeSystem.HandbrakePositionChanged += Common_OnHandbrakePositionChanged;
brakeSystem.BrakeCylinderReleased += Common_OnBrakeCylinderReleased;


NetworkLifecycle.Instance.OnTick += Common_OnTick;
if (NetworkLifecycle.Instance.IsHost())
{
NetworkLifecycle.Instance.OnTick += Server_OnTick;
bogie1.TrackChanged += Server_BogieTrackChanged;
bogie2.TrackChanged += Server_BogieTrackChanged;
TrainCar.CarDamage.CarEffectiveHealthStateUpdate += Server_CarHealthUpdate;

brakeSystem.MainResPressureChanged += Server_MainResUpdate;

StartCoroutine(Server_WaitForLogicCar());
}
}
@@ -186,6 +192,9 @@ private void OnDisable()
bogie1.TrackChanged -= Server_BogieTrackChanged;
bogie2.TrackChanged -= Server_BogieTrackChanged;
TrainCar.CarDamage.CarEffectiveHealthStateUpdate -= Server_CarHealthUpdate;

brakeSystem.MainResPressureChanged -= Server_MainResUpdate;

if (TrainCar.logicCar != null)
{
TrainCar.logicCar.CargoLoaded -= Server_OnCargoLoaded;
@@ -227,6 +236,7 @@ private IEnumerator Server_WaitForLogicCar()
public void Server_DirtyAllState()
{
handbrakeDirty = true;
mainResPressureDirty = true;
cargoDirty = true;
cargoIsLoading = true;
healthDirty = true;
@@ -238,7 +248,12 @@ public void Server_DirtyAllState()
{
dirtyPorts.Add(portId);
if (simulationFlow.TryGetPort(portId, out Port port))
{
lastSentPortValues[portId] = port.value;

//Multiplayer.Log($"Server_DirtyAllState({TrainCar.ID}): {portId}({port.type}): {port.value}({port.valueType})");

}
}

foreach (string fuseId in simulationFlow.fullFuseIdToFuse.Keys)
@@ -295,15 +310,29 @@ private void Server_CarHealthUpdate(float health)
healthDirty = true;
}

private void Server_MainResUpdate(float normalizedPressure, float pressure)
{
mainResPressureDirty = true;
}

private void Server_OnTick(uint tick)
{
if (UnloadWatcher.isUnloading)
return;
Server_SendBrakePressures();
Server_SendCouplers();
Server_SendCargoState();
Server_SendHealthState();
}

private void Server_SendBrakePressures()
{
if (!mainResPressureDirty)
return;
mainResPressureDirty = false;
NetworkLifecycle.Instance.Server.SendBrakePressures(NetId, brakeSystem.mainReservoirPressure, brakeSystem.independentPipePressure, brakeSystem.brakePipePressure, brakeSystem.brakeCylinderPressure);
}

private void Server_SendCouplers()
{
if (!sendCouplers)
@@ -527,5 +556,21 @@ public void Client_ReceiveTrainPhysicsUpdate(in TrainsetMovementPart movementPar
}
}

public void Client_ReceiveBrakePressureUpdate(float mainReservoirPressure, float independentPipePressure, float brakePipePressure, float brakeCylinderPressure)
{
if (brakeSystem == null)
return;

if (!hasSimFlow)
return;

brakeSystem.ForceIndependentPipePressure(independentPipePressure);
brakeSystem.ForceTargetIndBrakeCylinderPressure(brakeCylinderPressure);
brakeSystem.SetMainReservoirPressure(mainReservoirPressure);

brakeSystem.brakePipePressure = brakePipePressure;
brakeSystem.brakeCylinderPressure = brakeCylinderPressure;
}

#endregion
}
Original file line number Diff line number Diff line change
@@ -73,6 +73,7 @@ public void Server_UpdateInternalData(SaveGameData data)
JObject playerData = new();
playerData.SetVector3(SaveGameKeys.Player_position, player.AbsoluteWorldPosition);
playerData.SetFloat(SaveGameKeys.Player_rotation, player.WorldRotationY);
//store inventory see StorageSerializer.SaveStorage()
players.SetJObject(player.Guid.ToString(), playerData);
}

4 changes: 2 additions & 2 deletions Multiplayer/Multiplayer.csproj
Original file line number Diff line number Diff line change
@@ -3,8 +3,8 @@
<TargetFramework>net48</TargetFramework>
<LangVersion>latest</LangVersion>
<RootNamespace>Multiplayer</RootNamespace>
<FileVersion>0.1.7.0</FileVersion>
<AssemblyVersion>0.1.7.0</AssemblyVersion>
<FileVersion>0.1.7.2</FileVersion>
<AssemblyVersion>0.1.7.2</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
49 changes: 38 additions & 11 deletions Multiplayer/Networking/Managers/Client/NetworkClient.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Net;
using System.Text;
using System.Collections.Generic;
using DV;
using DV.Damage;
using DV.InventorySystem;
@@ -11,6 +12,7 @@
using DV.UI;
using DV.WeatherSystem;
using LiteNetLib;
using Multiplayer.Components;
using Multiplayer.Components.MainMenu;
using Multiplayer.Components.Networking;
using Multiplayer.Components.Networking.Jobs;
@@ -34,6 +36,7 @@
using UnityEngine;
using UnityModManagerNet;
using Object = UnityEngine.Object;
using System.Linq;

namespace Multiplayer.Networking.Listeners;

@@ -109,6 +112,7 @@ protected override void Subscribe()
netPacketProcessor.SubscribeReusable<CommonHandbrakePositionPacket>(OnCommonHandbrakePositionPacket);
netPacketProcessor.SubscribeReusable<CommonTrainPortsPacket>(OnCommonSimFlowPacket);
netPacketProcessor.SubscribeReusable<CommonTrainFusesPacket>(OnCommonTrainFusesPacket);
netPacketProcessor.SubscribeReusable<ClientboundBrakePressureUpdatePacket>(OnClientboundBrakePressureUpdatePacket);
netPacketProcessor.SubscribeReusable<ClientboundCargoStatePacket>(OnClientboundCargoStatePacket);
netPacketProcessor.SubscribeReusable<ClientboundCarHealthUpdatePacket>(OnClientboundCarHealthUpdatePacket);
netPacketProcessor.SubscribeReusable<ClientboundRerailTrainPacket>(OnClientboundRerailTrainPacket);
@@ -118,10 +122,10 @@ protected override void Subscribe()
netPacketProcessor.SubscribeReusable<ClientboundLicenseAcquiredPacket>(OnClientboundLicenseAcquiredPacket);
netPacketProcessor.SubscribeReusable<ClientboundGarageUnlockPacket>(OnClientboundGarageUnlockPacket);
netPacketProcessor.SubscribeReusable<ClientboundDebtStatusPacket>(OnClientboundDebtStatusPacket);
//netPacketProcessor.SubscribeReusable<ClientboundJobsPacket>(OnClientboundJobsPacket);
//netPacketProcessor.SubscribeReusable<ClientboundJobCreatePacket>(OnClientboundJobCreatePacket);
//netPacketProcessor.SubscribeReusable<ClientboundJobTakeResponsePacket>(OnClientboundJobTakeResponsePacket);
netPacketProcessor.SubscribeReusable<CommonChatPacket>(OnCommonChatPacket);
netPacketProcessor.SubscribeReusable<ClientboundJobsPacket>(OnClientboundJobsPacket);
netPacketProcessor.SubscribeReusable<ClientboundJobCreatePacket>(OnClientboundJobCreatePacket);
netPacketProcessor.SubscribeReusable<ClientboundJobTakeResponsePacket>(OnClientboundJobTakeResponsePacket);
netPacketProcessor.SubscribeReusable<CommonChatPacket>(OnCommonChatPacket);
}

#region Net Events
@@ -564,6 +568,17 @@ private void OnCommonTrainFusesPacket(CommonTrainFusesPacket packet)
networkedTrainCar.Common_UpdateFuses(packet);
}

private void OnClientboundBrakePressureUpdatePacket(ClientboundBrakePressureUpdatePacket packet)
{
if (!NetworkedTrainCar.Get(packet.NetId, out NetworkedTrainCar networkedTrainCar))
return;


networkedTrainCar.Client_ReceiveBrakePressureUpdate(packet.MainReservoirPressure, packet.IndependentPipePressure, packet.BrakePipePressure, packet.BrakeCylinderPressure);

//Multiplayer.LogDebug(() => $"Received Brake Pressures netId {packet.NetId}: {packet.MainReservoirPressure}, {packet.IndependentPipePressure}, {packet.BrakePipePressure}, {packet.BrakeCylinderPressure}");
}

private void OnClientboundCargoStatePacket(ClientboundCargoStatePacket packet)
{
if (!NetworkedTrainCar.Get(packet.NetId, out NetworkedTrainCar networkedTrainCar))
@@ -671,9 +686,11 @@ private void OnCommonChatPacket(CommonChatPacket packet)
chatGUI.ReceiveMessage(packet.message);
}

/* Temp for stable release

private void OnClientboundJobCreatePacket(ClientboundJobCreatePacket packet)
{
Multiplayer.Log($"Received job packet. Job ID:{packet.job.ID}");

if (NetworkLifecycle.Instance.IsHost())
return;

@@ -682,7 +699,7 @@ private void OnClientboundJobCreatePacket(ClientboundJobCreatePacket packet)
tasks.Add(TaskBeforeDataData.ToTask(taskBeforeDataData));

StationsChainDataData chainData = packet.job.ChainData;
//packet.job.JobType

Job newJob = new Job(
tasks,
(JobType)packet.job.JobType,
@@ -700,7 +717,7 @@ private void OnClientboundJobCreatePacket(ClientboundJobCreatePacket packet)
StationController station;
if(!StationComponentLookup.Instance.StationControllerFromId(packet.stationId, out station))
{
Multiplayer.LogWarning($"OnClientboundJobCreatePacket Could not get staion for stationId: {packet.stationId}");
Multiplayer.LogWarning($"OnClientboundJobCreatePacket Could not get station for stationId: {packet.stationId}");
return;
}

@@ -716,6 +733,8 @@ private void OnClientboundJobCreatePacket(ClientboundJobCreatePacket packet)
}
private void OnClientboundJobsPacket(ClientboundJobsPacket packet)
{
Multiplayer.Log($"Received job packet. Job count:{packet.Jobs.Count()}");

if (NetworkLifecycle.Instance.IsHost())
return;

@@ -725,8 +744,6 @@ private void OnClientboundJobsPacket(ClientboundJobsPacket packet)
return;
}

Multiplayer.Log($"Received job packet. Job count:{packet.Jobs.Count()}");

for (int i=0;i < packet.Jobs.Count(); i++)
{
JobData job = packet.Jobs[i];
@@ -763,13 +780,15 @@ private void OnClientboundJobsPacket(ClientboundJobsPacket packet)

private void OnClientboundJobTakeResponsePacket(ClientboundJobTakeResponsePacket packet)
{
Multiplayer.Log($"OnClientboundJobTakeResponsePacket jobId: {packet.netId}, Status: {packet.granted}");

NetworkedJob networkedJob;

if(!NetworkedJob.Get(packet.netId, out networkedJob))
return;

NetworkedPlayer player;
if (PlayerManager.TryGetPlayer(packet.playerId, out player))
if (ClientPlayerManager.TryGetPlayer(packet.playerId, out player))
{
networkedJob.takenBy = player.Guid;
}
@@ -780,7 +799,7 @@ private void OnClientboundJobTakeResponsePacket(ClientboundJobTakeResponsePacket
networkedJob.jobValidator = null;
networkedJob.jobOverview = null;
}
*/

#endregion

#region Senders
@@ -999,6 +1018,14 @@ public void SendPorts(ushort netId, string[] portIds, float[] portValues)
PortIds = portIds,
PortValues = portValues
}, DeliveryMethod.ReliableOrdered);

string log=$"Sending ports netId: {netId}";
for (int i = 0; i < portIds.Length; i++) {
log += $"\r\n\t{portIds[i]}: {portValues[i]}";
}

Multiplayer.LogDebug(() => log);

}

public void SendFuses(ushort netId, string[] fuseIds, bool[] fuseValues)
14 changes: 14 additions & 0 deletions Multiplayer/Networking/Managers/Server/NetworkServer.cs
Original file line number Diff line number Diff line change
@@ -273,6 +273,20 @@ public void SendTrainsetPhysicsUpdate(ClientboundTrainsetPhysicsPacket packet, b
SendPacketToAll(packet, reliable ? DeliveryMethod.ReliableOrdered : DeliveryMethod.Unreliable, selfPeer);
}

public void SendBrakePressures(ushort netId, float mainReservoirPressure, float independentPipePressure, float brakePipePressure, float brakeCylinderPressure)
{
SendPacketToAll(new ClientboundBrakePressureUpdatePacket
{
NetId = netId,
MainReservoirPressure = mainReservoirPressure,
IndependentPipePressure = independentPipePressure,
BrakePipePressure = brakePipePressure,
BrakeCylinderPressure = brakeCylinderPressure
}, DeliveryMethod.ReliableOrdered, selfPeer);

//Multiplayer.LogDebug(()=> $"Sending Brake Pressures netId {netId}: {mainReservoirPressure}, {independentPipePressure}, {brakePipePressure}, {brakeCylinderPressure}");
}

public void SendCargoState(TrainCar trainCar, ushort netId, bool isLoading, byte cargoModelIndex)
{
Car logicCar = trainCar.logicCar;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Multiplayer.Networking.Packets.Clientbound.Train;

public class ClientboundBrakePressureUpdatePacket
{
public ushort NetId { get; set; }
public float MainReservoirPressure { get; set; }
public float IndependentPipePressure { get; set; }
public float BrakePipePressure { get; set; }
public float BrakeCylinderPressure { get; set; }
}
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Id": "Multiplayer",
"Version": "0.1.7.0",
"Version": "0.1.7.2",
"DisplayName": "Multiplayer",
"Author": "Insprill, Macka, Morm",
"EntryMethod": "Multiplayer.Multiplayer.Load",