Sign in to follow this  
Myzreal

A very simple terrain generator for tiled games.

Recommended Posts

Hello everybody!

 

Lately I've been working on a little tiled game of my own in which I want to have procedurally generated terrain. I've browsed these (and other) forums for ideas and I see there is not a lot of terrain generators designed for this (if any). I've decided to make my own for my game and in the course of making it, it happened so it became a separate project, which simply outputs the terrain in a specified format and can as a matter of fact be used by anyone. Therefore I've decided to share.

 

Please note that I am not by any chance a master programmer and this project is quite simple.

 

You can find the project on github: https://github.com/Myzreal/MyzoGEN

 

Currently the only way to modify the parameters of terrain generation is to edit the code, therefore I advise to import the project into Eclipse and work from there. For any of you who are unfamiliar or uncomfortable with Java you'd have to wait until I implement a small user interface (probably a simple config file). Sorry for the inconveniences!

 

Here is an overview image of how it looks like: DXVU5Ng.png

Share this post


Link to post
Share on other sites

@JTippetts here at gd.net has done some stuff like this before. If you're interested, you might check out these journal links of his:
 

http://www.gamedev.net/blog/33/entry-2249260-procedural-islands-redux/

http://www.gamedev.net/blog/33/entry-2249282-hooking-into-the-tree-to-build-a-map/

http://www.gamedev.net/blog/33/entry-2249322-procedural-island-demo/

 

 

To me, 20 minutes for a 1280x1280 map seems quite excessive. Even given time spent doing an erosion and water-flow simulation of some sort to determine rivers, I'd think that three or four minutes should be expected, and if it was more than about 5 I'd want to take it apart and see where it is sticking. 20 minutes is just way too long.

Share this post


Link to post
Share on other sites

Thanks for the links. I've seen them before but they didn't suit my needs as they produce islands and I need solid terrain.

 

The generator is designed to just run once and produce a map you can stick to for some time. It is not designed for doing it the fastest way possible nor am I participating in any kind of competition - I focused on making the algorithms work how they should work instead of taking shortcuts. Also most of the generation time is spent producing the perlin noise from a third party noise library which I have no control over, unfortunately. Plus I am new to the topic :)

 

I didn't measure the time too accurately I must say and I have done quite some tweaks since the last test so I guess I'll run a test again soon.

Share this post


Link to post
Share on other sites

I am not sure what you mean by layers but I am generating three separate noises that produce the heightmap, temperature map and humidity map. The rest are either products of refining data (biomes) or other algorithms (rivers). I am using the Java version of this library to produce the noise: http://libnoise.sourceforge.net/

 

I might look into the case in the following days and run a more detailed test by adding time-measuring code into the separate generators to gather exact data.

Share this post


Link to post
Share on other sites

Thanks for the links. I've seen them before but they didn't suit my needs as they produce islands and I need solid terrain.

 

The generator is designed to just run once and produce a map you can stick to for some time. It is not designed for doing it the fastest way possible nor am I participating in any kind of competition - I focused on making the algorithms work how they should work instead of taking shortcuts. Also most of the generation time is spent producing the perlin noise from a third party noise library which I have no control over, unfortunately. Plus I am new to the topic smile.png

 

I didn't measure the time too accurately I must say and I have done quite some tweaks since the last test so I guess I'll run a test again soon.

 

If you want it to be faster (and if you don't that's fine) storing your tiles in a hashmap of Points to Tiles is probably costing you a lot of waiting compared to having a single array of Tiles. Also, making your interface use Points instead of passing two ints around might be costly.

 

I am not sure exactly where online you got the jar for your noise library.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this