Jump to content
  • Advertisement
Sign in to follow this  
JasonBradley

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

This topic is 2454 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
Advertisement
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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!