Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: My World Generator  (Read 3455 times)

kytuzian

  • Bay Watcher
    • View Profile
    • Kytuzian - Youtube
My World Generator
« on: February 25, 2012, 01:49:05 pm »

I couldn't think of a better title, so...

Anyway, this is a random world generator I made by myself. I made it in C++, using CodeBlocks/SDL.

It creates 1000x1000 maps, which will be used for a game I am making(more information here: http://www.indiedb.com/company/sticksstonesdev).

Each pixel on the images represents a 100x75 area which can be used in-game. This means there are a total of 7.5 billion tiles to walk on/build in game.

Neon Green - Hill
Middle(Olive) Green - Flatland
Dark Green - Forest
Red - Lava
Light Brown - Volcano
Dark Brown - Valley
Blue - Water
Grey - Mountain

Here are some pictures of the maps it generates:

1000 simulated years:

Spoiler (click to show/hide)

2000 simulated years:

Spoiler (click to show/hide)

Generally, the 2000 year pictures tend to be better, but if it runs for too long, it usually fills too much of the world with water.

Please tell me all your comments!

malloc

  • Bay Watcher
    • View Profile
Re: My World Generator
« Reply #1 on: February 25, 2012, 02:10:20 pm »

I would like to know how you have implemented world generation.
As it looks very weird.

If you would like, I could give you a simple 2d noise generator class I found on the web long ago. Used correctly it can output some pretty cool terrains.

Like the one the ascii one below:
Spoiler (click to show/hide)
Logged

kytuzian

  • Bay Watcher
    • View Profile
    • Kytuzian - Youtube
Re: My World Generator
« Reply #2 on: February 25, 2012, 02:45:43 pm »

First, it just randomly places terrain in rectangles/squares, then it runs the world simulation of erosion, volcanoes, and growing forests.

That continues for however long I want, then its stops.

Erosion just has a random chance of every block next to water turning to water. Growing forests works in the same way.

Volcanoes make lava which can cool, continue spreading, or do nothing.
« Last Edit: February 25, 2012, 02:53:46 pm by kytuzian »
Logged

shakazed

  • Bay Watcher
    • View Profile
Re: My World Generator
« Reply #3 on: February 26, 2012, 10:35:11 am »

The terrain looks a bit blocky. I'd suggest you'd follow malloc's advice and start out with a random terrain algorithm (noise or fractals) and then add the erosion, growing forest etc. on top of that.
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: My World Generator
« Reply #4 on: February 26, 2012, 06:45:59 pm »

No sure how hard it'll be, but some sort of post-processing that smooths the transitions sounds nice too.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

kytuzian

  • Bay Watcher
    • View Profile
    • Kytuzian - Youtube
Re: My World Generator
« Reply #5 on: February 26, 2012, 08:09:00 pm »

The blockiness of the terrain doesn't actually affect gameplay too much, because the player will only ever see 1 pixel of the map at a time. I just wanted it to be not all rectangles/squares.

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: My World Generator
« Reply #6 on: February 26, 2012, 08:51:10 pm »

Because blocking looking terrain doesn't have it's own charm...

Spoiler (click to show/hide)

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: My World Generator
« Reply #7 on: February 27, 2012, 06:22:38 pm »

The blockiness of the terrain doesn't actually affect gameplay too much, because the player will only ever see 1 pixel of the map at a time. I just wanted it to be not all rectangles/squares.

I'd still say that the blockiness will matter, if you ever give the player a world map...

But its your game. :3

@Max White
That's cheating :P There's more curves than blocks!
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

quinnr

  • Bay Watcher
    • View Profile
Re: My World Generator
« Reply #8 on: February 27, 2012, 07:05:03 pm »

Ooo, I love world generators of any type, so fun to look at and see how they all accomplish the task differently. Thanks for posting this!
Logged
To exist or not exist, that is the query. For whether it is more optimal of the CPU to endure the viruses and spam of outragous fortune, or to something something something.

kytuzian

  • Bay Watcher
    • View Profile
    • Kytuzian - Youtube
Re: My World Generator
« Reply #9 on: February 27, 2012, 08:50:50 pm »

The blockiness of the terrain doesn't actually affect gameplay too much, because the player will only ever see 1 pixel of the map at a time. I just wanted it to be not all rectangles/squares.

I'd still say that the blockiness will matter, if you ever give the player a world map...

But its your game. :3

@Max White
That's cheating :P There's more curves than blocks!

Well, I don't intend for the player to see more than a small portion of the map at a time, and even so, the actually map shouldn't affect game as it as right now. This might change one I get into heavier testing, though I doubt it.

Ooo, I love world generators of any type, so fun to look at and see how they all accomplish the task differently. Thanks for posting this!

Your welcome!

malimbar04

  • Bay Watcher
    • View Profile
Re: My World Generator
« Reply #10 on: February 28, 2012, 04:36:34 pm »

I like the way it uses something really simple (just random blocks), and make better through erosion. What's causing the erosion to create new blocks though? After 2000 years it's all looking decent, but some of the erosion made large blue blocks taht weren't there in the beginning.
Logged
No! No! I will not massacre my children. Instead, I'll make them corpulent on crappy mass-produced quarry bush biscuits and questionably grown mushroom alcohol, and then send them into the military when they turn 12...

kytuzian

  • Bay Watcher
    • View Profile
    • Kytuzian - Youtube
Re: My World Generator
« Reply #11 on: February 28, 2012, 05:49:33 pm »

I like the way it uses something really simple (just random blocks), and make better through erosion. What's causing the erosion to create new blocks though? After 2000 years it's all looking decent, but some of the erosion made large blue blocks taht weren't there in the beginning.

Each picture is actually a completely different world generation, and having nothing to do with each other.

Thanks by the way.