So, it was a long dinner...
Yeah, still trying to get back to writing every day, even if most of it's crap. Any good writer will tell you that's the key.. write a LOT of crap, because every once in a while, some of it sticks and isn't too smelly.
So, we left off with the idea of wanting to build a gigantic MUD world, having a map drawn out of the Big Picture, and maybe having a few slaves...errr.. builders to help make things come to life. The problem is, when Joe comes up with a brilliant story idea for an ice cave, and we HAVE a perfect spot for an ice cave up in the mountains, nobody has yet written the chunk of the world between the mountains and the newbie village. So, either Joe has to shelve the idea for a while, or bang out a bunch of rooms to get to the area he really wants to work on. As you might guess, those "filler" rooms won't be very stellar quality, and there might be a whole lot of them!
That sucks.
How can we get around this? There are a couple of ways, and it really depends on how much control you want to have over your world vs. how much work you want to do. The easiest way (from the builder/admin's point of view, not from the coder's!) is to use something like Perlin Noise. The advantage of this kind of system over fractals is that it can be evaluated at a point without having to build the entire structure in memory. So, you come up with an algorithm that models terrain based on a noise-generated height map + another generated map for foliage + another map for climate + another map for types of mobs maybe, stir well, and voila! You have a self-generated world of infinite size!
Of course, if you want to go that route, you will also want to make a graphical viewer that you can use to generate maps with various seed values until you find one you like, and then zoom in and scroll around to find the perfect place to center your world. Once that's done, you hook up your game's room code so that if no hand-coded room exists for the coordinate in question, it generates one based on those map values. Since such a room is temporary, it won't take any space and will go away after nobody's been there for a while. But, since the noise functions aren't random, it will be regenerated exactly as before next time you go to those coordinates.
If you aren't willing to surrender that much control, there is also the tried-and-true method of drawing maps in a paint program and having your code read them in. The downside is that you DO have to store the image in memory so it can be referenced without disk I/O. You also have to chunk your world up into square segments.... AND if you do allow multiple maps, the edges have to line up. If you choose the idea above of using multiple maps for terrain/climate/etc, you may have some work getting all the overlapping to mesh cleanly (photoshop to the rescue?).
Whichever method you choose, the end result is the same. You now have to have coordinates for your outdoor rooms such that your mechanism for moving knows what to expect when you type "north". That's not to say you have to have coordinates for every room... you could omit them for hand-edited things... but you may wish to be careful how you link between custom sectons and generated ones.
Many MUDs use a kludgy version called an "overland" map, which works a bit like the old Ultima IV game. You walk around the "overland" and then "enter" places of interest. Thus, movement on the overland is always by coordinates, and movement in the zones is always NOT. I prefer a more seamless approach, where the exit can either point to a room (vnum, path, depends on your type of MUD), or a coordinate (which might map to an already existing room, or which might cause a new room to be generated). That makes the distinction between hand-edited rooms and "filler" less obvious. In fact, if you use coordinates everywhere AND you write a reasonably good description generator, you can just skip over the small handfuls of rooms you used to have to write into your areas as filler spaces (IE: the 4 grasslands on either side of a road, etc).
I could write more here, but this has been a draft long enough.. let it be live!
06 August, 2009
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment