peer-to-peer-multiplayer

peer-to-peer-multiplayer is a skill for Claude Code from ouzlifaneyassine1-dot/onyx-engine. It costs 89 tokens per session (4,017 once invoked), scanned A, a copy of peer-to-peer-multiplayer, MIT.

A guide for building a host-controlled peer-to-peer multiplayer game in Godot from the beginning. Peer-to-peer means players connect directly, while one player's game acts as the authority for shared state.

In plain words
What is it for?
It helps create the network manager, decide who owns each piece of game state, route messages, and make remote players appear smooth with prediction and interpolation.
Why use it?
It prevents networking, cheating, and synchronization problems caused by adding multiplayer after the game logic is already built.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions Claude Code; mentions Codex.

Part of the onyx plugin — 77 skills, 1 command, 2 hooks, 1 MCP server shipped together

Good fit It helps create the network manager, decide who owns each piece of game state, route messages, and make remote players appear smooth with prediction and interpolation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ouzlifaneyassine1-dot/onyx-engine/peer-to-peer-multiplayer
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ouzlifaneyassine1-dot/onyx-engine --skill peer-to-peer-multiplayer
Clone the repo
git clone --depth 1 https://github.com/ouzlifaneyassine1-dot/onyx-engine

Made for: Claude Code.

Or install onyx, the plugin that ships this one along with the rest of its 77 skills, 1 command, 2 hooks, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for peer-to-peer-multiplayer

README.md
[![agentmods](https://agentmods.dev/badge/skills/ouzlifaneyassine1-dot/onyx-engine/peer-to-peer-multiplayer/github.svg)](https://agentmods.dev/skills/ouzlifaneyassine1-dot/onyx-engine/peer-to-peer-multiplayer)
Your own site
<a href="https://agentmods.dev/skills/ouzlifaneyassine1-dot/onyx-engine/peer-to-peer-multiplayer"><img src="https://agentmods.dev/badge/skills/ouzlifaneyassine1-dot/onyx-engine/peer-to-peer-multiplayer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for peer-to-peer-multiplayer

Your own site · 80×15
<a href="https://agentmods.dev/skills/ouzlifaneyassine1-dot/onyx-engine/peer-to-peer-multiplayer"><img src="https://agentmods.dev/badge/skills/ouzlifaneyassine1-dot/onyx-engine/peer-to-peer-multiplayer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 89 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,017 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 95% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00089 $0.04017
Opus 5 $0.00044 $0.02008
Sonnet 5 $0.00018 $0.00803
Haiku 4.5 $0.00009 $0.00402

Measured 10d ago against content hash 595bedbc263b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

peer-to-peer-multiplayer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

95% identical to peer-to-peer-multiplayer — 17 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/multiplayer-and-networking/peer-to-peer-multiplayer/SKILL.md · 379 lines

How it starts

The opening of the file, as written. The whole thing — 379 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/peer-to-peer-multiplayer — Build a P2P Game From the Ground Up

Overview

Multiplayer is architecture, not a feature. Bolting it onto a single-player game is 5× harder than starting multiplayer-first. This skill walks the four layers in order. Skip any of them and you'll spend the rest of development paying for it in cheat-vulnerable state, desync bugs, and "why is the other player teleporting" reports.

The four layers, top-down:

  1. NetworkManager — the autoload that owns peer IDs, connection lifecycle, message routing.
  2. Authoritative state — the decision matrix for which fields the host owns vs. which the client renders.
  3. Three routing patterns — host→client, client→host, client→client. Each has different rules.
  4. Real-time rendering — prediction + interpolation so the local player feels responsive while remote state catches up.

Build them in that order. Don't write a single piece of game logic until layers 1 + 2 exist.

Step 0 — Should it be P2P at all?

Ask the user before anything else:

Are players connecting through Steam friends / Epic friends / a private invite link, or do they need matchmaking at scale (1000s of concurrent matches)?

Answer Architecture
Friend-invite / small lobby (≤8 players) P2P with host authority. This skill.
Matchmaking + anti-cheat + scale Dedicated client-server. Different skill (/onyx:client-server-multiplayer).
MMO / persistent world Custom server. Out of scope for this skill.

If P2P is right, continue. Otherwise, stop and route to the right skill.

Layer 1 — NetworkManager

A single autoload that owns the network. Nothing else in the game touches MultiplayerAPI directly.

May I create autoloads/network_manager.gd and register it as a Godot autoload?

class_name NetworkManager
extends Node

# ── Signals (all game systems listen here, not to MultiplayerAPI directly) ──
signal connection_succeeded
signal connection_failed(reason: String)
signal peer_joined(peer_id: int)
signal peer_left(peer_id: int)
signal session_ended

const DEFAULT_PORT := 7777
const MAX_PEERS := 8

var is_host: bool = false
var local_peer_id: int = 0
var peers: Dictionary = {}  # peer_id -> { name, ready, ... }

func host(port: int = DEFAULT_PORT) -> Error:
    var peer := ENetMultiplayerPeer.new()
    var err := peer.create_server(port, MAX_PEERS)
    if err != OK:
        connection_failed.emit("create_server failed: %s" % error_string(err))
        return err
    multiplayer.multiplayer_peer = peer
    is_host = true
    local_peer_id = 1
    _wire_signals()
    connection_succeeded.emit()
    return OK

func join(address: String, port: int = DEFAULT_PORT) -> Error:
    var peer := ENetMultiplayerPeer.new()
    var err := peer.create_client(address, port)
    if err != OK:
        connection_failed.emit("create_client failed: %s" % error_string(err))
        return err
    multiplayer.multiplayer_peer = peer
    is_host = false
    _wire_signals()
    return OK

func leave() -> void:
    if multiplayer.multiplayer_peer:
        multiplayer.multiplayer_peer.close()
        multiplayer.multiplayer_peer = null
    is_host = false
    local_peer_id = 0
    peers.clear()
    session_ended.emit()

func _wire_signals() -> void:
    multiplayer.peer_connected.connect(_on_peer_connected)
    multiplayer.peer_disconnected.connect(_on_peer_disconnected)
    multiplayer.connected_to_server.connect(_on_connected_to_server)
    multiplayer.connection_failed.connect(_on_connection_failed)
    multiplayer.server_disconnected.connect(_on_server_disconnected)

func _on_peer_connected(id: int) -> void:
    peers[id] = { "name": "Player %d" % id, "ready": false }
    peer_joined.emit(id)

func _on_peer_disconnected(id: int) -> void:
    peers.erase(id)
    peer_left.emit(id)

func _on_connected_to_server() -> void:
    local_peer_id = multiplayer.get_unique_id()
    connection_succeeded.emit()

func _on_connection_failed() -> void:
    connection_failed.emit("connection refused or timed out")

func _on_server_disconnected() -> void:
    leave()

Read the full file on GitHub · 379 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 379 lines · 89 tokens per session scan A 595bedbc263b

Subscribe to this mod's changes

peer-to-peer-multiplayer is a skill published in the GitHub repository ouzlifaneyassine1-dot/onyx-engine (0 stars, last pushed 2mo ago), licensed MIT. It adds 89 tokens to every session and 4,017 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. It is 95% identical to peer-to-peer-multiplayer, differing in 17 lines, and is treated as a copy.

Related

Other skills, from other repositories

host-authoritative-state

Use when designing the state layer of a multiplayer Summer game: deciding what the host owns, how clients request changes, and how the host validates and broadcasts. Pairs with /peer-to-peer-multiplayer. Trigger on "host authority", "authoritative state", "state ownership", "MP cheating", "client validation", "RPC…

SummerEngine/summer-engine-agent · 74 tokens

peer-to-peer-multiplayer

Use when starting a multiplayer Summer game from scratch with peer-to-peer host authority. Build the network architecture top-down so authoritative state, routing rules, and real-time rendering are not bolted on later. Use before writing game logic, not after. Trigger on "multiplayer", "peer-to-peer", "p2p", "co-op"…

SummerEngine/summer-engine-agent · 88 tokens

setup-multiplayer

Use when the user wants to add multiplayer to an existing Summer game: co-op LAN, co-op online, competitive PvP, or a lobby. Start with Summer Engine's high-level MultiplayerAPI plus MultiplayerSpawner and MultiplayerSynchronizer; use custom networking only with a justified reason. Walks peer authority, RPC patterns…

SummerEngine/summer-engine-agent · 125 tokens

gameobject-component-destroy

Destroy one or more Components from a target GameObject. Missing (null) components are skipped — they cannot be destroyed. Use 'gameobject-find' and 'gameobject-component-get' to identify the components first.

IvanMurzak/Unity-MCP · 49 tokens

unity-version-split

Split a C# file into Unity 6.5+ and pre-Unity 6.5 variants. Use when a file needs different implementations for different Unity versions due to API changes (e.g., EntityId vs int, GetEntityId vs GetInstanceID).

IvanMurzak/Unity-MCP · 59 tokens

godot-signals-groups

Build event-driven, decoupled Godot 4.7 gameplay with signals and node groups: declare and emit custom signals, connect with Callables (incl. bind/one-shot), and broadcast to many nodes via groups and callgroup. Use when wiring node communication in a Godot project, replacing tight references with signals…

gamedev-skills/awesome-gamedev-agent-skills · 95 tokens