Newsgroups: rec.arts.int-fiction
Path: news.duke.edu!newsgate.duke.edu!news-hog.berkeley.edu!ucberkeley!128.135.12.170.MISMATCH!news.uchicago.edu!vixen.cso.uiuc.edu!howland.erols.net!portc.blue.aol.com.MISMATCH!portc03.blue.aol.com!uunet!dca.uu.net!ash.uu.net!world!buzzard
From: buzzard@world.std.com (Sean T Barrett)
Subject: Re: [Inform] Resetting the State of a Room
Message-ID: <GFuzpq.Cvr@world.std.com>
Date: Mon, 2 Jul 2001 18:37:02 GMT
References: <9hq41c02n4l@drn.newsguy.com>
Organization: The World Public Access UNIX, Brookline, MA
Lines: 33
Xref: news.duke.edu rec.arts.int-fiction:89438

Daryl McCullough <daryl@cogentex.com> wrote:
>Of course, I can easily write a "reset room" routine, but it seems to
>me that it would be very difficult to maintain (every change to the
>room would have to be accompanied by a corresponding change to the
>reset routine).

The problem is that what you ask for isn't really well-defined
from the computer's point of view. It's all just bits.
Save/restore/undo is easy, because the computer just
saves/restores/undoes all the bits.

But if you, say, have a room you want to restore which
contains, say, an axe, and the player has moved the axe
somewhere, you need to move the axe back. But that involves
cleaning up the containment hierarchy wherever the axe
currently is--changing the bits of some objects that have
nothing to do with the axe. That requires knowledge of
all the links--and when it's all just bits, there's really
no way for the system to know. (Or, another example: what
do you want to do with any objects the player has dropped
in the room when you reset the room?)

So you can either do as Zarf suggests, or if you want to be
nutty, you could try using dynamically created objects--to
reset an object, destroy it and create a new one. That will
still require you to fixup all links to that object from
other objects, though--e.g. for a room, you'll have to
rebuild the exits from other rooms to that room, so it
doesn't sound particularly pleasant. But I think Zarf's
approach is probably simpler since it copes with static
links better.

SeanB
