Control whether the InstanceRandom stream is reset upon Game.postUndoCommand #76
Labels
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
Milestone
Overview
Picture an event function
E
that generates random valuesr1
andr2
viaInstanceRandom
.The fix in #75 modifies
InstanceRandom
to reset its internal stream of generated values whenGame.postUndoCommand
is run. If the effects ofE
are undone and thenE
is executed again, it should generate the samer1
andr2
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 aGameOption
calledrepeatRandomValuesOnUndo
.This option shall be an optional boolean that defaults to
true
, and may be configured withinregal.json
.If
repeatRandomValuesOnUndo
istrue
,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
isfalse
, 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 howInstanceRandom
behaved before the fix.The text was updated successfully, but these errors were encountered: