-
-
Notifications
You must be signed in to change notification settings - Fork 8
[E] Actor List
The Actor List
is a file header file located in Generated/ActorList.hpp
it is generated by the Build Tool
and is used to instantiate the set of Actors created by the user
The Actor List
is needed to allow for gameplay programmers to have a better user experience when making actors.
The main problem is that we don't want to use a scripting language for many reasons, including but not limited to:
- Bloat
- Performance problems
- Time needs to be dedicated to learning the library's API
- Time needs to be dedicated to export functions and interfaces to the API
With that out of the way, we can now move to why the ActorList
exists. It's reason for existing is to instantiate
all unique Scriptable Objects
created by the gameplay programmers, add them to a set and then add the given instance
to the event pools for every matching Actor
in the scene.
Since we are using C++ the engine cannot automatically instantiate every Scriptable Object
derived class.
Which leads to us needing to find a way to go around this problem, and the most performant way is to make the ActorList
We know that the gameplay programmers won't create their Scriptable Object
from scratch,
but will use the UVKBuildTool CLI
or GUI
. With that knowledge we do the following
- The
BuildTool
is executed, and we generate the regular.hpp
and.cpp
files. - The
ActorList
is read and preprocessed - An include statement is added to the bottom of the include chain
- A new line is placed below it
- The file is read until a new empty line is found
- If one is found, the code for creating an instance of the class is added to the
ACTOR_SET_DEPLOY
macro - The file stream is closed and the
BuildTool
returns
At this point, all that is left is for the user to do is recompile the engine. Because the BuildTool
updated that macro, the code generated in ActorManager.cpp
is updated to add the newly generated Scriptable Object
to the set, which results in the events being called at the appropriate places.
This method has almost no performance costs due to the fact that it's equivalent to instantiating stack variables in the entry point and pushing their pointers to an array.
This project is supported by all the people who joined our discord server and became beta testers. If you want to join the discord you can click here
- Home
- Beginner concepts
- Advanced concepts
- Engine developer and contributor resources