When I first started this project, I thought this was going to be the easiest part of it. Well, I haven’t been proven wrong but it certainly is a long task to complete. Never thought I had to think of all the different possibilities it could go wrong so that I could avoid them. So I’ll describe how I came to manage it so far.
Binary Space Partitioning
If you are part of the GameMaker Community, you might of come across Nocturne’s game development posts about his game Skein and how he generated random maps. Well so did I. I read a bunch of pages about BSP trees and tried to make them myself with a bit of help from examples. What I ended up with was a solution that worked pretty well even though the code is incomplete.
Spelunky is a game well known for it’s use of randomly generated maps. If you want the more technical side of how it works, you can visit this webpage. In summary, Spelunky generates it’s maps in chunks and always makes sure there is a path from the start of the map until the exit. My game requires things such as corridors which is why I’m using BSP trees over this option but this type of generation can still be useful. Maybe I could use it to generate the content of the rooms created by the BSP tree? I’ll experiment with that.
Try it out
Here’s the prototype of my randomly generated room solution in HTML5. I would appreciate any feedback.
Now to try to link randomly generated maps and randomly generated missions for a random story line unique to the player. Does that kind of game interest you?
Leave a comment below about what you think about my approach to generating random maps!