Game design: components and/or interfaces

When implementing a new gameplay element, what is the most sensible method of keeping things flexible? Should I be looking at using components, interfaces or a combination of both?

At the moment, I’m using components only on the visual side of things, and interfaces for actual gameplay mechanics (such as health, inventory, shields etc). As an example, if I wanted to implement a shield mechanic, where damage taken by the actor is intercepted by the shield, which could then handle the damage dynamically, which approach should I take? My current approach is:

When an actor hits another an actor (I realise most of this is unnecessary, because actors have a TakeDamage / ApplyDamage system. this is just as an example)

  1. check if the actor implements the IDamagable interface (to see if the actor has the health mechanic implemented).
  2. Apply damage
  3. In the hit actor’s take damage function: check if the shield object exists (shield object is an actor that implements the ISheild interface). If it is, pass the damage straight to the shield object, which will handle it, and send the damage back to the actor if the shield is empty / not activated.

Alternatively, I could use components, and have a HealthComponent and ShieldComponent attached to the actor, and I could simply check if the actor has either of these components, rather than checking if they implement an inferface.

I personally like to use components for everything, i think it’s what you’re comfortable with and what works. I find components have extended functionality for what i want to do. Like you said, in your case there’s a HealthComponent & A ShieldComponent that you can manipulate to your desire. There’s usually more than one way to do everything. It’s just about it being efficient and easy.

Don’t think one is more efficient than the other, use whatever works.