Skip to content

Making the Glimmerstalkers Actually Stalk

Today was the day that I would actually tackle trying to make the Glimmerstalkers actually stalk the characters. I'm not sure why I've been hesitant to but here we are!

Our original idea was that when a Glimmerstalker entered the Stalking state, it would move towards towards its target and when it got within a certain distance, it would "hover" around the target. The intent was that it would take some time before the Glimmerstalker would attack to give the Player time to react and the hover would serve to provide variation on where the character would be attacked from.

I was able to get that implemented but I found that it wasn't going to quite work how we imagined. Once the Glimmerstalkers got within hover range of the character they would constantly pick a new position. I realized that I would need to add some type of timer to delay finding a new position.

Gif of Glimmerstalker hovering around the character in a jittery manner

I started really thinking about how to fix that and what we were trying to accomplish. Ultimately, we want some minimum amount of time from when a Glimmerstalker starts stalking a character to communicate to the Player what is happening. I decided to forego the actual movement towards the character and instead to just rely on a timer to provide the delay. We had planned on using a timer to define the minimum time anyway, so why not just use that as the primary mechanism for this whole behavior?

I reworked state to use a timer to determine when the Glimmerstalker should find a new position instead of moving towards the character. This would be a separate timer from the "minimum" timer discussed earlier. This would allow us to configure how often it would change position to vary things up.

Gif of Glimmerstalker hovering around the character in a smoother manner

This seemed to work much better and was a lot easier to tune. We could now set how far away the Glimmerstalker stays from the character and when it changes position. The only problem I was running into was that the Glimmerstalker doesn't keep up with the character when they move. This poses a problem because if the Glimmerstalker is in front of the character then when the Glimmerstalker goes to attack it might be too close to the character for them to react.

To fix this, I changed the Glimmerstalker's position from an absolute position to a relative offset. Then, every frame, we update the Glimmerstalker's position to match the character's position and apply that offset. Now it follows the character as expected.

Gif of Glimmerstalker hovering around the character while moving

That was all for today. Tomorrow will hopefully be implementing the Attack state.