FakeFishGames / Barotrauma

A 2D online multiplayer game taking place in a submarine travelling through the icy depths of Jupiter's moon Europa.
http://www.barotraumagame.com/
1.67k stars 395 forks source link

Defining any OutpostConfig to use premade outposts will cause level equality to fail in multiplayer #14205

Open NilanthAnimosus opened 1 week ago

NilanthAnimosus commented 1 week ago

Discussed in https://github.com/FakeFishGames/Barotrauma/discussions/14204

Originally posted by **NilanthAnimosus** June 25, 2024 ### Disclaimers - [X] I have searched the issue tracker to check if the issue has already been reported. - [X] My issue happened while using mods. ### What happened? Defining an OutpostConfig that uses outpostfilepath="pathtosub.sub" will cause level equality issues in multiplayer, rejoining might result in a single module outpost or other equivilant (and not the expected submarine) though the issue appears to be the client generating the submarine file outpost, while the server generates from modules only, related code in additional info. ### Reproduction steps 1. Add to locationTypes.xml an entry such as: ``` ``` 2. now add to OutpostGenerationParameters.xml an entry such as: ``` ``` 3. Now host a dedicated campaign and as a client find an outpost that is "Unknown" (as no text exists), upon loading that outpost a level equality fail will occur. ### Bug prevalence Happens every time I play ### Single player or multiplayer? Multiplayer hosted using a dedicated server ### - _No response_ ### Version v1.5.8.0 (Summer Update) ### - _No response_ ### Which operating system did you encounter this bug on? Windows ### Relevant error messages and crash reports The issue appears to be the client code has an override to generate a specific outpost, but the shared/server code does not. I understand the tutorial outpost aka setting a starting outpost is singleplayer only, though any mod trying to have specific locations be specific outposts will break multiplayer syncing currently. After debugging, CampaignMode.cs (Clientsource) hits this code on line 347 which the server instead generates with modules as the client uses the sub file: ``` protected SubmarineInfo GetPredefinedStartOutpost() { if (Map?.CurrentLocation?.Type?.GetForcedOutpostGenerationParams() is OutpostGenerationParams parameters && !parameters.OutpostFilePath.IsNullOrEmpty()) { return new SubmarineInfo(parameters.OutpostFilePath.Value) { OutpostGenerationParams = parameters }; } return null; } ``` Suggest moving this code from client to shared/server (Or at the very least - a check if connected to server, though this will still have mod issues in MP), and perhaps allowing the setting of a starting outpost regardless of tutorial setting (to open that up for modders perhaps - That seems to be popular on discord amongst modders as a wanted feature).