My ugly design.
Hi Friends.
I''m about to embark a new project.
the project is a game of the style of "volfied".
i started designing and i have a dilemma.
the way i see it i have a class called Game.
in this class i have two vectors :
1. vector of sprites.
2. vector of lines.
the sprites in the vector have a method DoAI().
this method needs to know the other sprites on
the vector ( for collision purpose. ) it also
needs to know the line vector ( so the sprite will
know to where it can move).
class Game{
private:
vector mSprites;
vector mLines;
public:
int Run(){
for(i=0;i<10;i++)
mSprites.DoAI(mSprites,mLines);
}
}
class Sprite{
public:
DoAI(????)
}
this looks ugly to me(The parameters sent to DoAI func).
is it my poor design experience ?
is there a better way ?
How about making mSprites and mLines Global ?
0 error(s), 0 warning(s)
quote:
Original post by kroiz
this looks ugly to me(The parameters sent to DoAI func).
is it my poor design experience ?
is there a better way ?
How about making mSprites and mLines Global ?
I wouldn''t make them global, what about passing a reference on mLines and mSprites to the sprite classes constructor?
January 23, 2001 10:27 PM
A sprite has AI?
If this were my project, I would try separating out the game components from the graphics components.
Obviously you need a link from one to the other to give your game data visual representation. But imagine you were running on a computer without a screen. Could you still perform the RPG/sim/game/data calculations with no graphics? Sure... If done right, you could swap in/out visual 2d overhead tiles with 3d first-person graphics with a text interface (like the old Zork games).
Separate the game from the graphics, then find a simple way to present input to the game, and link game results to graphic display.
If this were my project, I would try separating out the game components from the graphics components.
Obviously you need a link from one to the other to give your game data visual representation. But imagine you were running on a computer without a screen. Could you still perform the RPG/sim/game/data calculations with no graphics? Sure... If done right, you could swap in/out visual 2d overhead tiles with 3d first-person graphics with a text interface (like the old Zork games).
Separate the game from the graphics, then find a simple way to present input to the game, and link game results to graphic display.
quote:
Original post by Anonymous Poster
Separate the game from the graphics, then find a simple way to present input to the game, and link game results to graphic display.
Sound cool but too progressive for me, for now i wanna keep
it simple i think i''ll use the reference like harry said.
thanx to you both.
0 error(s), 0 warning(s)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement