I have written a game library using Component-based architecture, including Ogre 2.1 and Bullet.
In the last few month, I created some tiny game as a prototype, and the library looks good so far.
Now, I started to create a more complex game.
Many features of my game start to work good within my game engine environment - but is a crap elsewhere.
Example
I have a custom data-structure - 3D grid manager, named Grid.
class Grid{
GridMember* gridMembers;
int numX,numY,numZ;
void add (GridMember* gridMember, int x,int y,int z){
gridMembers[ ((z*numY)+y)*numX] = gridMember ;
}
//other functions
};
-
In the game logic, I used inheritance:-
Game entity that stores : derived from Grid
Game entity to be stored : derived from GridMember
-
I found that this Grid class doesn't go well with the component-based architecture :-
The game entity should not have any function!!
So I changed it to match the component-based architecture.
class Grid_System : Game_Engine_System{
void add (ID grid, ID gridMember, int x,int y,int z){.....}
//.............. other functions ............
};
Notice that Grid will now really depend on the game-engine.
----------------------------------------------------------------------------------------------------------------------------
The fear about losing modularity in code start to overcome me.
It accompanies by fear that Component-based architecture will become an obsolete technology soon.
I have not slept well.
I start to have nightmare in some nights.
Am I worry too much?