I enjoy coding, but doing it for a living can be very taxing. Therefore, I decided to start a project of my own, to keep coding, but do something that’s more stimulating to me. Also, there’s Miska Fredman’s #mapvember to which this can be my own special contribution.
Note that this is more about brainstorming and writing about the problems and possibilities this approach presents. I’ll try to return with something that works before the end of the month.
Types of Maps
I was thinking about many possibilities. There’s a heuristic on how cities grow based on waves of development, which I’ve been thinking about doing for a long time, but that would require more research than I’m willing to commit to during the month. I could do that in a smaller scale, say a village, which grows organically around a few features, like a stream and a road, where someone first founds an inn or a farm and others follow.
The most ambitious idea I had was to simulate how these caves actually come about. I would have made a three-dimensional model of a random bedrock with variations on thickness and put some pressure on it (simulating water) and see what happens. Would have required some understanding of chemistry I definitely don’t possess, but it was an interesting idea.
On a similar vein, there’s always maps of nature, which I could have done, or maybe maps of nations. Either could use similar natural approaches, as human (or other) settlements always follow natural boundaries in some way (well, unless some dictator simply decides to settle an area to suit his own needs, whatever those might be).
In the end, I settled on “RuneQuest style dungeon”. This might be only in my head, but as my early experiences with RPGs were largely with D&D Red Box and the Finnish version of RuneQuest, I remember the exact lines from the D&D Modules and more natural lines of the RQ Scenarios. So, basically this means a natural cave, which has been co-opted by someone, even if I don’t think these could actually occur in nature.
So, how to do this automatically? The secret here is that it doesn’t need to be perfect, it just needs to look good enough. So, my idea is this (in steps):
1. Put enough random ellipses to represent the rooms in the caverns.
2. Draw random lines around these ellipses to make it seem more “natural”
3. Assume overlapping ellipses are the same room and thus don’t need a further connection.
4. Find rooms that need connecting and draw connections using a series of overlapping polygons and drawing random lines around them to again make them seem more natural.
5. Fill the ellipses and polygons with white get rid of lines drawn in the rooms and the tunnels. This will leave some rubbish on the map, but you can chalk it up to clutter within the caverns.
I’ve done some tests and I think I can get everything to work, except with one little problem: finding overlapping ellipses. Initially I though this can’t be very hard, because finding overlaps with circles is easy. You just check the distance between the center points of the two circles. If its less than the sum of the radii, the two overlap. I was thinking this could be easily generalized into ellipses, but not so. I was reading through an 11 page paper on the subject and couldn’t really understand it, as I haven’t been reading such materials since I left University seven years ago.
Well, I hope I can find a heuristic of some sort to make this easier. There must people out there struggling with the same problem. What I can probably do is some sort of Monte Carlo system, which tests a bunch of random points on a selected arc of both ellipses and … do something. We’ll see.