Multiplayer

Authority

The skill state only changes on the authority (the server, or the game in standalone). Components without an owning actor count as authority.

Runs on Functions
Authority UnlockSkill, RefundSkill, ResetTree, ResetAllSkills, SetSkillRank, AddSkillTree, RemoveSkillTree, AddSkillPoints, SpendSkillPoints, RefundSkillPoints, ClearSkillState, ImportSaveData, AddExperience, SetLevel, AddProgression, RemoveProgression, level rewards, grants
Everywhere Queries (GetSkillRank, CanUnlockSkill, …), Try... requests

Requests

TryUnlockSkill, TryRefundSkill, TryResetTree and TryResetAllSkills work on both sides. On a client they:

  1. check whether the settings allow the request and whether the local connection owns the actor of the component (HasLocalNetOwner),
  2. check the request locally for quick feedback (unlock and refund),
  3. send it with a request id of the request subsystem of Pulse Foundation: one reliable server RPC with an FPulseSkillRequest (action and tag only).

The server lets the request in with the guard of the request subsystem (rate per player, kinds Pulse.Request.Skill.Unlock, .Refund, .Reset), checks everything again and answers with the FPulseResult. A failure there reaches the client as OnRequestFailed; Request Skill Change gets the result either way. A request without an answer fails with Timeout, one still waiting when the world ends with Cancelled. There is no client prediction: the UI updates when the new state is replicated, which is one round trip after the click.

The component must be owned by the player’s connection for the RPCs (a player state, pawn or controller of the player). For shared actors, call the authority functions from your own server RPC.

Replication

  • Skill ranks, point pools and progression states (experience and level) are Fast Arrays, the skill trees and progressions replicated arrays of asset references. They use standard property replication and work with and without Iris.
  • ReplicationMode (EPulseReplicationMode of Pulse Foundation) sets the condition for all of them: Default and OwnerOnly send the state to the owning client, Everyone to everybody, e.g. to inspect the skills of other players.
  • Messages a client sends while the state of its first replication arrives (joining, the actor becoming relevant) and while save data is applied are catching up (FPulseContext::CatchUp), so toasts and counters leave them out.
  • The properties use the push model: the component marks them dirty where it writes them (the Fast Arrays mark themselves). Change SkillTrees and Progressions at runtime only with AddSkillTree / RemoveSkillTree and AddProgression / RemoveProgression; a direct write to the arrays after replication started does not replicate. Setting them before the component replicates (defaults, or right after creating it) is fine.
  • A load keeps the replicated items of skills, pools and progressions that stay the same (their replication ids and keys), so clients see no remove and add for them. The items are sorted into the order of the data only when the order differs, so loading the same data again moves nothing. With classic replication only changed items are sent; Iris compares items per index, so it also sends items that moved to another index.
  • Experience is only given on the authority; there is no client request for it. Clients get OnExperienceChanged / OnLevelChanged from the Fast Array callbacks (one level event per replication update, even if several levels were reached).
  • Grants are only applied on the authority. What they give reaches clients through the ability system component: abilities (to the owner), gameplay effects and replicated loose tags (by the replication mode of the ability system).
  • Clients get OnSkillRankChanged and OnSkillPointsChanged from the Fast Array callbacks, and one OnSkillStateChanged per replication update.
  • A load (ImportSaveData / LoadFromBytes) writes the state in place: skills, pools and progressions that did not change keep their Fast Array items, so connected clients get only what changed (no “removed and added again” callbacks for the unchanged ones).

Conditions on clients

CanUnlockSkill on a client only sees replicated data: the ranks and points of the component, and whatever the ability system replicates (attributes, tags). Conditions that read server-only data return Unknown on clients (Pulse::Conditions::GetMissingDataResult), which does not block the request, and the server decides; or replicate the data they need. Costs and rewards are only paid and given on the server.


This site uses Just the Docs, a documentation theme for Jekyll.