Re: Modeling events that occur in a game world




Aaron J. M. wrote:
I need a way of representing and tracking different events that occur
in a game
I'm working on. I have a world composed of one or more Maps. Each
Map location
(coordinate) may or may not have a Creature. A Creature is controlled
by an AI,
which may also be the player's UI, though the Creatures themselves are
not
necessarily aware of their AIs. Creatures may move to different
coordinates or
attack other Creatures.

Right now the two events I know I'll want to keep track of is when a
Creature
attacks another Creature and when a Creature dies, and I see myself
coming up
with new events as my game grows more intricate. Different parts of
my game
would be interested in different kinds of events. The graphical
display would
be interested in all events so that it may display an appropriate
animation.
More importantly, the different AIs would need to observe recent
events to
modify their behaviour. If a Creature is attacked, the AI controlling
it has a
vested interest in knowing about it.

I'm having trouble modeling this because the different kinds of events
would
keep potentially arbitrary information, making it hard to generalize.
An attack
event would know the attacking Creature, the target Creature, and the
amount of
damage done. A death event would just know the Creature that died. I
might
also implement Creatures grabbing and throwing other Creatures, so a
throw event
would need to know the throwing Creature, the thrown Creature, and
where the
thrown Creature landed. For this reason I can't really make them
subclasses of
a single Event class, since they hold such different information.

So how would I model these events and let my system handle and respond
to them?

Thanks

(I apologize if this double-posts. It didn't appear to take the first
time, but I can't be sure.)

With all that to track, have you considered using a database? I
realize that performance with a database might not be as predictable
as a RAM-only solution, but depending on the game, it might not matter
much. Maybe bats or lightning can fill in the times when the DB is
slow doing garbage collection etc. I would try to make the DB
processing and game engine be somewhat indepedent processes so that
something can still be visually happening while the DB is "thinking".
SqLite is a light-duty DB open-source C-based engine that may be
embeddable in a game.

Do you really want to build a complex interrelating structure(s) with
objects instead of a DB? You would end up reinventing a lot of DB-like
idioms from scratch if you did it with classes.

Just an idea.

-T-

.



Relevant Pages

  • Re: Modeling events that occur in a game world
    ... may or may not have a Creature. ... with new events as my game grows more intricate. ... have you considered using a database? ... SqLite is a light-duty DB open-source C-based engine that may be ...
    (comp.object)
  • Re: Perception and AI (and log messages)
    ... Where do the messages that describe events in the game come from? ... In the case of damage reports, ... AIs friendly to the player and the rest ... would make its creature run away if it has too little health, ...
    (rec.games.roguelike.development)
  • New project.
    ... ancient computer game called Chaos*. ... players are allowed to cast one spell. ... Each player starts with ten spells in his hand, ... The number of wounds required to kill this creature. ...
    (rec.games.miniatures.warhammer)
  • Re: Modeling events that occur in a game world
    ... may or may not have a Creature. ... attack other Creatures. ... with new events as my game grows more intricate. ... have you considered using a database? ...
    (comp.object)
  • Re: Furry Dragons and Storylines...
    ... > i do a save game, this is what i would do. ... > then items the ground and then creature(s) (only one creature will ... > objects that hold other skills! ... The best OO way to do that is to have one single argumentless constructor ...
    (rec.games.roguelike.development)