kris_hole Posted May 17, 2013 Author Share Posted May 17, 2013 I'm looking for some form of algorithm, of how to randomly generate a map without it looking terrible.For instance, height maps to proceduraly generate a river or two across a map, grass, dirt, sand, trees, rocks, decor etc etc etc.Can any of you guys point me in the right direction on where to begin with this? Link to comment Share on other sites More sharing options...
Zeno Posted May 17, 2013 Share Posted May 17, 2013 Try the list [here](https://www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CC4QFjAA&url=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F11968167%2Frandom-2d-tile-map-generating-algorithm&ei=tMCWUY3vEISlqwGl54GYCw&usg=AFQjCNHjZ0ri-ZnkYcoanwSzrB5J5XSCwQ&bvm=bv.46751780,d.aWM) in the top answer? Link to comment Share on other sites More sharing options...
JeffSventora Posted June 12, 2013 Share Posted June 12, 2013 Generating a heightmap is pretty simple, a bit expensive so if you are going to do it during run time I suggest you do it before gameplay.[http://adminspot.net/topic/487-cxnamath-fast-procedural-heightmap-generator-snippet/](http://adminspot.net/topic/487-cxnamath-fast-procedural-heightmap-generator-snippet/) Link to comment Share on other sites More sharing options...
Zeno Posted June 12, 2013 Share Posted June 12, 2013 I've been playing with this lately and this topic just got bumped, so I thought I'd post some reflections on speed and methods. I'm using VB6\. You'd typically see much faster results in C#. Both examples below use the same algorithm to place edge tiles and doodads, and are different only in how they place the ground layer tiles that those algorithms depend on.Heightmaps are a great idea! I love them. In my experience they not resource intensive, but a short loading screen or prerendering is a good call. They definitely aren't random, but useful for a one-time generation of a pseudo-random world. They could be made random if you also had a way to randomly generate a heightmap, which might not be so difficult. What would be difficult is getting the appropriate clumping of pixel values to make the terrain reasonable - maybe an average of some white and black circles and ellipses using quadrants could do it.My last speed test of generating two-layer maps server-side in a modified ETFF engine (based on Eclipse Mega) from a heightmap was roughly 75 ms for 25 maps. That's an average of 3ms per map - not that far from a map's load time from binary! Although I was using a very basic generator, this was in an uncompiled source on an old computer with media, browser, and so on open, so while fully-featured generation would take a bit longer, there's also room for quicker speed. I also tried a random path algorithm (for i = 1 to limit; x + rand(-1,1) ; place ground; y + rand(-1,1); place ground; next; – out of bound if/thens snipped). This was kinda fun. I made it so that a 50-floor dungeon would change and respawn when someone entered it if no one was in it. Generating those 50 maps server-side took a little over 1000ms on average, so you could compare around 500ms with stochastic generation to 75ms with heightmap generation for 25 maps. A solid chunk of that 75ms isn't the actual heightmap processing but the shared algorithms - so yeah, heightmaps are super fast! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now