Download

Some Questions from a Beginner

Hey all,

I apologize in advance if this is a duplicate of anything, but I haven’t been able to find adequate answers to my questions … my Google Fu is poor :frowning:

**TL;DR **Looking to have some details about Unreal, specifically custom Actors, cleared up! see: Questions

I’ve spent years working professionally in Unity, and thought it was time to expand my knowledge base.

I’ve spent a few hours looking through the Unreal Programming Documentation and feel like I have an okay grasp on things, and could probably
start working at this point, however I have a few things I’d like clarified.

Questions:
What is the benefit of creating a custom Actor?

  • It seems like you can use the base Actor class for most things since you can dynamically add components to them.

  • It seems like you wouldn’t put any logic in an Actor class since that seems to be the responsibility of ActorComponents

  • Two possibilities that I’ve come upon for custom actors are this:

  • Creating a “prefab”: Having a custom actor would allow you to specify a custom set up for a gameplay object that can be spawned at any time making the actor basically just a glorified container

  • Any managers could be custom Actors since they don’t have need for transforms, physics, meshes or any other components. You could create the manager as a custom actor spawn it into the scene and have any logic associated with that manager contained in that custom Actor

If I am missing any cases for custom Actors or have thought about them incorrectly, I’d appreciate it if you could clear that up for me!

Thanks in advance!!

Unreal has a “GameFramework” module (which AActor class is part of) that implements out-of-the-box built-in gameplay and multiplayer routines;

For the simple fact of just using Unreal Engine you have a multiplayer game 50% already written for you.

That framework module contains thousands of functions… Sometimes your project requires changing built-in functions’ default behavior.

For that, you create a child class and override base virtual functions. You’ll do that more often than you think.

Thanks Bruno I appreciate your reply!

However, this doesn’t really answer my question. Unreal uses the component pattern and most game logic seems to go into these ActorComponents. Now it is technically possible to add logic into a custom actor class.

For example in making the game snake, I could have a custom actor class that receives directional input from the player controller component and sends out an event to the head component causing a chain of position updates. However, this seems to go against the intention of the engine designers.

The same thing could also be achieved by having the head component listen directly to the player controller component and passing out the information.

Assuming this second approach is the intended way of using the architecture, my question is this: What kind of functionality would one put in a custom Actor class, besides overridding existing functionality.

This line of thinking is how I came up with these two possible uses for a custom actor class:

  • Creating a “prefab”: Having a custom actor would allow you to specify a custom set up for a gameplay object that can be spawned at any time making the actor basically just a glorified container
  • Any managers could be custom Actors since they don’t have need for transforms, physics, meshes or any other components. You could create the manager as a custom actor spawn it into the scene and have any logic associated with that manager contained in that custom Actor.

I understand that this is all situational but I am trying to understand what the intended design is so that I can appropriately break it when necessary.

Thanks!

  • Rob

Tightly coupled components can easily break SRP rule.