Heya,
Would it be possible to move the functionality for Replication out of AActor into a base class? AActor is generally overkill for a lot of classes (specifically ones that might inherit from AInfo).
AActor don’t have any movement code, components have, some functions of Actor are just forwarding of component functions like SetActorComponent() which all it does is set location of root component, if there no components at all it does nothing. Existance of a code does not take performance, it does nothing if it’s not executed, the code in memory does not duplicate for inhering subclasses, all classes using same function use same sequence of opcodes in compiled machine code, it only takes memory for varables which but not huge amount to be noticeable
Have you looked in Actor.h? There’s tons of data being stored in the class related to transforms, visibility, child components, etc, and it has a lot of overhead in code that actually runs no matter what because of that.
That does not mean it use processing power on it, it only means what i already said, use of more memory which you could count in kb at most, the class decelerations is just for memory mapping. Where main code is in Actor.cpp and without a component, which is main heart of actor it quite inactive, actor it self dont even hold transform data, again look up SetActorLocation:
bool AActor::SetActorLocation(const FVector& NewLocation, bool bSweep, FHitResult* OutSweepHitResult)
{
if (RootComponent) //No Root Component? everything else is skipped
{
const FVector Delta = NewLocation - GetActorLocation();
return RootComponent->MoveComponent(Delta, GetActorQuat(), bSweep, OutSweepHitResult);
}
else if (OutSweepHitResult)
{
*OutSweepHitResult = FHitResult();
}
return false;
}
Also AInfo classes you can see those defaults being set:
PrimaryActorTick.bCanEverTick = false;
bReplicates = false;
NetUpdateFrequency = 10.0f;
bHidden = true;
bReplicateMovement = false;
bCanBeDamaged = false;
I means tick is disabled, there no replication turned off, movment replication is also turned off and it hidden, but even without those variables set most things are dead because Movement Replication is contaminated in movement components and without any primitive components actor is not even been tried to be rendered if not bHidden will make sure of that. Without Tick and without components Actor is dead code on every frame (which again is not duplicated for subclasses, all of them use the same code or else you override it) and serves function calls it is given. AInfo was always Actor since UE1 and i didn’t seen being changed.
KB of data for a replicatable non-value data holder is entirely stupid. That’s why I’m requesting this. I don’t want kb of data to pass around a handful of bools over the network. I don’t need extra branching every frame because I have a replicatable object that doesn’t even need position data. I definitely don’t need any extra data being sent over the network while I’m replicating.
Your arguments could just as easily be used to argue for merging AActor, APawn, and ACharacter into one superclass. Just because it works doesn’t mean there isn’t a better more efficient solution.
There’s no good reason a new replicatable UObject class couldn’t be the parent of AActor.
Ah i thouth you mean overall usage, sorry
First of all only when variables changes they are replicated, you don’t think server sends same data over and over again? Also only UPROPERTY() variables with “Replicated” specifier are replicated, which in case AActor, it only around 10 varables
This is how it was for over 15 years and if it was truly wasteful Epic would change that long time ago
It is wasteful because I don’t need them. What I want is the functionality of a UStruct without being tied to a value type because UStructs don’t function as non-value types as far as replication is concerned.