Thursday, 18 December 2014

Walk routine

When implementing walking in Kaduria I've had my share of difficulties. The way I've broken it into parts is that you need to know when the player is in a corridor (or open area), where to turn in corridor when there are only one way to go and when to stop walking.

First two are kind of easy, although I did spend some time to write a routine to check when the player is in a corridor. What you need is first check if there are two walls on east-west or north-south sides. If not, you may still be in a corridor. To find out it you need to check 2x2 areas four times in the 3x3 box around the player and see if one of the areas is all floors. Then you are not in a corridor.

Turning in corridor is easy to determine, but when to stop is harder. I wanted the player to stop when either entering a corridor or leaving it. I still have to figure it out, but I think the key is in the way you take the first step. It should not be a part of the walking routine evaluation process at all, only the tiles after the first step

When to stop depends on many things, including what the player will detect (monsters, traps, dangerous terrain etc.). It's also silly to die in starvation when walking if you don't stop it. These signals increase the complexity of the routine which no doubt will require some work to complete.

I'm sure Kaduria will not have auto-explore feature. It's too much, it takes away the exploration. I think you should be able to navigate with pathfinding only between two places you already know.

No comments:

Post a comment