Sponsored By

Opinion: A Handful of Components

In this reprinted <a href="http://altdevblogaday.com/">#altdevblogaday</a>-opinion piece, KmmGames senior programmer Michael Carr-Robb-John shares some his favorite useful components, like health, virtual joystick, and tracker.

Michael Carr-Robb-John, Blogger

October 11, 2011

3 Min Read

[In this reprinted #altdevblogaday-opinion piece, KmmGames senior programmer Michael Carr-Robb-John shares some his favorite useful components, like health, virtual joystick, and tracker.] 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 favorite 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. It's 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. It's 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 percent fire threat at a distance of three meters for a bonfire, 20 percent combative threat from a soldier, or 3 percent 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 favorite components? Which do you use the most? [This piece was reprinted from #AltDevBlogADay, a shared blog initiative started by @mike_acton devoted to giving game developers of all disciplines a place to motivate each other to write regularly about their personal game development passions.]

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like