Jump to content

The Pyrogenesis Engine/Actors

From Wikibooks, open books for an open world
Clipboard

To do:
Make the following comprehensible (add introduction, clear up all the lose ends, rewrite it in less terse way, finish it etc.) It's not done, yet a necessary starting point.


"Actors" is a concept that is used when dealing with all the visual aspects of entities, such as which models and textures to use for rendering it etc. (TODO: give more examples).

The logic governing actors is mainly found in the VisualActor component (TODO: wikilinkify "component").

CCmpVisualActor.Init()

This function takes a "paramNode" as argument. I'm not quite sure what that is, but it's probably some kind of XML-derived data structure.

If the paramNode has a "Foundation" or "FoundationActor" child, that will be used as the "actor name". If it doesn't, it will use the "Actor" child of the paramNode as "actor name".

The function then creates a new "unit" from the "actor name", GetActorSeed() and null selections. (TODO: explain)

CUnitManager.CreateUnit()

This function tries instantiating a new CUnit with the actor name, seed and selection given in its arguments and some private object manager. (TODO: explain)

If it succeeds in doing so, the new unit is added to the unit manager and returned to the call site.

CUnit::Create()

This is a factory function.

First it finds the base object with the given actor name in the object manager. If a base object with that name is not found, it returns null.

It then calculates random variations from the seed.

It then finds the object that matches them. If object not found, return null.

It then returns a new CUnit with that object, object manager and selections.

CUnit::CUnit()

This just initializes a bunch of variables.