Welcome in Dyllan’s bandit camp. NPC’s shouldn’t just stand and idle in the game. To make things more realistic, they should do stuff: watch the horizon, pick something up, scratch their heads, wander around. But programming this for every single NPC in the game is a huge task, so it’s better to automate this. That’s exactly what we’ve done: all looks and animations you see here are completely randomized. We throw dice between certain margins, and these decide basically everything, varying from the length of his nose and his walking direction to the activity he undertakes and the cut of his hair.
This is harder than it sounds. We don’t want NPC’s to walk through objects, so before they start walking to their random destination, we first cast a ray in their forward direction with a length of the distance between the NPC and the destination. If it hits something, we decide not to walk and go for a random animation after all.
The foundations of this system, let’s call it NPC AI, have been laid and can now be easily expanded upon.