Search Results

Search found 1 results on 1 pages for 'whiterook6'.

Page 1/1 | 1 

  • How far do I take Composition?

    - by whiterook6
    (Although I'm sure this is a common problem I really don't know what to search for. Composition is the only thing I could come up with.) I've read over and over that multiple inheritance and subclassing is really, really bad, especially for game entities. If I have three types of motions, five types of guns, and three types of armoring, I don't want to have to make 45 different classes to get all the possible combinations; I'm going to add a motion behavior, gun behavior, and armor behavior to a single generic object. That makes sense. But how far do I take this? I can have as many different types of behaviors as I can imagine: DamageBehavior, MotionBehavior, TargetableBehavior, etc. If I add a new class of behaviors then I need to update all the other classes that use them. But what happens when I have functionality that doesn't really fit into one class of behaviors? For example, my armor needs to be damageable but also updateable. And should I be able to have use more than one type of behavior on an entity at a time, such as two motion behaviors? Can anyone offer any wisdom or point me in the direction of some useful articles? Thanks!

    Read the article

1