Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Height-Map generator that I made  (Read 1722 times)

Kesc

  • Bay Watcher
    • View Profile
Height-Map generator that I made
« on: December 03, 2011, 10:39:06 pm »

It's been a time that I'm looking for an algorithm that generates a random new world map in a not-very-big tile map. None of those that I found satisfied me, so I made a new one.

What it does: It generates - inside a 70x70 map - a island or complex of islands by drawing rectangles with random sizes from a starting point, the root. As the rectangles have their dimensions altered, so is the Root position. Each generation creates a new rectangle, that adds 1 value to the tiles in its area, as the tile's value gets bigger, its representation on the map is changed:
0 -> _(The sea);
Between...
00 and 08 -> 1;
08 and 16 -> 2;
16 and 32 -> 3;
32 and 64 -> ^;
Beyond 64-> *(rare)

I pretend to insert one generation of the cellular automata algorithm to make the map smoother, but I thought it would be a good idea to ask here for more interesting and better ways to improve the map.

Here is the whole project - MS Visual C++ - , including source-code, of course. Feel free to improve it, distribuite it, do wathever you want as long as you share it here. :D
http://www.4shared.com/file/Pl8ES8r8/Tile_map_generator.html

It may not work in some OS.
« Last Edit: December 03, 2011, 10:54:41 pm by Kesc »
Logged

Kesc

  • Bay Watcher
    • View Profile
Re: Height-Map generator that I made
« Reply #1 on: December 03, 2011, 10:41:43 pm »

Oh, there's a bug that happens when both coordinates from the root gets negative... I'm working on that. If the program stop working, just try again.
Logged

G-Flex

  • Bay Watcher
    • View Profile
Re: Height-Map generator that I made
« Reply #2 on: December 03, 2011, 10:42:38 pm »

Could you upload some sample output? I'm curious.
Logged
There are 2 types of people in the world: Those who understand hexadecimal, and those who don't.
Visit the #Bay12Games IRC channel on NewNet
== Human Renovation: My Deus Ex mod/fan patch (v1.30, updated 5/31/2012) ==

Kesc

  • Bay Watcher
    • View Profile
Re: Height-Map generator that I made
« Reply #3 on: December 03, 2011, 10:52:11 pm »

Could you upload some sample output? I'm curious.
Here are two examples: One with 300 generations(fewer rectangles, as it should be) and one with 400.

The 100 generations difference may not look effective, but it did some noticeable changes on the height of the map(instead of its area). Also, it is a random process.

Logged

Kesc

  • Bay Watcher
    • View Profile
Re: Height-Map generator that I made
« Reply #4 on: December 03, 2011, 11:09:29 pm »

I'm confused, is the "Creative Projects" the right place for this topic?
Logged

ductape

  • Bay Watcher
  • MAD BOMBER
    • View Profile
    • Alchemy WebDev
Re: Height-Map generator that I made
« Reply #5 on: December 03, 2011, 11:47:01 pm »

Yes that section would be better than this one.
Logged
I got nothing

G-Flex

  • Bay Watcher
    • View Profile
Re: Height-Map generator that I made
« Reply #6 on: December 04, 2011, 06:13:45 am »

Outputting this using text like this doesn't seem like a great idea to me because the resolution is extremely low. Values range from 0 to 64+, but there are only five possible values for representing height. I would recommend outputting as some sort of greyscale bitmap instead.
Logged
There are 2 types of people in the world: Those who understand hexadecimal, and those who don't.
Visit the #Bay12Games IRC channel on NewNet
== Human Renovation: My Deus Ex mod/fan patch (v1.30, updated 5/31/2012) ==

Kesc

  • Bay Watcher
    • View Profile
Re: Height-Map generator that I made
« Reply #7 on: December 04, 2011, 07:25:20 am »

Outputting this using text like this doesn't seem like a great idea to me because the resolution is extremely low. Values range from 0 to 64+, but there are only five possible values for representing height. I would recommend outputting as some sort of greyscale bitmap instead.

Good point. I'll work on that by changing the map drawer's multiples from 8 to a smaller number.

I made a new topic, but my miserable knowledge in topics handling unabled me to delete this one.  :-\
Logged