-
Notifications
You must be signed in to change notification settings - Fork 4
Aggro and target system
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
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.
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.
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.
- Home
- How To Play
- Keybindings
- Inventory and Resources
- Trees
- Portals and Worlds
- Projectiles
- Enemies
- Waves & Spawning
- Graphical assets progress overview
- Audio Files
- Design Templates
- Blender Intro
- Converting 3D models to Sprites
- Scripting in Blender
- Creating a Model in Sketchup
- Colouring and Animating in Blender
- Animation using Dope Sheet, Keyframes and Scale Transformation in Blender
- Template
- Testing
- Terrain
- Terrain Generation
- Resource Trees
- Main Menu, Chat, options
- Main Menu V2, Options V2, Sound
- Damage Trees
- Projectiles
- Enemy User Testing
- Tree planting, inventory GUI, resources, portals
- Caveman Character
- Debug Mode Menu
- Tree learning, Attack Trees, Main Menu Tutorial Resources Styling
- Revamped Resource Trees
- Squirrel User Testing
- Final evaluation
- Project Structure
- Git Workflow
- GUI
- Worlds
- Entity Directions
- Resources
- Inventory
- AbstractEntities
- BasicProperties
- MortalEntity
- ProgressBarEntity
- Multiplayer
- Trees
- TimeEvent
- Game Time
- Animations
- Enemies
- Waves
- Player
- Projectiles
- Effect
- Particles
- Path Manager
- Sounds
- Debug 'God' Mode
- 2D Collision
- Box3D {depreciated}
- Render3D
- Cheat Codes