-
-
Notifications
You must be signed in to change notification settings - Fork 126
Description
SyncActions are handled improperly, causing incorrect outcomes after syncing. Related types:
https://github.com/rwmt/Multiplayer/blob/master/Source/Client/Syncing/Handler/SyncAction.cs
https://github.com/rwmt/Multiplayer/blob/master/Source/Client/Syncing/Game/SyncActions.cs
There are 2 separate issues with SyncActions.
The first one is much easier to sync (and I already have a quick fix ready on my side) is caused by actions calling the same method. For example, a single world object could have multiple float menu options calling CaravanArrivalActionUtility.GetFloatMenuOptions or TransportPodsArrivalActionUtility.GetFloatMenuOptions, each one passing a different action/func/whatever to achieve different outcomes. However, since (in the end) they all call the same method, it ends up with us syncing the first one in order we encounter that has the same method description hash.
The solution seems to be rather simple - when writing/reading the action, rather than just hashing the Action.Method description, also hash Action.Target description. From my testing it seems to have fixed the issues. Relevant code locations where changes would need to be included:
https://github.com/rwmt/Multiplayer/blob/f0221d0488282629ebbdef7d58c9d4a93e393b85/Source/Client/Syncing/Handler/SyncAction.cs#L71-L72
https://github.com/rwmt/Multiplayer/blob/f0221d0488282629ebbdef7d58c9d4a93e393b85/Source/Client/Syncing/Handler/SyncAction.cs#L88-L90
The second issue is going to be a bit more difficult to handle than the first one. Specifically, many of the actions we're attempting to sync open a confirmation menu. This is problematic, since right now we're syncing the action of opening the menus, which is not exactly the fully desired option, as it will open that menu for every player. On top of that, we're not syncing inputs on those menus, which means that those interactions are synced and will cause a desync. I'm currently investigating how to fix this issue.