Friday 30 November 2012

Digger

There was an idea at the Temple which I had to try. The dungeon or in this case more like maze is created using robot diggers that move in some direction and check if it can continue. It also creates clones along the way which move in different direction and create branching corridors.


These two examples were created with the same routine. Now it's obvious that in some conditions the level can be quite small and not usable as a labyrinth. However there are three things which affect the generation process:

1. Number of diggers at the start (this is using one, starting from the center of level)
2. Turning speed (how many steps a digger continues in one direction)
3. Clone rate (here it's after 10-20 steps)

However adding more diggers when starting means that the generation paths are separate, since diggers wont touch any of corridors. Joining areas can be tricky, but it's doable.

Nice thing about this type of generation is that you can use it in a level that already has other features, like rooms and regular corridors.

Thursday 29 November 2012

Transition

The way stairs are created in Teemu is simple. I found out it was too simple, actually. It works by creating automatic pair for an entrance. So called border exit is a special case which is made in outdoor levels you enter from the island, such as the forest or hut area. Border exit is simply "stairs" activated when the player steps on the border of the level.

What I needed in one of the dungeon levels was a border exit to another level at the same depth. However a border exit can't be an entrance to another level. It can only be a way to return to the previous entrance and to change that would have required a large scale refactoring in the way nodes (connection data between level themes) work in level theme data.

I tried to use a border exit, but it of course returned to previous dungeon level from where you came from due to automatic node setup. I knew then I had to hack it. Just hack it any way I can. After some time I managed to come up with a quite neat solution. First of all, I created a new type of entrance called Transition. Then I added a code checking if there was a transition in that level when trying to exit the level from edges (border exit).

The destination level could have a normal border exit of course, but there was one problem: IF the level has a border exit, it's the place where you enter, no matter from where you enter in the level. The issue was another stairs in that level, leading out from it. This is where some clever hacking was involved by checking the particular source and destination levels in node setup, then changing the destination stair type to upward stairs, preventing a regular enter to border exit location.

This is yet another example why hacking can be a viable solution, because the engine can be too restricted to do something more specific like this. Now the feature (transition) is there and it's working. It took way less time to code than actual engine support for that feature and there was a minimum amount of source code hacking, actually only 3 lines of code in the border exit routine and one line in node setup.

Monday 19 November 2012

Aarr

Progressing slow as usual. I've programmed Teemu only couple of days during this month and that's it. Mainly some engine tweaks, actually nothing on content. It sucks. Not knowing how to proceed with the role-playing system is one of the main issues. Then there is additional dungeon generation and data-driven object creation on top of that. It's way more complex than what was in previous version.

I don't know if my real life job continues next year. Wish I was unemployed just to concentrate on programming games, but it's hardly a good plan.