Quote:Original post by BrianLhttp://gamearchitect.net/Articles/GameObjects1.html
hmm, too bad the author only makes some vague statements about flat hierarchies and components (and the interesting links are dead), so i don't really have an idea what his design looks like.
back to bringing up more ideas: policies
instead of extending interfaces by inheritance one could introduce new classes only containing the extended interface.
the implementations as well as the decorators could be pieced together by inherting from several interfaces.
example:
interfaces:
iGameCharacter - provide basic functionality for all gamecharacters
iMonster - only provide extended functionality for monsters
iEndBoss - ...
implementation:
iGameCharacter<-GameCharacter
iMonster,GameCharacter<-Monster
iEndBoss,Monster<-EndBoss
decorators:
iGameCharacter,iMonster<-GC_MonDeco - decorate the gamecharacter and monster inteface
iEndBoss<-EBDeco - decorate the EndBoss interface only
well, seems pretty clean so far. multiple inheritance but no diamond of death. extremely extendable and flexible.
but, of course, those bitchy vtable data induces some bloat, namely 4 bytes per intefaces.
sure, it won't really matter for the most time. but i always ask myself what if.... what if the variety of gamecharacters boosts up and you got plenty, real plenty of instances and your little homebrew game looks and plays like '95 and it's unreasonable to need so much memory...? (yes, thats unlikely to happen with gamecharacters, but you can think of sth. else i guess).
@Clash, btw. i had no intention to sound rude, you made a reasonable point.