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

Control whether the InstanceRandom stream is reset upon Game.postUndoCommand #76

Open
jcowman2 opened this issue Nov 27, 2018 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@jcowman2
Copy link
Contributor

Overview

Picture an event function E that generates random values r1 and r2 via InstanceRandom.

The fix in #75 modifies InstanceRandom to reset its internal stream of generated values when Game.postUndoCommand is run. If the effects of E are undone and then E is executed again, it should generate the same r1 and r2 values as before.

Because Regal games are meant to be deterministic, this behavior should be desired in most cases. However, there may be instances where game developers want to allow players to receive different random results upon undoing and retrying the same event multiple times. Therefore, this behavior should be configurable.

Background

This feature is dependent on #75 being fixed.

Description

The behavior of InstanceRandom described above shall be configurable as a GameOption called repeatRandomValuesOnUndo.

This option shall be an optional boolean that defaults to true, and may be configured within regal.json.

If repeatRandomValuesOnUndo is true, InstanceRandom's stream of generated values should be reset when the events in which the values were generated are undone. Repeating those same events after the undo should, therefore, repeat the same random values.

If repeatRandomValuesOnUndo is false, the stream should NOT be reset. If an event is undone and then repeated, different values will be generated the second time. This behavior is similar to how InstanceRandom behaved before the fix.

@jcowman2 jcowman2 added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Nov 27, 2018
@jcowman2 jcowman2 added this to the Future milestone Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant