Jump to content
Site Stability Read more... ×
  • Advertisement
Sign in to follow this  

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

This topic is 2941 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!