skills/game-dev/game-networking/SKILL.md
Implements networking for multiplayer games, handling protocols, latency, and synchronization.
npx skillsauth add alphaonedev/openclaw-graph game-networkingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill allows the AI to implement multiplayer game networking, managing protocols (e.g., UDP, TCP), minimizing latency, and ensuring game state synchronization for seamless player interactions.
Use this skill when building multiplayer games that require real-time communication, such as online shooters, MMOs, or cooperative adventures. Apply it for scenarios involving player synchronization, server-client architectures, or handling network interruptions in game loops.
To use this skill, first initialize a network context, then establish connections, send/receive data, and handle disconnections. Always wrap network operations in try-catch blocks for robustness. For example, in a game loop, check for incoming packets every frame and update game state accordingly. Use asynchronous patterns to avoid blocking the main thread. If authentication is needed, set the environment variable $GAME_NETWORKING_API_KEY before invoking commands.
Interact via OpenClaw CLI or REST API. CLI commands require the skill to be activated first with openclaw activate game-networking.
CLI Commands:
openclaw game-networking init --protocol udp --port 5000 --key $GAME_NETWORKING_API_KEY
openclaw game-networking send --host 192.168.1.1 --data '{"player_pos": [10, 20]}'
--host for target IP, --data for JSON payload.openclaw game-networking listen --timeout 5
API Endpoints:
{"protocol": "udp", "host": "localhost", "port": 5000}
Authorization: Bearer $GAME_NETWORKING_API_KEY?sessionID=123{"state": {"players": [{"id": 1, "pos": [5, 10]}]}}Code Snippets:
import openclaw
api_key = os.environ.get('GAME_NETWORKING_API_KEY')
session = openclaw.game_networking.init(protocol='udp', port=5000, key=api_key)
session.connect(host='192.168.1.1')
data = {'player_pos': [10, 20]}
openclaw.game_networking.send(session, data)
Config Formats:
{
"protocol": "tcp",
"maxLatency": 100,
"syncInterval": 50
}
network-config.json and pass via CLI: openclaw game-networking init --config network-config.jsonIntegrate this skill into game engines like Unity or Godot by importing the OpenClaw SDK and calling functions from your scripts. For Unity, add the OpenClaw package via NuGet and reference it in C# scripts. Always verify dependencies: ensure the skill is compatible with your game's architecture (e.g., client-server vs. P2P). If using with other OpenClaw skills, chain them; for example, use game-auth first to handle user logins, then pass the token to network commands via $GAME_NETWORKING_API_KEY. Test integrations in a simulated environment to handle firewall issues.
Anticipate common errors like connection timeouts, packet loss, or invalid API keys. Use try-except blocks for CLI/API calls; for example, catch NetworkError for failed connections. Specific patterns:
openclaw game-networking send --retry 3.$GAME_NETWORKING_API_KEY).try:
response = openclaw.game_networking.listen(timeout=5)
except openclaw.NetworkTimeoutError as e:
print(f"Timeout occurred: {e}. Retrying...")
# Implement retry logic here
Log errors with timestamps and include debug flags in commands, e.g., openclaw game-networking init --debug to output detailed traces.
openclaw game-networking init --protocol tcp --port 8080 --key $GAME_NETWORKING_API_KEY. Then, in your game code, connect clients with: ```python
import openclaw
session = openclaw.game_networking.connect(host='localhost', port=8080)
session.send({'action': 'join_lobby', 'player_name': 'User1'})
2. **Synchronize player positions in a real-time game:** Initialize with `openclaw game-networking init --protocol udp`. In the game loop, send updates: ```python
while game_running:
pos = get_player_position()
openclaw.game_networking.send(session, {'player_pos': pos})
incoming = openclaw.game_networking.receive()
if incoming: update_game_state(incoming)
``` This ensures low-latency synchronization, compensating for delays by interpolating positions.
## Graph Relationships
- Depends on: authentication (for secure connections), game-physics (for synchronized simulations)
- Related to: game-dev cluster skills like game-ai (for intelligent network behaviors), data-storage (for persisting game states)
- Conflicts with: none directly, but avoid overlapping with low-level socket implementations
tools
Root web development: project structure, tooling selection, deployment decisions
development
WebAssembly: Rust/Go/C to WASM, wasm-bindgen, Emscripten, WASM Component Model
development
Vue 3: Composition API script setup, Pinia, Vue Router 4, SFCs, Vite, Nuxt 3
tools
Tailwind CSS 4: utility classes, config, JIT, arbitrary values, darkMode, plugins, shadcn/ui