Actor object understanding

Started by
22 comments, last by LAURENT* 8 years ago

I heard about this amazing data structure that would solve all my problems, give me super powers, and everything else I could ever want. Does anyone know of the "Actor Objects". I've read that it uses something called an abstract base class. What I need to do is be able to access whatever data I need from any game object regardless of it's type.

Advertisement

An actor is the base class for all objects in your game world.

It contains a world and local transform (position, rotation, and scale), and a parent and children actors for the scene hierarchy.

The end.

L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Do you have a small game you made using this technique?

Edit: I've wrap my head around the idea of an base classes and virtual base classes but the child and parent hierarcchy actor stuff is still a bit confusing.

Do you have a small game you made using this technique?

It is how things work in my engine.
I made this game with it:
http://www.dailymotion.com/video/xey7pq_giganderx-iphone-app-demo_videogames

There is nothing visually indicative of the fact that objects in the world are “actors”.

Adding a scene graph (child-parent hierarchy) is optional.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Adding onto what L. Spiro said... the Actor model will usually be augmented with another model to increase it's functionality.

On it's own the Actor model will have an interface to allow polymorphism to engage correctly.

You'll have a tick() or Update() method that the game will call that will run that particular actor's update functionality.

Of course you could also have other things like FixedUpdate() if you wanted a locked timestep
OnFrame() if there is special code that needs to run before a frame is rendered.
And a messaging system to communicate between actors.

The Actor model is also normally augmented with something else to increase it's flexibility.

So, an actor model could be combined with a prototyping language like Lua or Java for a scripting feature.
Or it might be combined with components.

Don't confuse an actor with the typical ECS seen on the internet. The components will usually have code attached to them with data. And the Actor will normally be updated as a whole instead of just having it's components updated.

This is a bit of a nice feature because it also means that some components that do nothing really don't have to be updated till an event happens. IE think of a sword. A sword lying on the ground is mundane. The only thing it is it's physics, which the physics system will handle that for you. So instead it just listens for a pick up event. And when it's picked up, it finally runs some code and disappears from the world.

Best way to think of it, is as a set of contained functionality that can be infinitely different from other actors. Either by data, context, functionality, and inheritance structure.

Adding onto what L. Spiro said... the Actor model will usually be augmented with another model to increase it's functionality.


I think there's some confusion going on in this thread.

Actor Model.

Do not use that term for some other arbitrary made-up purpose. In particular, the use of the term "actor model" for the given game object architecture is just wrong.

Different games call different types of things an Actor. Some games work like Tangletail describes, though that is not known universally as "actor" object architecture. In Unreal, for example, Actors are just Objects that can be placed in the world (e.g. have a position), and Pawns are Actors that can act in the world (e.g. be controlled).

"Actor" is just a generic term in this context. The OP is asking about a game object architecture that involves class hierarchies and an abstract parent class at the root of the hierarchy. There is no single-word term to describe such an architecture. I think the OP would be better served by a real example of how to code and structure such an architecture than by throwing around meaningless definitions of a made-up term. :)

Sean Middleditch – Game Systems Engineer – Join my team!

I don't always inheritance architecture...

...but when I do Actor is an abstract class derived from Entity that serves as the base for the player and NPC types.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

Adding onto what L. Spiro said... the Actor model will usually be augmented with another model to increase it's functionality.


I think there's some confusion going on in this thread.

Actor Model.

Do not use that term for some other arbitrary made-up purpose. In particular, the use of the term "actor model" for the given game object architecture is just wrong.

Different games call different types of things an Actor. Some games work like Tangletail describes, though that is not known universally as "actor" object architecture. In Unreal, for example, Actors are just Objects that can be placed in the world (e.g. have a position), and Pawns are Actors that can act in the world (e.g. be controlled).

"Actor" is just a generic term in this context. The OP is asking about a game object architecture that involves class hierarchies and an abstract parent class at the root of the hierarchy. There is no single-word term to describe such an architecture. I think the OP would be better served by a real example of how to code and structure such an architecture than by throwing around meaningless definitions of a made-up term. :)

Because it doesn't have an official name :P. Really it's just a utility object. I started calling it an Actor, because Unreals definition of it just sits well. Unlike Unity's Entity system... which gradually makes less sense with time.

However, by definition. The Actor that is described by Unreal and sort of what I described, is actually very similar to the concept of the actor's defintion on the wiki. The wiki even states functions of non mathematical nature. You can actually make the game actors concurrent, because the logic is contained and local only to the object it's self. I have done it, though it's tricky for a game... because things need to happen in an order where it doesn't break. The objects will never directly influence one another. It will do so only through messaging systems. However, the actor does not have to be concurrent.

Keep in mind that all the functions of an Actor are Behaviors, which processes data and messages.

the Actor model

Sean is right there :p
"The Actor Model" is a well defined system for writing concurrent programs by replacing object function calls with deferred message passing and arbitration.
Game frameworks that have an Actor class in their OOP hierarchy don't get to steal that exact phrase.
You can call it an actor class, or actor system, or actor susan, but not actor model :wink:

I've read that it uses something called an abstract base class.

ABC's are basic OOP. Any book/tutorial on OOP should cover these. Depending on the literature, they may be called "interfaces" or ADT's instead of ABC's though.

What I need to do is be able to access whatever data I need from any game object regardless of it's type.

No, that's a terrible plan if I understand what you mean.
If I am misunderstanding, you may just be looking for polymorphism or duck typing.

This topic is closed to new replies.

Advertisement