[MUD-Dev] Re: Terrain/Landmass & GIF/BMP

Marc Hernandez marc at jb.com
Thu Oct 8 00:46:00 New Zealand Daylight Time 1998


On Wed, 7 Oct 1998, quzah [sotfhome] wrote:

	This is one of my favorite subjects :-).  I have multiple
implementations of various simple methods to generate land including
plasma                                  //I _love_ pine 
fractal, more traditional fractals (from Kenton Musgrave), random brownian
motion walks, continent division (take the land.  Split into 2 sides.
lower one and raise the other, repeat) etc. If you have any questions or
need some algorithms/code just ask.
	I found taking the plasma fractal (the subdivision one previously
described) and creating one 'map' then using that map as a 'roughness'
input for the _real_ map produces some nice heterogeneous land.  Otherwise
it can be really smooth.  
	Another thing to do with plasmafractal is to not just seed the
four corners but to seed a little more.  If you had a 512x512 land you
could seed
(0,0),  (256,0),  (512,0),
(0,256),(256,256),(512,256),
(0,512),(256,512),(512,512)

	(or more).  This tends to break up the 'one big landmass' effect
plasma often gives.

}>> (For rivers I plan on using heuristics for getting from point
}>> A (river source) to point B (river mouth) but I haven't looked
}>> at it too in depth. Finally I believe I have managed to locate
}>> the actual formula for "A*" so I may see what I can do with it
}>> at a later date.)

}>I'd certainly be interested in seeing this if you have the possibility to
}>post it.

}Actually I don't think I'm going to end up using it, because of
}the fact that water flows down hill. (Yes, I'm aware of the one
}instance, perhaps more, where it doesn't, but as a whole...). So,
}not knowing enough about A* yet, (I haven't played with it yet) I
}probably will opt just to do something like:

	A* is a good heuristic for finding shortest paths without using a
complicated or expensive search but as you noted water doesnt necessarily
take the shortest path does it :-> (just the downhill one).  In fact it
tends to meander in flatter situations.

}start(x,y)
}find the valid moves from current local
}flow in one dir at random

	for 'find the valid moves' I would recommend using dir,dir+1,dir-1
(where dir is one of the 8 cardinal directions).  I tried just selecting
the lowest spot and ended up with some bad rivers.  some other ideas
including spawning a new river when certain conditions are met (so you can
get 'fingers' at the river head) etc.

}repeat
}
}>Hmmm.... Seems to me that if you want to encode *all* the information in
}>the map in a single picture, you'll get a very messy one. That is, it will
}>be very hard (just as hard as with your ASCII output) to get a feel for
}>what the map looks like. You can simply *not* encode all the data fields
}>in those 20 bits (some of which are heights, others which are resources,
}>and so on, I take it?) and make it useful for a human reader ("so, okay,
}>um, a lot of green mixed in with a little red should mean high altitude
}>and some, um, lessee, iron ore...").

}The only thing I currently need the picture for is water and land.
}The rest will be left off for now. I only need to see how high/low
}terrain is. (So I can see if I like its grouping, or if it just looks
}like a bunch of random crap ;) The image won't be used actually in
}the game, just for some test runs when map generating.

	I assume youll have your own '.map' format.  I would definatly
make a maptoxxxx (where xxxx is whatever graphics format you choose).
Then you could also split out differnt data into different graphic files.

}>As for graphics formats... The format that strikes me as the simplest is
}>plain BMP (the Windows incarnation, that is). However, other posters have
}>responded to this, so I will refrain from doing it as well.

	Another good format is targa.  It has a simple 18byte header with
very simple data after (like RGBRGBRGB... for 24 bit and RGBARGBARGBA...
for 32).

}I haven't done anything with graphics ever, so it'll all be new
}to me. Again, thanks everyone for the help.
}-Q-

	Hope this isnt noise.

Marc Hernandez		marc at eisoftware.com
Programmer		www.eisoftware.com





More information about the MUD-Dev mailing list