I7: Resetting objects

I’m developing a game that requires for every object in the game to be reset to where they were at the beginning of the day. How would I make sure that everything is reset to the point it started without it becoming tedious?

For example, if Mrs. Miggins starts walking around the city at 7:00 AM, I need her to be back at her house, at 7:00, ready to walk again.
Think of it like Majora’s Mask, or Groundhog Day. Whenever the player calls for it, everything resets.

And, of course, there are also things that only happen the first day or second, so I don’t want to have the game actually end and start again, either.

Resetting objects is tedious, in general.

(An older discussion on this topic: https://intfiction.org/t/2-characters-play-through-2-games-in-one-environment/1705/1 )

In Glulx you can do a full restart while saving a few values for the next go-round. This may be sufficient for what you want.

I can think of several different tedious ways :slight_smile:

[code]“im bored” by “kook”

moo is a room; a table is here; there is an apple on the table;
foo is west of moo; a wooden table is here; there is a pear on the wooden table;

a thing has a room called default location;

when play begins:
repeat with x running through everything:
say “[x].”;
now the default location of x is the location of x;

understand “reboot” as rebooting; rebooting is an action applying to nothing;

carry out rebooting:
repeat with x running through everything:
say “[x].”;
move x to the default location of x;

Groovy. I assumed something like that was possible, but for the life of me I’ve never been able to wrap my head around the “running through” syntax (which is kind of crippling) …

Surely you would want “an object called the default holder” instead, for things that are offstage or contained by other things?

Another approach would be to avoid declarative sentences, and put all initialization in a rulebook:

Instead of:

Mrs Miggins is a woman in Mrs Miggins' house

You’d have:

[code]Resetting is a rulebook. When play begins: follow the resetting rules. Every turn when the time of day is 7:00 AM: follow the resetting rules.

Mrs Miggins is a woman. Resetting: Now Mrs Miggins is in Mrs Miggins’ house.[/code]

The tedious part is resetting the open state of doors and containers, and the locked state (if appropriate), and any other properties you define or make use of. You can do it; it’s just a pain.

I don’t know a good way to reset “[first time]…[only]” say phrases. You might have to replace those with manually-set flags. On the other hand, you may not need to. If the protagonist is aware of repeating time, it may make sense for first-time descriptions to only appear on the first go-round.