As you may remember, I spoke about Olvand's [new monster generator] a few weeks ago. This generator randomizes monster's appearances, varying colors and shapes. The main purpose of this (besides a cool gimmick) is to communicate the sophistication of the AI: I think players will grasp a lot quicker that monster X behaves different from monster Y if monster X also looks different from monster Y. However, I've never told you how exactly the AI of monsters in caves will work. That's what this and the next blogpost will be about.
The inspiration: L4D
I have always been fascinated by the AI director in Valve's Left 4 Dead. For those who don't know: Left 4 Dead is a game about getting from one point to another in a team of 4 players. Between those two points, there are zombies that will try to kill you if you do not kill them. The brilliance of this rather simple game idea is that its levels aren't static. Instead, L4D uses what Valve calls 'the AI director', a piece of software that tracks where the players are and how they are doing, and uses that to place zombies, but also things like weapons and healthpacks in the area.
When I originally read about the AI Director, I was fascinated by the idea, but I didn't really believe it would work well. Something generated by a computer could never be as interesting as something a human designer thought about long and hard, I thought - at least not the first time. After having played L4D, I'd say that it is at least as good as a level created by human, and probably even better.
Why? Because the AI director keeps the game exciting. Let me explain. It will surprise nobody that if you have to cross an area with very few and/or very weak enemies, excitement levels drop quickly. However, what game designers often don't realize is that it works the other way as well: if you have to battle a never-ending stream of tough enemies, at some point you get used to this, and it doesn't scare you anymore:
The AI director takes this into account and makes sure that periods with a lot of action are alternated with calm moments. This way, climaxes always feel like climaxes.
Making sure that climaxes are followed by calm moments which are again followed by climaxes is something you can of course also achieve with some clever level design, but only to a certain extent. When a climax or calm moment is needed exactly differs from player to player and even from playsession to playsession. I believe this is why the dynamic nature of the AI director works so much better than static level: no matter how good or bad your doing, climaxes always feel like real climaxes.
Guessing how the player feels
When I first experienced L4D I immediately knew this is what I wanted for Olvand's caves as well: an AI director, in Olvand case called a 'Cave director', that keeps track of how the players feel and customize the experience on the basis of that. To achieve that, however, the Cave director needs to be able to estimate the player's stress level. How? I'm not fully sure, to be honest, but I'm going to start with the following events as stress indicators:
* Losing a large percentage of your health. I imagine that going from 20 to 10 HP is much more stressful than going from 100HP to 90HP, although it's the same amount of HP. What matters is that the former case brings you a lot closer to death than the latter. In other words, the larger the percentage of health you lose, the more your (estimated) stress level increases.
* Killing an enemy that is really close to you. This one might not be that straightforward, but it summarizes four possible events that are all stressful: (1) a monster came running to you, but you didn't see him until he was really close (for example, because of the darkness), (2) a monster came running to you, but it was so powerful that you couldn't kill it before it was really close, (3) there were so many monsters coming to you that you couldn't kill all of them before at least one of them came really close or (4) you sneaked up to a monster and got really close. In other words, the closer your kill is to you, the more your (estimated) stress level increases.
* Getting hit multiple times in a short amount of time. I imagine losing 5 times 10HP spread over 15 minutes is a lot less stressful than losing them in 10 seconds. While in the first case, they will feel like little mistakes, in the second case you'll probably feel like 'OMG what's happening?!'... and that's a lot more stressful. In the words, if you get hit, the shorter the time between this hit and the previous one, the more you (estimated) stress level increases.
* A sound effect generated by an enemy that is relatively close. This one is inspired by Minecraft: how many times I've jumped up hearing that 'mbbuuuuh' sound effect from zombies... It's a sound effect that tells the player: you are going to be in danger pretty soon, and you didn't even notice it coming, which for some reason is extremely scary (at least, for me). I'm not sure whether monster sound effects are going to make into Olvand rose, but if so, I think this event is very likely to increase the stress level. In other words, the louder a sound effect generated by a monster is played back, the more your (estimated) stress level increases.
Will all of these things work? Probably not; time (and a lot of testing) will tell. And let's assume we know can estimate the player's stress level perfectly... what's next? That will be the topic of next blogpost.