I'm currently planning on implementing a tabletop game in the spirit of Warhammer 40k.
This is a turn based strategy game with lots of special rules.
Why a entity component system?
- Units have special ability, which could be realized each as a component
- Area effects such as fear, could also be realized as a component indicating that a unit is affected by fear
- Each race or army type have there own special rules
- Special rules generally only effect some part of the system, e.g., movement or shooting
- Ease of integration in Unity (make games not engines )
So what is the problem?
How to realize the special rules?
To perform an action two six side dice are rolled and the sum is compared to a threshold.
Lets assume a special ability or effect that modifies this test as follows: instead of two dice three dice are rolled and the highest result is discarded.
Another effect might case that an additional dice is rolled and added to the result.
So the combination would be: roll four dice remove the highest and add the rest up.
So in a perfect world the rules do not have to know about each other.
But should be able to override each other such that an ability can cancel out an effect.
Would you ...
- implement the abilities as flag components? And put there effect into each system, e.g. shooting or movement system?
- put the logic of the ability into the components?
- have the logic of the ability as another component, where one could have many components of the same type, if the effects can stack?
- any other ideas?
Of course if you are missing an information please feel free to ask. Also I'm looking forward to suggestions of different approaches.