You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A racing game with randomized items, randomized sounds and online multiplayer.
Describe the problem or limitation you are having in your project
With randomization in a game (especially a multiplayer game) it is often desired to have deterministic behavior across all gameplay logic via a seed.
Godot provides methods to do this via the global scope and RandomNumberGenerator.
However, relying on the global scope is often not feasible, as certain classes such as AudioStreamRandomizer call upon this randomizer and advance the state, making it inconsistent if all random calls are not 100% happening in the same order and at the same time, as is almost never the case in online play.
This can lead to desyncs between the server and the client and it's often not desired to constantly synchronize the state of the randomizer (which is currently not even possible in the global scope, as setting the state is not exposed)
Describe the feature / enhancement and how it helps to overcome the problem or limitation
There would need to be a way to distinguish between important logic RNG and unimportant RNG, such as sounds that don't matter to gameplay. For example: footstep sounds being randomized.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
This feature would allow defining what RNG to randomize through per resource or class that requires it. E.g. for an AudioStreamRandomizer a parameter on the AudioStreamPlayback could be set to refer to a different RNG than the global scope one.
Alternatives for other classes would be setting the randomizer to draw from ahead of time via a function.
There could also potentially be a list similar to audio buses in the project settings, allowing adding global RNGs and setting the RNG per resource in the editor instead of code.
If this enhancement will not be used often, can it be worked around with a few lines of script?
It can be partially worked around with, for example, having an autoload available with a RandomNumberGenerator that is only used for gameplay logic and regularly synchronized between players.
However, this does not address the situation of wanting to get a random voice line from an AudioStreamRandomizer, but having the same voice line play on all clients for consistency's or gameplay purpose's sake.
Is there a reason why this should be core and not an add-on in the asset library?
Randomization is already a core part of the engine, including AudioStreamRandomizer and many more classes.
It makes sense to have finer control of these randomizations in core.
The text was updated successfully, but these errors were encountered:
Calinou
changed the title
Add more direct control over how engine classes perform randomization
Add more direct control over how engine classes such as AudioStreamRandomizer perform randomization
Jul 11, 2024
Describe the project you are working on
A racing game with randomized items, randomized sounds and online multiplayer.
Describe the problem or limitation you are having in your project
With randomization in a game (especially a multiplayer game) it is often desired to have deterministic behavior across all gameplay logic via a seed.
Godot provides methods to do this via the global scope and
RandomNumberGenerator
.However, relying on the global scope is often not feasible, as certain classes such as
AudioStreamRandomizer
call upon this randomizer and advance the state, making it inconsistent if all random calls are not 100% happening in the same order and at the same time, as is almost never the case in online play.This can lead to desyncs between the server and the client and it's often not desired to constantly synchronize the state of the randomizer (which is currently not even possible in the global scope, as setting the state is not exposed)
Describe the feature / enhancement and how it helps to overcome the problem or limitation
There would need to be a way to distinguish between important logic RNG and unimportant RNG, such as sounds that don't matter to gameplay. For example: footstep sounds being randomized.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
This feature would allow defining what RNG to randomize through per resource or class that requires it. E.g. for an
AudioStreamRandomizer
a parameter on theAudioStreamPlayback
could be set to refer to a different RNG than the global scope one.Alternatives for other classes would be setting the randomizer to draw from ahead of time via a function.
There could also potentially be a list similar to audio buses in the project settings, allowing adding global RNGs and setting the RNG per resource in the editor instead of code.
If this enhancement will not be used often, can it be worked around with a few lines of script?
It can be partially worked around with, for example, having an autoload available with a
RandomNumberGenerator
that is only used for gameplay logic and regularly synchronized between players.However, this does not address the situation of wanting to get a random voice line from an
AudioStreamRandomizer
, but having the same voice line play on all clients for consistency's or gameplay purpose's sake.Is there a reason why this should be core and not an add-on in the asset library?
Randomization is already a core part of the engine, including
AudioStreamRandomizer
and many more classes.It makes sense to have finer control of these randomizations in core.
The text was updated successfully, but these errors were encountered: