Dear Friends at Epic,
Hi there! I’m loving UE4! Yay!
The TActorIterator could really use some loving attention, it is not quite as easy to use as the Object Iterator, and also I was informed that the Object Iterator is getting an acceleration of its functioning in next beta,
but it is as yet unclear what will be the fate of the actor iterator.
The reason I am such a fan of the actor iterator is that, unless I am mistaken, just because it is an actor iterator it should already run faster for most of my inquiries since I am mostly only searching for a specific class of Actor, not usually as broad a scope as any object in the world.
So if Object Iterator and Actor
iterator were running equally fast and
were equally easy to use, the Actor
Iterator would always be my favored
iterator for most of my game engine needs.
Object Iterator Syntax Advantages
Currently the object iterator has some advantages just in the code, let alone the expected upcoming acceleration.
This code compiles for an object iterator:
for ( TObjectIterator It; It; ++It )
{
if (It->PlayerVibe == PlayerVibe)
{
It->VictoryPC = this;
}
}
This does not compile for an Actor iterator
for ( TActorIterator It; It; ++It )
{
if (It->PlayerVibe == PlayerVibe)
{
It->VictoryPC = this;
}
}
Compile error:
E:\RocketVictory\VictoryGame\Source\VictoryGame\Private\Player\VictoryGamePlayerController.cpp(789): error C2512: 'TActorIterator' : no appropriate default constructor available
1> with
1> [
1> ActorType=AVictoryPower
1> ]
Requiring me to do a more complex initialization, at least in current beta (the while loop is just my choice, its the initialization that my point:
TActorIterator< AVictoryWarrior > ActorItr =
TActorIterator< AVictoryWarrior >(GetWorld());
while (ActorItr)
{
if (Cast(*ActorItr)->PlayerVibe == PlayerVibeFuncIn)
{
return Cast(*ActorItr);
}
++ActorItr;
}
More complicated retrieval of Current Iterated Actor
Also note that in the Object Iterator, I do not need to cast the retrieved iterated object!
if (It->PlayerVibe == PlayerVibe)
{
It->VictoryPC = this;
}
Whereas this will not compile for the Actor iterator as the return of the actor iterator * operator is not typed apparently
The casting is required for compiling, in current beta
if (Cast(*ActorItr)->PlayerVibe == PlayerVibeFuncIn)
{
return Cast(*ActorItr);
}
My Request
I would really like the ActorIterator to become as powerful, fast, and easy to use in code as the object iterator,
as just by its nature, the Actor Iterator is more appropriate and logically more efficient for my game engine.
But currently the Actor Iterator’s implementation is not up to par with the Object Iterator and it is unknown to me whether the Actor Iterator is getting the accelerated functioning in the next beta like the Object Iterator is.
Thanks for considering my request!
Rama