M
Michael DOUBEZ
JoeC a écrit :
Grizlyk answered it in his first post: design patterns is what you want.
Depending on the tradeoff you have, one pattern or another is adapted to
your program.
As exemples, the flyweight pattern may help you manage a lot of units
with small memory usage, the decorator pattern may help you modify your
units transparently at runtime, the strategy pattern can help you define
at runtime various IA for units ...
all those designs will influence the way of partitionning and reusing
your classes.
nothing wrong, no advantage.
obj:bj(int, int, char) allows you to set default values for some
parameters.
I cannot help you with game design but your could have a look at the
decorator pattern and flyweight pattern I mentionned.
Michael
I read through some of those articles you suggested. They were
interesting but I have some questions. How small should an object
be. From some of the examples it is almost to each variable should be
a class. I posted some of my work and I was hoping to get some ideas
on how I could break my classes down a bit. I have some ideas but I
was hoping to get a second opinion.
Grizlyk answered it in his first post: design patterns is what you want.
Depending on the tradeoff you have, one pattern or another is adapted to
your program.
As exemples, the flyweight pattern may help you manage a lot of units
with small memory usage, the decorator pattern may help you modify your
units transparently at runtime, the strategy pattern can help you define
at runtime various IA for units ...
all those designs will influence the way of partitionning and reusing
your classes.
what is wrong with a constructor ? obj:bj(int, int, char); What is
the advantage of creating structures obj:bj(strc&);
nothing wrong, no advantage.
obj:bj(int, int, char) allows you to set default values for some
parameters.
I will try to begin re-writing my classes and breaking them down to
smaller parts. I don't have that much to go on to help me with my
design. I think graphical, movable, attackable, defndable.
Is it ok to have a class:
class unit : public movable, attackable, graphical, ..... To build a
class? If you look at my objects they are pretty big and do quite a
bit. They move, fight, display, become disbersed, have colors and
graphics.
I cannot help you with game design but your could have a look at the
decorator pattern and flyweight pattern I mentionned.
Michael