[MUD-Dev] Rooms, 3D arrays, etc.

Chris Gray cg at ami-cg.GraySage.Edmonton.AB.CA
Tue May 27 23:54:02 CEST 1997


[Raz:]

[Discussion of spaces and zones]

:Continuation eagerly, and hopefully, awaited =3D)

OK, I'll try to dump what I can remember of my tentative plans in this
realm. I want a really big world, my thinking is 2^32 x 2^32 (why not!).
It would basically be a layered fractal terrain. That gives me the third
dimension - calculated by the fractal generation algorithm. The way one
common fractal landscape generator works is by starting with one point,
wrapped as four corners of a square. At each step, you bisect each edge
of your current square, average and perturb the endpoint heights, and
mark the height of the middle of the edge. The middle of the square gets
height from all four corners. [I've got code for this if some of you
haven't seen this algorithm.]

What I haven't quite figured out is how to be able to repeatably generate
the height for any given co-ordinates within the world. I want to
represent the world *very* sparsely, of course. So, I would divide the
top level of the world (the whole 2^32 x 2^32 square) into some number
of subsquares, say 16 x 16. If nothing at all had happened within one
of those subsquares, then it would not exist in the DB, but would be
generated as needed. The representation of a subsquare could contain
a new random seed for generating that square. It could also contain an
override for the height of the square, and perhaps others. We continue
dividing up like this until we are down to individual locations. At the
level of individual locations, we can generate a text description by
scanning back up the hierarchy of squares, looking for indications of
major scenery items. This would be based a lot on just the height, but
can also be augmented by indications of tradewinds, distance to major
bodies of water (if not easily calculatable from upper parts of the
hierarchy), terrain overrides, etc. At each level, anything important,
such as the height, can be overridden from what the fractal algorithm
generates, and that override passes down to finer detail levels. So,
store a couple overrides and you can build a higher mountain range, or
a deep valley.

At the single location level, you can use the normal "room" representation
if you want. So, you can force the system to generate that location
specifically, and it will generate all squares in the hierarchy down to
that position. It will then generate the single location, and put in
whatever you wanted. So, if you want location 308754,2987643 to have a
funny hollow log, you just say so, and the magic happens. Similarly, if
you want to build a deep, twisty canyon in the shape of your initials, then
a dozen or two height overrides will probably manage it.

You are going to need some fairly powerful code to examine the hierarchy
around a given location in order to generate a nice description of that
location (or a polygon image if you go graphics). As mentioned before,
the final co-ordinates can be used to repeatably generate details such
as trees, bushes, etc., which can also be overridden if wanted. If you
are going full graphics, you can use fractals to generate the actual
shape of nearby terrain (usual seeding, and using the height
of this and neighbouring locations to start the fractals), and you will
of course use the heights of nearby small terrain features and further
large terrain features (accessible via the hierarchy) to make the
background for the scene.

That gets terrain. How about towns? Well, you have to start with some
kind of street generation routine (seeded by co-ords of town of course!).
Within that you have another algorithm which creates the buildings, based
on location within town, a few random choices about the nature of the
town, its age, etc. You will then need algorithms to generate the details
of the buildings themselves (floorplan, materials, colours, contents);
and then of the interior furniture, and then of the stuff in the drawers,
etc. etc. Of course everything is generated as "real", and if players
change something you have to keep track of the change, and perhaps at
some point you just decide to permanently instantiate stuff.

Whew! That would keep us all busy for a year or two! Nobody said it
would be easy, but it would finally stop people like me that just want
to explore everything!


Uh-oh, its already past my bedtime... :-)

--
Chris Gray   cg at ami-cg.GraySage.Edmonton.AB.CA



More information about the mud-dev-archive mailing list