[DGD] Re: Persistance
Noah Gibbs
noah_gibbs at yahoo.com
Thu Jan 8 21:53:45 CET 2004
--- Stephen Schmidt <schmidsj at union.edu> wrote:
> But that's not my question.... My question is,
> how do
> I get the rooms into memory, with the proper
> object pointers to handle the exits, so I can
> create the statedump
> in the first place?
Oh, okay. I clone all the rooms and *then* connect
them with exits. I have a specific list of unresolved
exits sitting around, and after every loading pass, I
check to see if any new ones can be resolved.
I do the same thing when loading regular objects --
since an object's container and parents have to be in
memory before the object can be situated, I just load
everybody and then I connect up parents, details, who
contains whom and so forth after I've cloned everybody
in the first place.
Works nicely, though the code's kind of a pain.
Check out Phantasmal MapD for the code.
> I was
> thinking instead of something like building
> from a script,
> where the builder writes down a plan of
> 200 rooms and how
> they connect, but they're not actually
> created until
> someone runs the script. Then when that
> happens all 200
> of them are loaded at once, or maybe they're
> loaded as needed.
Yeah. I do them all at once and rely on DGD to swap
them in and out for me. I suppose I could do
create-on-demand for object loading, but since DGD
does it already, that seems like overkill to me. I
*am* going to do create-on-demand for some later zone
stuff so that I can avoid the CPU penalty of
simulating zones containing no players, but that's a
bit different.
> In the example I
> gave, the builder already has some kind of
> reference to
> room C because he built it (or he can chain
> back to it
> through rooms B and A). So if room C is
> already loaded
> as an object, then the builder points to it
> when he builds
> room D and says "connect to that one." You
> never have to
> find room C in the list of all possible
> rooms. At least,
> the code doesn't. The builder has to have some
> way to
> indicate which room he wants D to connect to.
> But that's
> a problem of designing the wiztool appropriately.
Yeah. I number all my rooms. I have something
called an ObjNumD that assigns the numbers
automatically and sorts them into zones. So I make my
builders use numbers. If you were going to run a
fully-persistent instance of Phantasmal with no data
files (it's all set up to run that way, it's just not
what I do at home), you could do it that way. It
turns out that you can do a very fast search for
"object #371" if your data structures are set up
reasonably. Much faster than linear in the number of
objects. So you're fine on that one.
Similarly, you could name every room and use one or
more mappings. That'd work and be pretty fast as
well. There are lots of ways to do it that don't
involve a full search through all your objects. I
expect find_object() is decently fast as well.
So yeah, you have to specify rooms somehow, but that
just depends on your room format and what you add to
your wiztool. I'm old-school and require the builders
to type numbers. I'm aware that that's not perfect
:-)
=====
------
noah_gibbs at yahoo.com
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
_________________________________________________________________
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list