-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add secure multiplayer design guidance to high-level multiplayer documentation #11891
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
Open
deathtaco1408
wants to merge
4
commits into
godotengine:master
Choose a base branch
from
deathtaco1408:deathtaco1408-secure-multiplayer-docs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+32
−0
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
fdcf3f0
Add secure multiplayer design guidelines
deathtaco1408 eb17720
Add secure multiplayer design guidelines
deathtaco1408 223cd15
Clarify RPC method usage in high-level multiplayer
deathtaco1408 c2f8ff0
Apply suggestions from code review
Calinou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -47,6 +47,39 @@ In summary, you can use the low-level networking API for maximum control and imp | |||||
| You can of course experiment, but when you release a networked application, | ||||||
| always take care of any possible security concerns. | ||||||
|
|
||||||
| Secure multiplayer design | ||||||
| ------------------------- | ||||||
|
|
||||||
| Godot's high-level multiplayer API makes it easier to build networked games, but it does not | ||||||
| automatically make gameplay logic secure. For competitive or persistent multiplayer games, treat | ||||||
| all client input as untrusted. | ||||||
|
|
||||||
| A common mistake is to let clients authoritatively decide important game state, such as player | ||||||
| position, combat results, inventory changes, or match outcomes. This can make cheating and desyncs | ||||||
| much easier. | ||||||
|
|
||||||
| In general, prefer the following patterns: | ||||||
|
|
||||||
| - Use server-authoritative logic for gameplay-critical decisions. | ||||||
| - Validate RPC arguments before applying them to game state. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| - Avoid trusting client-reported positions, timers, cooldowns, or resource values without checks. | ||||||
| - Add sanity checks and rate limits to actions that can be triggered frequently. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| - Keep RPC methods on ``Node``-derived classes. High-level RPC calls are not supported on methods | ||||||
| defined only in non-``Node`` classes. | ||||||
|
|
||||||
| For example, instead of accepting a client's final position directly, consider sending player input | ||||||
| or movement intent to the authority/server, then validating and applying the result there. | ||||||
|
|
||||||
| High-level multiplayer is designed for convenience, not as a complete anti-cheat solution. If your | ||||||
| game has strict fairness, persistence, or security requirements, design your networking so that the | ||||||
| server remains the source of truth for important state. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| Note | ||||||
|
|
||||||
| RPC methods should be defined on ``Node``-derived classes. Attempting to use high-level RPC calls | ||||||
| on methods defined only in non-``Node`` classes will result in runtime errors. | ||||||
|
|
||||||
|
|
||||||
|
Calinou marked this conversation as resolved.
Outdated
|
||||||
| Mid-level abstraction | ||||||
| --------------------- | ||||||
|
|
||||||
|
|
||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.