Friday, September 20, 2013

Procedural content creation in space

Yesterday I had a new idea, well is not new, but it is something I wanted to add to the space ship game, to be able to explore more than just empty space or asteroid fields, something like derelicts, space stations or asteroid mines and many other locations. So, after thinking for a few minutes I started my research and after 1 hour I was able to make somethink like a maze, which looked like something like this:


But, just adding a maze won't be fun, you need to have rooms, caves and something more interesting, so I scrapped the idea of having just a maze, and started again from scratch, I read some articles about room generations in rogue games, so based on some of those ideas found on the web I started to write my own generator and randomly create rooms and connect them. After a long night of coding I reached my bed but before that I had something like this:

It automatically generates an entrance as seen on top, and some interesting things inside the labyrinth like portals or exits to other levels, it still needs some more work but it has a very viable design for the game, one of the main challenges I had was that rooms can't be too small and the tunnels also can't be just one unit wide, since I don't know how big or small the space ship will be it would be better to give enough room to maneuver and also encounter enemies and other things. Since I have each room as objects I can easily decide what to add to each one without having to worry about tunnels and how everything is glued together. The image above is just a representation of what is filled or not on the map, but internally everything is divided as rooms and tunnels connecting to each other, so there will be always a connection to the start or end and everything will be accessible otherwise there may be rooms which can't be accessed like the exit and that will not be good at all. Also some obstacles are added in some tunnels so the player will have to discover secret tunnels for a little bit of variability in game.

So what's next? adding enemies and other things inside the maze as well as loot and rewards for doing it. There will be more complicated layouts but for a night of coding this was very good, hopefully I will be able to show up the final result in game with graphis in a couple of days.

No comments:

Post a Comment