Jump to content
  • Advertisement
Sign in to follow this  
LAURENT*

Actor object understanding

This topic is 985 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement

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. 

Edited by LAURENT*

Share this post


Link to post
Share on other sites

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.

Edited by Tangletail

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

 

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.  

Edited by Tangletail

Share this post


Link to post
Share on other sites

 

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.

 

I don't know what I need, I only know what I want to do and what I need to do is access variables. I didn't say I needed to manipulate them.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!