2 min read
top of page
Untitled Godot Project
Background:
-
Project is currently under development
-
These are my current prototypes
-
First time in Godot
-
Tasked with creating NPCS and Dialogue System
NPC Behaviors
NPC States
-
Follow Path
-
Follow
-
Random Position
-
Idle
Follow Path
-
Gets points from a Curve3D node and moves to those points
-
Has 3 different methods to traverse
-
Once - traverse path then stop​
-
Loop - continuously traverse path
-
Reverse - loops path forward and back
-
-
Can also modify:​
-
Movement - speed of NPC​
-
Distance - The min distance to reach point
-

Follow Path State Variables
Follow

-
Moves toward the selected target
-
Can modify NPC movement speed
Follow State Variables
Random Position
-
Gets a random point within a circle and moves toward that position
-
​Can modify:
-
Movement - speed of NPC​
-
Time out - max time until new position is given​
-
Radius - radius of the sphere​
-

Random Position Variables
Changing States
-
Need script to tell State Machine to go to another state
-
gets rid of states being tied together​
-
-
For now I use an enum to go to a specific state​​​

Example Test Code
NPC Head Rotation
-
Need NPC to rotate head towards the player when they are close to them
-
Used dot product and distance checks to make fov
-
Can modify:
-
​Head Rotation - activate head rotation​
-
​Target - the target to look at
-
​Rotate Speed - speed of head rotation
-
​Vertical Angle - min vertical angle to clamp to
-
View Width - min horizontal angle to clamp to
-
View Dist - max distance from target to start looking at
-
Debug - show debug lines
-

Head Rotation Variables
NPC Head Rotation Example
Blog Post:
Code Snippet of Head Rotation
NPC Dialogue
-
Can interact with NPC and pop-up a Dialogue Box
-
Each Dialogue can have its own audio
Dialogue Example
Unmute to hear audio
bottom of page