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

Chris Gray cg at ami-cg.GraySage.Edmonton.AB.CA
Sat May 31 09:59:17 New Zealand Standard Time 1997

```[Chris L:]
:>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.
:
:If you use fixed seeds which _are_ stored in the DB, then shouldn't
:the algorithm repeat when you interpolate between your fixed and known
:seeds?

If interpolation here means to follow the fractal rules in order to
generate down to the level of detail needed, then yes, it *should* be
possible. I think perhaps my problem (it was a while ago that I last
played with this) may have been simple grunge programming problems.

It occurs to me now that the *order* in which points are computed is
very important. The goal is to minimize the number of seeds that must
be stored, but still be able to compute down to some point without
having to compute hundreds of other points on the way. The problem is
the random number generator requiring that each generated number be
used in exactly the same way in order to reproduce the terrain correctly.

To clarify a bit, I don't think you can do this by using *just* the
co-ordinates as the seed, else you will get patterns in your terrain.
Hmm, is that what Miro's code example is doing - working hard to remove
any patterns that would show up, so that just the coordinates can be used?

A conceptual problem I have is that if each level of the hierarchy is,
say, 16 x 16, then you only have 8 bits as your seed. That would seem
to restrict you to 256 possible outcomes, which is not random enough.
Hmm (thinking on the fly here), possibly the top level could have fully
stored seeds (that's only 256 of them), and all other levels could use
all bits at their level and all higher levels. That gives 16 bits as
the seed for each square in the second hierarchy level. Oh yes, and you
can merge in the stored seed, too - that ought to be satisfactory.

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

```