Game Development Community

dev|Pro Game Development Curriculum

TGB Procedural Planets - Part 1

by Gregory Stewart · 03/30/2008 (9:59 pm) · 6 comments

The Goal

The goal is to create procedural planets in TGB that can be used in a space game I want to create. My inspiration comes from Starflight for Sega Genesis. This game used fractal-generated planets but used bitmap tiles to keep the graphics more interesting without having to overload the system with detailed fractals.

Although there are many aspects to creating a planet, I will mainly be concentrating on creating the tilemaps. So, the plan is:

* Create a fractal/noise-based image that can be used for the topographical features of the planet
* Convert this image into a tile map by substituting each pixel with a tile
* Create smooth transitions between tile types using tile transition pieces (great article on this is available on GameDev.net here: www.gamedev.net/reference/articles/article934.asp)
* Wrapping planet--If you go long enough in one direction on the planet, you can end back up where you started. Yes, wrapping tilemaps already exist, but I also need objects that appear on the tilemap to wrap as well (useful for enemies, particles, and anything that's not a tile)

Part 1

Why reinvent the wheel? I own a license for TGE as well and remembered that there are some fractal-based terrain features in the terrain editor. And, to top it off, the heightfields created by this code are already tileable! So, with some small modifications, I managed to rip out the noise and heightfield code from TGE and put it into TGB.

After some further modifications to the generation code, I clamped the values into several sections and assigned colors to each elevation range. The result:

www.deadiguana.com/images/tgb-proc-planet-01.png
Nothing too impressive yet, but it's a start. The next step is to make the planet surface a little more interesting and somehow generate non-square heightmaps so it looks more like a flattened planet. I am not planning on using the fractal generated image from space, only as a guide for creating the planetary surface and some sort of overview map, so it doesn't have to look great, it just has to function well.

See you next time for Part 2.

#1
03/31/2008 (9:29 am)
That is very cool. Man I loved Starflight.
#2
03/31/2008 (11:55 am)
My geography is so bad I'd swear that was europe. ;)

There was once a time when I thought procedural stuff was soooo very cool. I guess I still do in a way so I can't wait to see where you go with this.

Melv.
#3
03/31/2008 (1:23 pm)
Cool. Keep up the coding!
#4
04/01/2008 (9:28 am)
I`d kill a puppy for Starflight-like game. Just say a word.
#5
04/01/2008 (5:04 pm)
@All - thanks for the comments.

I'm a huge fan of Starflight. I was briefly involved with the two official "sequels":

Starflight III
www.starflightcentral.com/

Starflight: The Lost Colony
starflightgame.com/

I left both of the above for several reasons, but mainly because I don't play well with others.
#6
04/01/2008 (10:53 pm)
Starflight is awesome...nice to see somebody else appreciates that classic game. =)