Re: Double Dispatch Problem: Mobile Creatures and Projectiles in a Game World
- From: "Aaron J. M." <ajmacd@xxxxxxxxxxxxxxx>
- Date: 29 Mar 2007 18:18:17 -0700
On Mar 29, 3:48 pm, "H. S. Lahman" <h.lah...@xxxxxxxxxxx> wrote:
The only "interesting" collision collaboration seems to be Projectiles
hitting Creatures since all other combinations seem to the no-ops.
<snip>
What is the problem space commonality of Mobile that justifies generalization?
It only seems to exist to support the reflexive "collides with" relationship,
but that relationship doesn't seem to capture what you are really interested
in the problem solution (Projectiles hitting Creatures).
Most of the reason why I thought Creatures and Projectiles could be
subclasses
of Mobile was because they are both able to move and they both have a
location
in World (bad case of inheritance for code-reuse?). I'm becoming
convinced that
I should just get rid of Mobile though.
I'm still unsure about how I would model the timing of the movements
of
everything without a single Mobile list. As I said previously I
wanted to have
things in the World have different speeds which affect what order they
are told
to move for every game tick, regardless whether they're a Creature or
a
Projectile. Any thoughts on how to model this?
On Mar 29, 4:26 pm, "Daniel T." <danie...@xxxxxxxxxxxxx> wrote:
"Aaron J. M." <ajm...@xxxxxxxxxxxxxxx> wrote:
So, World keeps two lists (Creatures and Projectiles), and all
Mobiles are able to attach themselves to a World.
No. World keeps two lists of Points and something else attaches the
Mobiles to the World.
<snip>
In the idea above, World doesn't have pointers to Mobiles, and doesn't
send any messages to them. Each Mobile would act independently.
Thanks for clarification. I'm not sure about this model though, since
I wanted
World to be a proper container for Creatures and Projectiles.
Regards,
Aaron J. M.
.
- Follow-Ups:
- References:
- Double Dispatch Problem: Mobile Creatures and Projectiles in a Game World
- From: Aaron J. M.
- Re: Double Dispatch Problem: Mobile Creatures and Projectiles in a Game World
- From: Daniel T.
- Re: Double Dispatch Problem: Mobile Creatures and Projectiles in a Game World
- From: Aaron J. M.
- Re: Double Dispatch Problem: Mobile Creatures and Projectiles in a Game World
- From: Daniel T.
- Double Dispatch Problem: Mobile Creatures and Projectiles in a Game World
- Prev by Date: Re: Applications of sequence diagrams
- Next by Date: Re: Difference between Factory and Abstract Factory
- Previous by thread: Re: Double Dispatch Problem: Mobile Creatures and Projectiles in a Game World
- Next by thread: Re: Double Dispatch Problem: Mobile Creatures and Projectiles in a Game World
- Index(es):
Relevant Pages
|