Skip to main content

Remote Calls

Replication handles syncing data automatically, but sometimes you need to explicitly tell the server or a client to do something. That's what Remote Procedure Calls (RPCs) are for -- they let you call a function on one machine and have it execute on another.

Three Types of RPCsโ€‹

HELIX supports three RPC types, each for a different direction:

Server Functionsโ€‹

Called from a client, executed on the server. Use these when a player wants to do something that requires server authority -- like dealing damage, purchasing an item, or requesting a spawn.

Blueprintโ€” Server RPC: validate and apply damageScroll to zoom ยท Drag to pan ยท Drag nodes to move
Custom Event: Server RequestAttackTargetIs ValidObjectIs ValidBranchConditionTrueFalseApply DamageDamaged ActorBase Damage25.0InstigatorDamage Causer

Client Functionsโ€‹

Called from the server, executed on a specific client. Perfect for sending personalized information -- like showing a notification, playing a sound only that player should hear, or updating their UI.

Blueprintโ€” Client RPC: show a notification on the owning clientScroll to zoom ยท Drag to pan ยท Drag nodes to move
Custom Event: Client ShowNotificationMessagePrint StringIn String

Multicast Functionsโ€‹

Called from the server, executed on all clients (and optionally the server too). Great for global events like explosions, weather changes, or announcements.

Blueprintโ€” Multicast RPC: spawn explosion effect on all clientsScroll to zoom ยท Drag to pan ยท Drag nodes to move
Custom Event: Multicast PlayExplosionLocationSpawn Emitter at LocationEmitter TemplateExplosionFXLocationEmitter

Reliable vs. Unreliableโ€‹

RPCs can be Reliable (guaranteed delivery, ordered) or Unreliable (faster, but might get dropped). Use Reliable for important gameplay events like damage or purchases. Use Unreliable for frequent, non-critical updates like cosmetic effects.

Best Practicesโ€‹

  • Always validate on the server. Never trust data coming from a client RPC -- check that the action is legal before applying it.
  • Keep payloads small. Send IDs or indices instead of full objects when possible.
  • Don't spam RPCs. If you're calling an RPC every frame, you probably want replication instead.
  • Use Multicast sparingly. Broadcasting to every client is expensive -- consider whether relevancy-based replication would work better.
โœจ