-
-
Notifications
You must be signed in to change notification settings - Fork 36
Behaviors
The following are a bunch of behavior components which can be used to build "intelligent" enemies or NPCs.
Sentry is a component which looks out for certain objects. These objects need to satisfy a number of requirements to be spotted such as tags, name, distance etc given by a QueryOpt. A custom predicate callback can be given as well. Sentry has in addition to the query or predicate options to only return objects within the field of view and/or line of sight visibility.
patrol is a component which is given a number of waypoints and travels between them. It can be used together with the sentry component in order to create a guard.
Patrol duplicates some of the functionality of agent. The agent component can be given a goal, search for a path towards the goal and follow the waypoints towards it. This waypoints traveling can technically be done using patrol.
Maybe agent can consist of a navigator component, which looks for a grid or navigation mesh in the ancestors, and knows how to search a path towards a goal. Patrol can then be used to go towards that goal.
The original idea for agent was to include swarming. Swarming is needed when multiple agents interact with each other. A group of enemies traveling is supposed to stay together, yet keep distance. They preferably point into the same direction as they work together as one entity. While this will still be added at a given time, there may be a use case to split it into a swarm component.