1997Q2/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev] Rooms, 3D arrays, etc. -->
<!--X-From-R13: fvybivpNfepr.ue ([vebfyni Evybivp) -->
<!--X-Date: from major.globecomm.net [207.51.48.5] by in5.ibm.net id 864817149.35682&#45;1 Wed May 28 10:59:09 1997 CUT -->
<!--X-Message-Id: 199705281058.MAA09348#regoc,srce.hr -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 9705280654.82jw@ami&#45;cg.GraySage.Edmonton.AB.CA -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Re: [MUD-Dev] Rooms, 3D arrays, etc.</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:silovic#srce,hr">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00889.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00891.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00975.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00806.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00890">Author</A>
&nbsp;|&nbsp;<A HREF="#00890">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00890">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev] Rooms, 3D arrays, etc.</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A></LI>
<LI><em>Subject</em>: Re: [MUD-Dev] Rooms, 3D arrays, etc.</LI>
<LI><em>From</em>: <A HREF="mailto:silovic#srce,hr">silovic#srce,hr</A> (Miroslav Silovic)</LI>
<LI><em>Date</em>: Wed, 28 May 1997 12:58:55 +0200 (MET DST)</LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
&gt; [Raz:]
&gt; 
&gt; [Discussion of spaces and zones]
&gt; 
&gt; :Continuation eagerly, and hopefully, awaited =3D)
&gt; 
&gt; OK, I'll try to dump what I can remember of my tentative plans in this
&gt; realm. I want a really big world, my thinking is 2^32 x 2^32 (why not!).
&gt; It would basically be a layered fractal terrain. That gives me the third
&gt; dimension - calculated by the fractal generation algorithm. The way one
&gt; common fractal landscape generator works is by starting with one point,
&gt; wrapped as four corners of a square. At each step, you bisect each edge
&gt; of your current square, average and perturb the endpoint heights, and
&gt; mark the height of the middle of the edge. The middle of the square gets
&gt; height from all four corners. [I've got code for this if some of you
&gt; haven't seen this algorithm.]
&gt; 
&gt; What I haven't quite figured out is how to be able to repeatably generate
&gt; the height for any given co-ordinates within the world. I want to
&gt; represent the world *very* sparsely, of course. So, I would divide the

Use pseudorandom function. Here's one I use to generate procedural
textures in my renderer:

#define SRTABLE_SIZE 18723

double srtable[SRTABLE_SIZE];

#define NRAND(x,s) ((s)*128398191+(x))
#define SRTABLE(x) (srtable[(unsigned)(x)%SRTABLE_SIZE])
 
double irand (int n, int *i)
{
    switch (n) {
    case 1:
        return SRTABLE(NRAND(i[0],i[0]));
    case 2:
        return SRTABLE(NRAND(i[0],NRAND(i[1],i[0])));
    case 3:
        return SRTABLE(NRAND(i[0],NRAND(i[1],NRAND(i[2],i[0]))));
    case 4:
        return SRTABLE(NRAND(i[0],NRAND(i[1],NRAND(i[2],NRAND(i[3],i[0])))));
    default: {
            int s=0,k=i[0];
 
            while (n--)
                s=NRAND(*(i++),s);
            return SRTABLE(NRAND(k,s)%SRTABLE_SIZE);
        }
    }
}

void init (void)
{
    for (i=0; i&lt;SRTABLE_SIZE; i++)
        srtable[i]=drand48();
}


(note that for each dimension, I use one extra NRAND which wraps around,
to remove most of the linearity). What's left of the correlation between
input and the output is not visible to human observers. It's pretty
easy to change it to return integers instead of doubles.

&gt; You are going to need some fairly powerful code to examine the hierarchy
&gt; around a given location in order to generate a nice description of that
&gt; location (or a polygon image if you go graphics). As mentioned before,
&gt; the final co-ordinates can be used to repeatably generate details such
&gt; as trees, bushes, etc., which can also be overridden if wanted. If you
&gt; are going full graphics, you can use fractals to generate the actual
&gt; shape of nearby terrain (usual seeding, and using the height
&gt; of this and neighbouring locations to start the fractals), and you will
&gt; of course use the heights of nearby small terrain features and further
&gt; large terrain features (accessible via the hierarchy) to make the
&gt; background for the scene.
&gt; 
&gt; That gets terrain. How about towns? Well, you have to start with some
&gt; kind of street generation routine (seeded by co-ords of town of course!).
&gt; Within that you have another algorithm which creates the buildings, based
&gt; on location within town, a few random choices about the nature of the
&gt; town, its age, etc. You will then need algorithms to generate the details
&gt; of the buildings themselves (floorplan, materials, colours, contents);
&gt; and then of the interior furniture, and then of the stuff in the drawers,
&gt; etc. etc. Of course everything is generated as "real", and if players
&gt; change something you have to keep track of the change, and perhaps at
&gt; some point you just decide to permanently instantiate stuff.

*Evil grin* I'd /love/ to see some code that does some of these things. :)
In fact I might try to write some.

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

This sounds like Cray (one that does infinite loop in 2.8 seconds) :)


&gt; Uh-oh, its already past my bedtime... :-)
&gt; 
&gt; --
&gt; Chris Gray   cg#ami-cg,GraySage.Edmonton.AB.CA
&gt; 
&gt; 


</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00881" HREF="msg00881.html">Re: [MUD-Dev]	Rooms, 3D arrays, etc.</A></STRONG>
<UL><LI><EM>From:</EM> cg#ami-cg,GraySage.Edmonton.AB.CA (Chris Gray)</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00889.html">Re: [MUD-Dev]  Alright... IF your gonan do DESIESE...</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00891.html">Re: [MUD-Dev]  Resets, repops and quests</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00975.html">Re: [MUD-Dev] Rooms, 3D arrays, etc.</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00806.html">Re: [MUD-Dev]  Internal Mud Languages</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00890"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00890"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>Re: [MUD-Dev] Rooms, 3D arrays, etc.</STRONG>, <EM>(continued)</EM>
<ul compact>
<LI><strong><A NAME="00854" HREF="msg00854.html">Re: [MUD-Dev] Rooms, 3D arrays, etc.</A></strong>, 
clawrenc <a href="mailto:clawrenc#cup,hp.com">clawrenc#cup,hp.com</a>, Wed 28 May 1997, 00:56 GMT
<UL>
<LI><strong><A NAME="00906" HREF="msg00906.html">Re: [MUD-Dev] Rooms, 3D arrays, etc.</A></strong>, 
Caliban Tiresias Darklock <a href="mailto:caliban#darklock,com">caliban#darklock,com</a>, Thu 29 May 1997, 02:33 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00881" HREF="msg00881.html">Re: [MUD-Dev]	Rooms, 3D arrays, etc.</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Wed 28 May 1997, 12:58 GMT
<UL>
<LI><strong><A NAME="00975" HREF="msg00975.html">Re: [MUD-Dev] Rooms, 3D arrays, etc.</A></strong>, 
clawrenc <a href="mailto:clawrenc#cup,hp.com">clawrenc#cup,hp.com</a>, Thu 01 Jan 1970, 10:07 GMT
</LI>
<LI><strong><A NAME="00890" HREF="msg00890.html">Re: [MUD-Dev] Rooms, 3D arrays, etc.</A></strong>, 
Miroslav Silovic <a href="mailto:silovic#srce,hr">silovic#srce,hr</a>, Wed 28 May 1997, 17:59 GMT
</LI>
</UL>
</LI>
</ul>
</LI>
<LI><strong><A NAME="00806" HREF="msg00806.html">Re: [MUD-Dev]  Internal Mud Languages</A></strong>, 
Jeff Kesselman <a href="mailto:jeffk#tenetwork,com">jeffk#tenetwork,com</a>, Mon 26 May 1997, 15:00 GMT
<UL>
<li>&lt;Possible follow-up(s)&gt;<br>
<LI><strong><A NAME="00812" HREF="msg00812.html">Re: [MUD-Dev]  Internal Mud Languages</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Mon 26 May 1997, 23:46 GMT
</LI>
<LI><strong><A NAME="00857" HREF="msg00857.html">Re: [MUD-Dev]  Internal Mud Languages</A></strong>, 
Jeff Kesselman <a href="mailto:jeffk#tenetwork,com">jeffk#tenetwork,com</a>, Wed 28 May 1997, 01:55 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00790" HREF="msg00790.html">Re: [MUD-Dev]  Starting characters (was: Alright...)</A></strong>, 
Jeff Kesselman <a href="mailto:jeffk#tenetwork,com">jeffk#tenetwork,com</a>, Mon 26 May 1997, 02:22 GMT
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>