Little Fortune Planet Breakdown - Part 4: How to dunk minions in lava
Continued from part 3.
Part 4: How to dunk minions in lava
Since we decided to run the simulation outside our Entity Component System (ECS) in part 3, if we simulate our inhabitants in the ECS they’d fall straight through our planet. So what now?
All we need is to give each entity a sensor that tells our inhabitant what is under its feet. By wrapping the logic of converting entity-space into simulation-space in a system we keep complexity local and it doesn’t leak into your other systems, We also get a sensor we can slap on buildings later. Great!
Next we start with the fun part ECS: adding components and system for each behaviour we want on our entities. Some examples: Don't worry too much about getting this right, just start adding!** - PlanetBound: Entity can ‘feel’ what is under its feet. - Gravity: Entity is pulled towards the center of the world, providing the sensor tells us the entity is currently in the air. - Mass: push the entity up when it is inside water. - Dolphinized: Entity shows dolphin behaviors. Does not like to be on land, that sort of thing. - OrientToGravity: Entity turns feet towards gravity. Nice for humans, dolphins don’t care for it. - Flammable: Kill the entity when it dives in to lava. (Ouch!) - Ghostable: Turn the entity to a ghost upon death. - Wander: Entity wanders left or right randomly.

ECS allows you to naturally grow your game. Reusable components mean saving time, which is great for time constrained competitions!
Continued in Part 5: Performance Persmormanche! or play it here!