Skip to content

Aggro and target system

charvei edited this page Oct 22, 2017 · 1 revision

Enemy aggro and target system Overview

Enemies in Rocket Potatoes use an aggro and target system to introduce an added level of depth to their behaviour in which classes of entities can be assigned as an enemy's targets. Importantly this system determines where the enemy will move in the world - with no targets an enemy will have no objective and not have a path to follow in the game. Enemies have two types of targets that they can hold onto:

  • Sight Aggro targets
  • Main targets

Sight Aggro Targets

An enemy's Sight aggro targets are entities that exist in the world that the enemy will move toward if within certain distance of that enemy. Usually this is paired with a melee attack event so that the enemy will move towards the target and attack it, forcing the player to consider the placement of sight aggro-able targets.

Main targets

An enemy's main targets are targets that the enemy will move toward regardless of where they are in the world, so long as they actually exist.

Usage guide

Targets are specified in enemies via the initTargets method. Here the classes of targets are added to arrays representing the main targets and sight aggro targets. An important thing to note is that the order in which they appear in these arrays indicate their aggro priority, that is, if one target class appears before another in these arrays then the enemy will, all things being equal, move towards an entity of the first class over the second.

If not overriden in subclasses, the method is inherited from the base enemy to have the main targets of the base portal > player types, with sight aggro targets of player types.

To find the most relevant target that exists in the world for an enemy at any one point in time, the EnemyTargets data class returned by initTargets must be passed to the EnemyEntity's mostRelevantTarget method which will determine the entity in the world that is most relevant given the enemy's targets. With the entity identified the enemy can then, for example, find a path to the entity in order to move towards it.


Gameplay

Design

Asset Creation

User Testing

Code Guidelines


http://cultofthepartyparrot.com/parrots/partyparrot.gifhttp://cultofthepartyparrot.com/parrots/partyparrot.gifhttp://cultofthepartyparrot.com/parrots/partyparrot.gifhttp://cultofthepartyparrot.com/parrots/partyparrot.gifhttp://cultofthepartyparrot.com/parrots/partyparrot.gif

Clone this wiki locally