Skip to main content


Showing posts from April, 2014

Entity / Component Systems

I've been writing a new game recently -- and this time, I decided to use an entity/component system . Boy, does that approach make things easier! In other games I've written, I've struggled to fit new gameplay features into the existing code base. With a entity-component based systems, it's easy to add new features: Need a way to track targetable objects in your game? Add a Targetable component that advertises the unit's position, name for display in the HUD, etc. Need to add some new AI behavior to a unit? Add a component! Update all the AI components once per frame and you're on your way. Does your game need networking? What should you do...? Add a component containing all the info for network serialization! Need to control a unit from user input? Add a joystick component that updates the unit's position component in response to user input. Basically, any new feature can be folded into a component. The best thing about components is that they are dy