Conversation
The issue with those methods calling `ShouldSpawnMotesAt` is that they use RNG, changing the state of RNG depending on player-specific info (current map). Currently, the methods spawning flecks are handled in OdysseyMultifaction class. Those patches ensure that the flecks will always spawn, regardless of the map the player is on. However, we generally handle desyncs due to fleck/mote spawning like this using a prefix/finalizer and pushin/popping the RNG state, so even if the methods themselves use RNG depending on the player-specific info they'll all be safe. Handling it by using `Rand.PushState` and `Rand.PopState` is generally going to be better performance-wise, since we won't be spawning motes/flecks on maps the players isn't currently looking at. On top of that, the patches themselves are also going to be much simpler now. Changes: - Added 3 Odyssey fleck methods using `ShouldSpawnMotesAt` to list of methods that are patched with Push/Pop State - Removed OdysseyMultifaction.cs, as it's no longer needed
Contributor
|
No objections - I love cleaner solutions that work with less code! 😀 #636 can be closed when merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The issue with those methods calling
ShouldSpawnMotesAtis that they use RNG, changing the state of RNG depending on player-specific info (current map).Currently, the methods spawning flecks are handled in OdysseyMultifaction class. Those patches ensure that the flecks will always spawn, regardless of the map the player is on.
However, we generally handle desyncs due to fleck/mote spawning like this using a prefix/finalizer and pushing/popping the RNG state, so even if the methods themselves use RNG depending on the player-specific info they'll all be safe. Since motes/flecks are visual only effect with no impact on gameplay itself, Multiplayer doesn't require those to be synchronized between the players (but as this example shows, it may still cause issues if it accesses something like RNG).
Handling it by using
Rand.PushStateandRand.PopStateis generally going to be better performance-wise, since we won't be spawning motes/flecks on maps the players isn't currently looking at. On top of that, the patches themselves are also going to be much simpler now.@Tick-git pinging you since you were the one who made this fix originally. Any objections to the changes I've made here?
Changes:
ShouldSpawnMotesAtto list of methods that are patched with Push/Pop State