Navigate

Monday, November 11, 2019

Candles Update: Sin A.I. Part 1: Sin Sense

It's been 10 months since a Candles Update...but I have still been working. There's actually a fair amount to catch up on. Also, I've been doing updates on Tumblr.

(...not just because I work there...)

https://zachmakesgames.tumblr.com

So my plan for future posts is to be more focused and not just cramming every update into a single post.

The core gameplay of Candles is a ghost/demon/monster hunting the player. I did not seek or follow any stealth-gameplay guides created by others, but I peeked at a few to solve problems I faced. For the most part–I wanted to design the AI to meet my needs, and not fall in line with what someone else thought was necessary.

I cannot overstate how aggravating this process for Sin’s AI has been. I can say that it went through many iterations, weeks of stalling, and in the end–I learned many new things.

Step 1 (I decided) was giving Sin (my bad guy) senses. Enter my script “SinSense”.


image
This script is mostly made of booleans. It doesn’t do very much, but several scripts either make changes or track the changes to this script.

Outside of booleans, I only track whether the player is moving, if they’re sprinting, and are they close to Sin. Thus defining whether Sin can hear the player.


image
This script represents Sin’s FOV. I stole the FOV bit and added a ray cast. Basically it detects whether the player should be within a cone of view from Sin. If the player is within said cone, then it fires a ray cast to see if Sin can actually see the player. It then makes changes to the SinSense bools accordingly.


image
SinHearPlayer is a script that does a little more than SinSense. If the player is heard (while not having been heard recently) it attracts Sin’s attention: that is, it stops Sin from moving. Other scripts actually rotate Sin toward the sound.


image
That covers the “Sensing” part of Sin. Still missing, taste, smell, and and touch, I guess. But Sin’s not really a dinosaur, so I’m not sure those others are as important.

No comments:

Post a Comment