Jump to content

  • Log In with Google      Sign In   
  • Create Account


A very simple terrain generator for tiled games.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Myzreal   Members   -  Reputation: 127

Like
3Likes
Like

Posted 20 August 2013 - 05:24 AM

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



Sponsor:

#2 FLeBlanc   Crossbones+   -  Reputation: 3081

Like
1Likes
Like

Posted 20 August 2013 - 09:01 AM

@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.



#3 Myzreal   Members   -  Reputation: 127

Like
0Likes
Like

Posted 20 August 2013 - 01:57 PM

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.



#4 swiftcoder   Senior Moderators   -  Reputation: 9672

Like
0Likes
Like

Posted 20 August 2013 - 03:23 PM

How many layers of perlin noise are you using?

20 minutes for a 1280x1280 image is over a millisecond per pixel - you must be doing a pretty beefy workload to incur anywhere near that.

Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]


#5 Myzreal   Members   -  Reputation: 127

Like
0Likes
Like

Posted 20 August 2013 - 04:45 PM

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.



#6 Pink Horror   Members   -  Reputation: 1091

Like
0Likes
Like

Posted 20 August 2013 - 06:43 PM

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.



#7 Myzreal   Members   -  Reputation: 127

Like
0Likes
Like

Posted 21 August 2013 - 03:28 AM

Yes I also think that the HashMap and Point wrapping might be slowing it. I like working with it though, it adds simplicity, so I'll have to think this one through.

 

This is where I got the java lib for NoiseLib: https://github.com/TJHJava/libnoiseforjava/wiki






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS