Skip to content
← All posts

· 3 min read

Enemies that see, hear and search

The first enemy: what he sees, what he hears and where he goes when he loses sight of you.

An enemy that just walks straight at you doesn't scare anyone for long. I wanted one that notices you little by little, that listens, that goes after the last place he saw you. And I wanted you to feel all of that happening.

He's calm at the far end, the eye slowly opens, I run behind the low wall and he comes looking.

What he sees

He sees in a 120-degree cone ahead, up to 14 meters, as long as there's no wall or smoke in the way. Right up close, two and a half meters away, he notices you even with his back turned. Noticing isn't instant: his attention fills up little by little, faster up close and slower from far away. Crouching takes longer and running takes less. While his attention fills he stops and stares at you, and that's your window to get out of his sight.

One rule I made a point of keeping: if you're in his line of sight, he sees you. Standing or crouching. What hides you is having something in front of you, and crouching behind a low wall makes all the difference.

Top view of the range with debug on: the enemy's field of view on the floor and his state written above him
The debug view I use to tune all of this. The fan on the floor is what he sees, the circle is where he notices you even with his back turned and above him you can see how much he has already noticed you.

The eye at the top of the screen

So you know you're being noticed, there's an eye at the top of the screen that opens as his attention fills, and jumps when he finally spots you. Waves appear on the sides when he heard you. Waves without the eye mean the noise gave you away. You can turn it off in the options if you'd rather play in the dark.

The alert waves at the top of the screen, with an enemy at the back of the range
He hasn't seen you yet, but he heard you.

What he hears

Every step is a noise. Crouching you make none, walking he hears you about four and a half meters away and running, eleven. A gunshot carries 32 meters. And a bottle thrown far away makes noise 8 meters from where it lands, which is sometimes worth more than a full magazine.

When he loses you

After two seconds without seeing you, he goes to the last place he saw you, looks around and checks a few more spots nearby, preferably the ones he can't see from where he stands. Then he stays on alert for a while, seeing farther and wider. That's exactly what I wanted when I tested it: for him to get to where he found me and be more on edge.

What's still missing

All the numbers are placeholders. He still has no attack, hit or death animations: the attack is done with arms rotated by code. There's no sound at all yet, and no patrolling the map. All of that is coming.