How to generate a random 2D map for a castle or building?
I'm creating a game and need to create a random 2d map of a castle or a similar building. It should look like blueprints, i.e. shot from above and only lines are used.
I'm looking for some algorithm that does this. I'm not开发者_Go百科 so interested in the code, but the algorithm itself. Where to start and how to fill the desired area?
There are a lot of different algorithms that have been developed over the last 30 to 40 years, and they all produce quite different results.
Check out this wiki:
http://pcg.wikidot.com
Particularly these pages:
- http://pcg.wikidot.com/pcg-algorithm:city-generation
- http://pcg.wikidot.com/pcg-algorithm:dungeon-generation
- http://pcg.wikidot.com/pcg-algorithm:map-generation
That site seems to have links to algorithms on pretty much any procedural content generation you'd want to do.
A maze best describes a random 2D map of an internal structure. What you need is a maze generation algorithm. After implementing the basics you could add your own implementation of random "room" placement etc.
精彩评论