Jazz2::Actors::Multiplayer::RemoteActor class

Remote object in online session.

A generic actor whose transform, animation and miscellaneous state are synchronized from a remote authority (the server). It has no gameplay logic of its own; the received position is buffered and interpolated on the receiving side to smooth out network delay.

Base classes

class Jazz2::Actors::ActorBase
Base class of an object.

Constructors, destructors, conversion operators

RemoteActor()
Creates a new instance.
~RemoteActor()

Public functions

void AssignMetadata(std::uint8_t flags, ActorState state, StringView path, AnimState anim, float rotation, float scaleX, float scaleY, ActorRendererType rendererType)
Initializes the actor from metadata received from the server.
void SetPlayerColor(std::uint32_t furColor)
Sets the per-player recolor (0 = none); reloads the sprites indexed and (re)applies the palette.
void ChangeMetadata(StringView path)
Changes the metadata (e.g. on character change), keeping the current recolor applied.
void SyncPositionWithServer(Vector2f pos)
Synchronizes the position with the server.
void SyncAnimationWithServer(AnimState anim, float rotation, float scaleX, float scaleY, Actors::ActorRendererType rendererType)
Synchronizes the animation and transform with the server.
void SyncMiscWithServer(std::uint8_t flags)
Synchronizes miscellaneous state flags with the server.

Protected functions

auto OnActivatedAsync(const ActorActivationDetails& details) -> Task<bool> override
Called when the object is created and activated.
void OnUpdate(float timeMult) override
Called every frame to update the object state.
void OnAttach(ActorBase* parent) override
Called when the object is attached to an another object.
void OnDetach(ActorBase* parent) override
Called when the object is detached from the previously attached object.
void RefreshColorPalette()