For generating roads or waterways, try coming up with rules similar to the way they're created in real life. For example, water flows downhill and pools when it finds a local minimum. Roads, on the other hand, tend to avoid steep grades when they can, typically moving straight and branching at right angles at regular intervals. Read up on L-Systems, too. They're great for creating organic structures, be they leaves,…
Ask HN: How to generate random terrain
21–30 of 34 posts
Re: Ask HN: How to generate random terrain
#22You can take a look at my master thesis (Charack: Pseudo-infinite 3D virtual world generation). It's in a pre-alpha stage, but I think you can find something useful (besides the wide range of similar tools and works I found during my research). Project link: http://code.google.com/p/charack/
Re: Ask HN: How to generate random terrain
#23Perchance recall the book? I'm semi-interested in retro approaches to the problem.
I'd love to find the book again... I bet it's out of print, though. It had lots of detail on modelling damage to tanks, and creating terrain, and working out things like line-of-sight in complex worlds, and I think some basic AI, but had nothing to say about snazzy graphics whatsoever; I think it made some reference to vector displays or something like that ;-)
This is an interesting search problem. The fact that a description like this still doesn't help in locating a book (when you think about it the set of all books published is a small one compared to say the domain of web pages on the internet), shows how much work still remians to be done in search.
Re: Ask HN: How to generate random terrain
#24http://steveasleep.appspot.com/pyworldgen
If this is what you're looking for, I can try to explain it.
Re: Ask HN: How to generate random terrain
#25You can take a look at my master thesis (Charack: Pseudo-infinite 3D virtual world generation). It's in a pre-alpha stage, but I think you can find something useful (besides the wide range of similar tools and works I found during my research). Project link: http://code.google.com/p/charack/
Re: Ask HN: How to generate random terrain
#26Re: Ask HN: How to generate random terrain
#27What kind of scale of terrain are you looking for? Continent maps or battlefield scale? I got some stuff I rolled here http://flywheel.be/examples/ All random generated. But probably not what you're looking for.
These look great - what method did you use to define the borders on the risk-like map?
1) Randomly pick center points of territories, guarantee a minimum distance for best looks
2) Compute the Voronoi raster, i.e. for each pixel find the nearest territory center
3) Figure out which territories border which, based on the Voronoi raster
4) Compute borders for each territory by taking the midpoints of edges in the territory neighborhood graph. Use a couple special tricks for coastal territories.
5) Split up those borders into finer segments
6) Add noise to the border segments
7) Fill in the pixels according to the borders
Re: Ask HN: How to generate random terrain
#28If you have a heightmap, the roads should be fairly easy. Pick start and end points (cities?) and use a pathfinding method like A* to plot the road. If you want something more stylized, you could select a handful of points from that method and then use beizer curves or something between them.
Re: Ask HN: How to generate random terrain
#29What kind of scale of terrain are you looking for? Continent maps or battlefield scale? I got some stuff I rolled here http://flywheel.be/examples/ All random generated. But probably not what you're looking for.
http://flywheel.be/wouter/maps/
For more discrete-looking maps.
Re: Ask HN: How to generate random terrain
#30I did some work on random terrain once. You can see the results here: http://steveasleep.appspot.com/pyworldgen If this is what you're looking for, I can try to explain it.
Similar in concept, I guess. What technique are you using? I always start from fractal + voronoi but I think that's fundamentally flawed; going from raster to vector is silly when you could have gone straight to vector.