-
Notifications
You must be signed in to change notification settings - Fork 250
Add SkipCaller RPC flag #10020
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add SkipCaller RPC flag #10020
Conversation
Introduce NetFlags.SkipCaller and update RPC dispatch to skip local execution when the flag is set. Added a SkipCaller enum entry with documentation and early-return checks in Rpc.StaticRpc.cs and Rpc.InstanceRpc.cs so RPCs with this flag are still sent to remote recipients but not executed on the caller (useful for cases like dedicated servers broadcasting sounds).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds a new NetFlags.SkipCaller bit to support RPCs that still send to normal remote recipients but intentionally do not execute on the machine that initiated the call (useful for dedicated-server-originated broadcasts like effects/sounds).
Changes:
- Added
NetFlags.SkipCaller = 64with XML documentation. - Updated static RPC dispatch to early-return (skip local execution) when
SkipCalleris set. - Updated instance RPC dispatch (system + component overloads) with the same early-return behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
engine/Sandbox.Engine/Systems/Networking/System/NetworkEnums.cs |
Introduces the NetFlags.SkipCaller enum value and documents intended behavior. |
engine/Sandbox.Engine/Scene/Networking/Rpc.StaticRpc.cs |
Skips local static RPC execution for the initiating caller when SkipCaller is present. |
engine/Sandbox.Engine/Scene/Networking/Rpc.InstanceRpc.cs |
Skips local instance RPC execution (both overloads) for the initiating caller when SkipCaller is present. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// When set, the caller will not execute the RPC method locally. The message is still sent to | ||
| /// all remote recipients as normal. This is useful when broadcasting sounds from a dedicated server, |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The XML doc for SkipCaller says the RPC is still sent to "all remote recipients". Since NetFlags are used across different RpcMode/filters, this reads like it always broadcasts; consider rewording to clarify it skips only local execution while sending proceeds to the normal recipients (respecting RpcMode/filters).
| /// When set, the caller will not execute the RPC method locally. The message is still sent to | |
| /// all remote recipients as normal. This is useful when broadcasting sounds from a dedicated server, | |
| /// When set, the caller will not execute the RPC method locally. The RPC is still sent to its | |
| /// normal remote recipients according to the current RpcMode/filters; this flag only affects local | |
| /// execution on the calling peer. This is useful when broadcasting sounds from a dedicated server, |
| SendStaticRpc( m, argumentList, attribute ); | ||
| } | ||
|
|
||
| // Caller already handled this locally |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This inline comment is inaccurate: when SkipCaller is set, the caller is intentionally not executing the RPC locally. Please adjust the comment to reflect that local execution is being skipped (while the RPC may still have been sent to remote recipients above).
| // Caller already handled this locally | |
| // Skip executing the RPC locally for the caller when SkipCaller is set |
| SendInstanceRpc( system, m, argumentList, attribute ); | ||
| } | ||
|
|
||
| // Caller already handled this locally |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This inline comment is inaccurate: when SkipCaller is set, the caller is intentionally not executing the RPC locally. Please adjust the comment to reflect that local execution is being skipped (while the RPC may still have been sent to remote recipients above).
| // Caller already handled this locally | |
| // Skip local execution for the caller when SkipCaller is set (RPC may still have been sent to remote recipients above) |
| SendInstanceRpc( go, component, m, argumentList, attribute ); | ||
| } | ||
|
|
||
| // Caller already handled this locally |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This inline comment is inaccurate: when SkipCaller is set, the caller is intentionally not executing the RPC locally. Please adjust the comment to reflect that local execution is being skipped (while the RPC may still have been sent to remote recipients above).
| // Caller already handled this locally | |
| // Skip executing this RPC locally on the caller when requested |
Introduce NetFlags.SkipCaller and update RPC dispatch to skip local execution when the flag is set.
Added a SkipCaller enum entry with documentation and early-return checks in Rpc.StaticRpc.cs and Rpc.InstanceRpc.cs so RPCs with this flag are still sent to remote recipients but not executed on the caller (useful for cases like dedicated servers broadcasting sounds).
Pull Request
Thanks for contributing to s&box ❤️
Please fill out the sections below to help us review your change efficiently.
Summary
Adds a flag to Rpc that makes the call not execute on host, only on the other targets.
Motivation & Context
I do a lot of particle and sound broadcasts, there's no point spawning these on the host (dedicated server), and adding Rpc.FilterExclude for the host each time is really messy.
Fixes:
Implementation Details
vibe coded but tested, thanks claude
Screenshots / Videos (if applicable)
Checklist