Post news RSS Olvand's new cave director, pt. II

Last time, I wrote about how I gather info about the players. This week, I tell about what I do with it.

Posted by on

Hi all! Alright, [last time] I talked about how the new AI director in caves tries to estimate the stress levels of the people inside, in many ways similar to how it happens in Valve's Left 4 Dead. However, Olvand's caves are unlike L4D in that they are randomly generated, and populated with randomly generated monsters, so it needs a new way to respond to all this stress knowledge. That's the topic of this week's blogpost.

The secret structure in caves
For the players, caves (hopefully) look like one long coherent string of rooms and corridors that are completely random each time. However, under the hood there's a lot of hidden structure, as in reality a cave is nothing more than a collection of blocks like these:

The cave generator just knows really well how to order these blocks, as I explained here. To transform one such block into a room or corridor people can walk around in, there are what we'll call blockmaps. This is one of the blockmaps for a simple corridor from south to north:

Each brown pixel corresponds to a rock tile in the game. Building up a cave for the player thus is nothing more than picking a blockmap for each block, having a look where the rocks are, and putting these in the level.

Adding the enemies
But as you probably already noticed there are more, differently colored pixels in blockmap. These have a number of purposes, like where chests should be, where lights should be, where olbs should be, etc. Today, we're interested in the red ones, which are the enemy spawn points. So when the cave director wants to spawn some enemies, all it has to do is (1) looking up in what block the player is, (2) looking up what blockmap was used to create that block, (3) looking up where the enemy spawn points are in the blockmap and (4) communicating to all clients that enemies ares spawning right there.

So our director now knows how the players feel, and what would be good places to spawn enemies. And furthermore, as I explained last time, I want to alternate calm and stressful moments, to keep the game interesting. How can we achieve that with the knowledge we have?

As it works right now, the cave director has three main stages: relax, building and climax. When you enter an empty cave, it will be in the building stage. In this stage, small 'teams' of monsters are spawned everywhere. They start out pretty easy, but gradually get more tough as you stay longer in the building mode. This is to make sure that sooner or later, everybody's stress level will increase. Once the mean stress level of the player's go over a certain (to be determined) threshold, the director goes into climax state, pushing the difficulty and monster spawn frequency up another step, until a second, higher threshold is reached. The director then goes into relax mode, where nothing new is spawned, and waits until the estimated stress is back to zero again... and then it starts all over.

As you can imagine, this whole algorithm gives me quite a lot of virtual knobs to turn. Turning knobs is basically what I'm doing right now: I play the game a lot, trying to figure out what parts of the game don't feel right, fixing these, and try again. I hope to tell you about some successful tweaks in two weeks!

If you want more development, see [twitter] or [facebook]. If you want to be a tester, you can subscribe on[].

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.