Vixen
02b45cc4

ServerRpcAttribute

annotation Core/Vixen.Net/Rpc/RpcAttributes.cs:48
csharp
public sealed class ServerRpcAttribute

Marks a method as the handler for a call a client makes and a server runs.

No guide page documents this yet — the page shows what the code says about itself.

As a annotation

Valid on
Method

Remarks

The method is the handler, not the call. A separate sender is generated beside it, reached through the type's Rpc accessor, so the call site reads Rpc.TakeDamage(dmg) and says out loud that a packet is being sent. docs/plan/16-networking.md explains why: the reference implementation rewrites the method's prologue so that one name means both things, we cannot do that (ADR-002 bans IL post-processing, and it would not survive NativeAOT), and the ceremony we are left with is one line better than what it replaced. Transparent RPC hides latency and bandwidth at the call site; making it visible is a feature.

The handler runs only on the server. A packet naming it is checked against the manifest, against RequireOwnership and against the connection's rate limit before anything is invoked.

Fields and properties (2)

  • public bool RequireOwnership

    Whether the caller must own the object the call is about. On by default, which is the safe way round: an RPC that anybody may invoke on anybody's object is the shape of most cheating, and it should be a decision somebody wrote down rather than a default.

  • public Channel Channel

    How to send it. Reliable by default: a call that is lost did not happen.

Used by (2)

  • AvatarControllerMultiplayer
  • GeneratedTurretVixen.Net.Generators.Tests