Design an RPC/messaging system with serialization strategy for multiplayer games
Designs RPC and messaging systems for multiplayer game communication with serialization strategies.
/plugin marketplace add sponticelli/gamedev-claude-plugins/plugin install multiplayer@gamedev-claude-pluginsCreate an RPC and messaging system design for multiplayer game communication.
Before generating the RPC design, understand the communication needs:
Use this context to design appropriate RPC and messaging patterns.
# RPC/Messaging Design: [Game/Feature]
## Overview
**Transport:** [WebSocket / TCP / UDP / gRPC]
**Serialization:** [JSON / MessagePack / Protobuf]
**Auth Model:** [JWT / Session / API Key]
## Message Envelope
### Standard Envelope
```json
{
"type": "[rpc|event|request|response]",
"id": "unique_message_id",
"timestamp": 1234567890,
"payload": { ... }
}
{
"type": "error",
"id": "original_request_id",
"error": {
"code": "ERROR_CODE",
"message": "Human readable message",
"details": { ... }
}
}
| Method | Parameters | Returns | Auth | Rate Limit |
|---|---|---|---|---|
| [method] | [params] | [return] | [Yes/No] | [X/sec] |
Purpose: [What this RPC does] Request:
{
"param1": "type",
"param2": "type"
}
Response:
{
"result": "type"
}
Validation:
Errors:
| Code | When |
|---|---|
| [CODE] | [Condition] |
[Repeat for each RPC]
| Event | Payload | Recipients | Reliable |
|---|---|---|---|
| [event] | [data] | [who] | [Yes/No] |
Purpose: [What this event notifies] Triggered by: [What causes this event] Payload:
{
"field1": "type",
"field2": "type"
}
Recipients: [All in session / Nearby / Specific players]
[Repeat for each event]
| Format | Message Size | Parse Speed | Debug-ability |
|---|---|---|---|
| JSON | Baseline | Baseline | Excellent |
| MessagePack | 30-50% smaller | 2-3x faster | Moderate |
| Protobuf | 50-70% smaller | 5-10x faster | Requires tools |
Rationale: [Why this format]
[Schema definitions]
| Priority | Types | Behavior |
|---|---|---|
| Critical | [Types] | Always sent immediately |
| High | [Types] | Sent every update |
| Medium | [Types] | Batched, sent frequently |
| Low | [Types] | Sent when bandwidth allows |
Method: [None / gzip / LZ4 / custom] Applied to: [Which messages] Threshold: [Compress if > X bytes]
[How messages are batched for efficiency]
| Code | Category | Client Action |
|---|---|---|
| [CODE] | [Category] | [What client should do] |
| Error Type | Retry | Backoff |
|---|---|---|
| Transient | Yes | Exponential |
| Validation | No | N/A |
| Auth | Re-auth | N/A |
| Rate limit | Yes | Wait X seconds |
| Method | Limit | Window | Penalty |
|---|---|---|---|
| [method] | [N] | [Xs] | [Action] |
[What validation is performed on each RPC]
[Authentication message sequence]
Generate based on the user's game and communication requirements.