Sign in to follow this  
JasonBradley

2D Platformer Tile Engine Terrain Generation, best way to go about doing this before I start?

Recommended Posts

Just wondering, what would be the best way to go about generating terrain for a 2d Platformer Tile based game like Terraria? I want to make sure I don't start out with something that I will have to spend a whole bunch of time changing later.

The source to my current project is here : http://dl.dropbox.com/u/40043006/Minecraft%202D%20Stuff/messingWith2DBlocksV2.zip

Share this post


Link to post
Share on other sites
Store one tile property that only tell if most of the tile is air or ground.
Generate a tile property telling what image to use by matching with patterns.
A pattern for an image will be a 3x3 neighbourhood table telling if a neighbour must be air, must be ground or can be anything.
The matching can be made fast using bit masks for only air and only ground.

Start with gradient white noise where air tiles are more likely above and ground tiles are more likely below.
For random tile coordinates, let the tile become the same as a random adjacent tile until the level is not too noisy.
If a tile could not be mapped with a pattern, show an error image.
For random tiles that could not map to an image, switch between air and ground until all tiles can be mapped.
If the error fixing method cause more errors than it solves, add more images with neighbour patterns until it works.

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