Temple of The Roguelike Forums
Development => Programming => Topic started by: mughinn on January 25, 2013, 01:18:03 AM
-
So, in the makings of a roguelike, I'm trying to develop a somewhat good world generation algorithm, as of now I'm trying to get my own ideas and try them. This one is the one that I liked the most for now, and I somewhat made it.
I'll explain a bit the algorithm, and I'd like some criticism on it, and honest answers, if you think it's not a good idea just tell me, I wouldn't like to waste my time :)
First set a max width and height of a map, and get a good amount of random points(16 now) in it. Then i create a Voronoi diagram (https://en.wikipedia.org/wiki/Voronoi_diagram (https://en.wikipedia.org/wiki/Voronoi_diagram)).
Having that, I abstract them into Plate tectonics, and "move" them into a random direction, overlaping them in some points.
Then i finally make the map, where the movement left no "land", i put water, when they overlap, i make mountains, and in the rest i make normal ground.
Please also keep in mind i haven't finished working on it, I know these aren't pretty, but i think it has potential.
Some generated maps (should work):
http://www.freeimagehosting.net/n9tmw (http://www.freeimagehosting.net/n9tmw)
http://www.freeimagehosting.net/bo7tp (http://www.freeimagehosting.net/bo7tp)
http://www.freeimagehosting.net/8gdhm (http://www.freeimagehosting.net/8gdhm)
http://www.freeimagehosting.net/tfjze (http://www.freeimagehosting.net/tfjze)
Okay, editing before anyone posts, I managed to make it look a bit better by making 50 random points instead of 16.
http://www.freeimagehosting.net/ndqh1 (http://www.freeimagehosting.net/ndqh1)
-
Looks pretty neat. Hard to know unless we know what kind of game. Is this a wander around and find the dungeons game? Or will it all take place on the surface? Is this the resolution of the map, or will game play be zoomed in?
-
I'm currently brainstorming a lot while programming the ground of the game, the basic idea is to have a surface, with possible quests, events, with some small catacombs or towers, and then a final, big dungeon.
It's probably too big, and won't en up there, but surface seems important.
This is mostly a small demo to see if it works or if it could work, probably after making a map like this I would create a "true map", that, for example, would be scaled so that each of the example tiles be a 50x50 or more tiles in the real game.
Though some ideas for it would be nice too.
-
I think the areas created by the overlaps look a little unnatural (even with 50 points), you could smooth them with cellular automata or a blur filter though.
I'm currently looking into voronoi diagrams for a graph based 2D roguelike and there's some great ideas in this polygonal island generation article (http://"http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/"). Instead of the overlapping you could pick a path along the edges of the diagram and widen it into a river. If you're using more points you could also combine some areas into lakes and just smooth out the shore lines.
As a side note by far the fastest and most robust implementation of voronoi I've found is in the boost polygon library but it's in C++.
You're definitely on an interesting track though.
-
I think it's a great idea - standard FBM noise makes very unnatural-looking continents and islands, with highest points on average in the middle of blobs rather than along coasts like real continents. This person tried the same thing, with very nice results: http://www.cartographersguild.com/regional-world-mapping/4737-tectonic-plate-fakery.html unfortunately they didn't share their code.
Two suggestions:
1. More flexible plate boundaries, and land boundaries within the plate. The beach isn't a tectonic fault - that will be further out to sea. If the individual cells have their own height values which can change according to the relative motion at faults (converging plates causing areas of land to rise, etc.) then you'll get much more natural looking coastlines and mountains
2. Oceanic plates. That way you can get much larger regions of ocean, and mountain ridges parallel to the coast.
-
Another way to approach this is not with algorithms but simply faking it and creating areas with much simpler routines. It certainly gives less predictable results which can lead to problems, but in world map they are usually not that critical. Just make sure the map can be travelled from important points to another.
-
Thanks for the ideas, I'll be working on this for a while.
I'll keep reading stuff to get hints at more natural looking worlds.
So here are some more example following the easiest advice I got, random ocean plates.
Here are 2, made on 200 plates, the first one with 50 plates made into ocean plates, and the second one with 100.
Also, this plates are made with manhattan distance instead of normal, direct one.
http://www.freeimagehosting.net/ddwda (http://www.freeimagehosting.net/ddwda)
http://www.freeimagehosting.net/1whu9 (http://www.freeimagehosting.net/1whu9)
This ones are respectively the same, with direct distance calculated instead of manhattan distance.
http://www.freeimagehosting.net/qnouz (http://www.freeimagehosting.net/qnouz)
http://www.freeimagehosting.net/ar1cu (http://www.freeimagehosting.net/ar1cu)
There's still some smoothing to do, but i think they're going nicely. Thanks for the help.
-
I can see that system being used to make a Dragon Warrior or Warlords style overworld where some land masses are connected by single tile bridges. Do you remember such things from the original Dragon Warrior? Cross the bridge and you are in a new zone with new bad guys. And you die. Horribly. :-)
-
I like the two maps with 100/200 oceanic plates. I think they could be improved by keeping the same map size but decreasing the number of plates to something between 8 and 30 - perhaps with more varied plate sizes, and with rougher boundaries between plates.
Voronoi diagrams are nice for dividing space up, but they make unnaturally straight lines and neat corners. An alternative might be a random walk, or thresholded simplex noise.
-
I think I'll deal with that with some cellular automata, to also deal with the lonely points, although i got to say that the islands formed are actually, in my opinion, pretty good formed, except for some odd straight lines around there.
I still have to optimize and start using delauney triangulation or some method to make this faster, at the moment I'm taking nearly a minute to make the 100x100 maps.
Unfortunately Jo, I never played the NES, I searched a viedo about the game, and I see what you're talking about.
Seems nice to have difficulty areas, I'll see if i can make t work with my current idea.
One more thing, Manhattan or Euclidean distance? I like both for different things, Manhattan seems to make more straight lines, but I think the islands it makes are much more nicer, but then, Euclidean makes for some realist continents.
-
NEVER PLAYED THE NES!!!!!!!!!!!! :-[
-
Yes, I know, i should download an emulator or something, keep in mind I'm pretty young :P barely 19 since yesterday.
-
Build your own canon!
-
What do you mean by building my own canon?
-
What do you mean by building my own canon?
Probably that in 10-20 years it's your time to act shocked at the young'uns for not having played the classics from your childhood ("Never owned a PS2!? Get off my lawn!").
As always,
Minotauros
-
I just assumed Roguelike fans were well versed in classic gaming. Early RPG's like Dragon Warrior, action/quest games like Zelda, Early Editions of Dungeons and Dragons. Super Mario Brothers 1-3. Arcade classics like Donkey Kong, Galaga...that sort of thing.
EDIT: It will be interesting to see what comes out of the minds of people who lack those reference points. Most the time when I'm thinking up a game idea I get stuck at, "How do I make it more like Zelda/Gauntlet/Bubble Bobble."
-
That's a way to see it :P
Well, I know I should be somewhat versed in those games, they're probably the closest a game will be to mine, so getting ideas or investigating them would be wise.
I started drawing the tiles for the map, while still working on the generation, I'm wondering, is there any way to draw a 16x16 tile alone so that it resembles a mountain or that it's taller than the grass surroundings other than drawing a stand alone mountain every tile?
-
Yes, this is necro'd, I know.
However, this is a great topic, and I am sure that other people besides the OP would like a decent solution to this; as an example, I stumbled here by doing a Google search for this exact same thing.
Found a site where the guy that created Realm of the Mad God stepped you through his island generation, and he also uses Voronoi diagrams as a starting point, he starts, however, with 1000 points.
His goal was to get decent looking islands, and his method is based directly from that goal... however, by seeing how he makes his decisions, it may help guide others.
In addition, his results are impressive, realistic, and extremely useful if his needs match yours... and he even gives pointers for how to improve this.
Very worthwhile read.
http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/ (http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/) <-- Article
http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/mapgen2.swf (http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/mapgen2.swf) <-- Demo
-
Dude the whole genre is necroed. :P