movement within the world is critical to an immersive experience. But what does this take?
Movement different types and reasons for movement
Simple Paths | Waypoints and Paths Waypoints are predetermined locations that an NPC can travel to where there will be no collisions and obstacles to avoid. When traveling from waypoint to waypoint, minimal calculations and decisions need to be made. If the NPC encounters a player, it will break from its path. When certain conditions are met, such as the player leaving or dying, the NPC will return to the path and continue to the waypoints.
Random Motion | direction and steps at random Sometimes, we want a NPC to sort of wander around, not just follow a path from point to point. One way it to use random number generators and send it off in some range of direction and distance. If the NPC is in a collision course, it will calculate a new direction to move in. This can often look chaotic and not very realistic.
Random Paths | paths, but more random A combination of the above that can have nice results. Instead of one preset path, we have many waypoints and many paths. We then use a random number generator to choose one of those paths, and sometime later choose another path, and so on. This creates much less predictable movement that doesn't look chaotic. We also avoid collisions and heavy path calculations.
Motion Due to a Player | reacting to a player Often, a NPC needs to move because of an interaction with a character. Maybe the NPC need to fight them, or follow them, or follow them, or run away. In situations like these, the NPC makes movement decisions based on its environment and the Player. From those decisions, the needed movement is calculated and executed. The player runs into battle, runs aways, follows you, or maybe fights you. And based on the environment, other NPCs, and the Player’s movement, decisions on the NPC's motion continue to be made.