Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 22 Jan 2011
Offline Last Active Apr 25 2016 11:31 AM

#5286991 Space Shooter Enemies

Posted by on 15 April 2016 - 01:24 AM


For complex enemy paths, using Bezier curves and/or splines might be a good starting point.  I made a basic shmup in unity and used bezier curve components from http://catlikecoding.com/unity/tutorials/curves-and-splines/


What I did: Add child objects with the spline component to the enemy spawners. Enemies which need to travel in a path have a "MoveAlongPath" component with a reference to the spline component from the spawner's child object. This reference assignment is done as soon the spawner instantiates the enemy. After that just keep incrementing the spline parameter using a hardcoded or configurable fraction (I went with 1.0/duration, explained on the link above) and get the position vector on the spline using that parameter




#5236869 Dealing with different collision responses in an entity-component system

Posted by on 26 June 2015 - 12:09 AM


I use a method which is similar to tiago's but is extremely simplified. I use Bullet physics as my collision detection system, artemis-cpp for the ECS architecture.


  1. Bullet has a function performDiscreteCollisionDetection() (or stepSimulation() if you want dynamics as well). After calling this, all overlapping pairs (ie colliding objects) will be available in an array that bullet maintains internally.
  2. Loop over this array (note: it's an array of btCollisionObjects so use the userPointer field to get the entity) and add a collided component to the entities in each pair
  3. The collided component in one entity stores the id of the other entity.

Here is the system logic

  • All entities having the collided component as well as a health component will have their health reduced by the amount in the other entity's damage component
  • All entities having the collided component as well as a Damage component will just destroy themselves

For your case, you can store additional info in the collided component, and use that to update the transforms of your entities so they no longer collide.

Ofcourse this might be a poor method to do this, but hopefully you can see how a collision detection system can cooperate with entities and systems.

#5221805 Basic enemy design

Posted by on 07 April 2015 - 04:41 AM

How about this ?