Having just finished writing about game entities and components I thought it would make an interesting and light follow up post sharing a few of my favourite and useful components.
Health
The health component is probably the component that I re-use the most. Not just a health value that goes up and down it also keeps track of invulnerability, regeneration and poison. It also looks after the entities damage modifies with the following types currently supported Fire, Ice, Melee, Projectile, Magic and Crushing.
Flags on the component indicate which messages are broadcast either locally to the entity or into the world when certain conditions are met, i.e. Death, Resurrect, Unconscious, Revive, etc.
Virtual Joystick
I like to use a virtual joystick between the thinking and doing components of an entity, mainly so that I can take control of the entity with a physical controller when I need to. This is exceedingly useful when developing the entity functionality and later on helps tremendously in tracking down bugs.
Tracker
Move the attached game entity towards another game entity or a specific point. Specifying various values for acceleration / de-acceleration, min / max speeds and which axis’s to use you can get a large range of different and interesting effects and behaviors out of it.
Great for quick prototyping and doing a basic follow behavior on characters or a homing missile on a shot.
Bob
Everyone should have a bobbing component in their toolbox. It is one of the simplest components around applying a sine wave motion on any axis. Usually used to make health pickups bounce up and down in first person shooters, it can also make a platform bob on a jet of air or a fairy light dance. You could attach it to a shield and have it circle a character or attach it to a camera and get some dynamic swing camera shots.
Threat
The Fear / Threat components I just haven’t had the opportunity to use enough in my professional games but I have used it a number of times in my personal projects.
The component broadcasts on an interval how much threat the entity is projecting into the world and what type of threat it is. For example 100% fire threat at a distance of 3 meters for a bonfire, 20% combative threat from a solider or 3% from a normal human.
Fear
This component works with the Threat component and is usually attached to entities that can be affected by fear. It listens to any broadcast threats and keeps a running tally the A.I. Brain will query it for information in order to help make its decisions.
Fader
When triggered the Fader component controls the visual fading in or out of an entity over a specified amount of time.
So, what are your favourite components? Which do you use the most?