Game Development Reference
In-Depth Information
Chapter 6
by David β€œRez” Graham
Game Actors and Component
Architecture
Games are full of objects that bring your world to life. A World War II game might
be full of tanks and planes, while a futuristic science fiction game might have robots
and starships. Like actors on a stage, these objects are at the heart of the gameplay. It
seems fitting that we call them
β€œ
”
'
s exactly what they are.
A game actor is an object that represents a single entity in your game world. It could
be an ammo pickup, a tank, a couch, an NPC, or anything you can think of. In some
cases, the world itself might even be an actor. It
game actors
because that
s important to define the parameters
of game actors and to ensure that they are as flexible and reusable as possible.
There are as many ways for defining a game actor as there are games. Like everything
else in computer programming, there is rarely a perfect solution.
'
A First Attempt at Building Game Actors
A common approach to building game actors is to start with an Actor base class
that defines things that every actor needs to know, which could just be an ID and a
position.
class Actor
{
ActorId m_id;
protected:
Vec3 m_position;
155
 
 
 
 
Search WWH ::




Custom Search