Efficient data serialization for game networking including Protobuf, FlatBuffers, and custom binary
Implements efficient data serialization for game networking using Protobuf, FlatBuffers, and custom binary formats. Claude will use this when you need low-latency network packets, schema definitions, or compression techniques for multiplayer games.
/plugin marketplace add pluginagentmarketplace/custom-plugin-server-side-game-dev/plugin install server-side-game-dev-plugin@pluginagentmarketplace-game-serverThis skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/config.yamlassets/serialization-benchmarks.yamlreferences/GUIDE.mdreferences/SERIALIZATION_FORMATS.mdscripts/helper.pyscripts/serialize_benchmark.pyImplement efficient serialization for low-latency game networking.
| Format | Size | Speed | Schema | Use Case |
|---|---|---|---|---|
| Protobuf | Small | Fast | Required | Most games |
| FlatBuffers | Small | Fastest | Required | Real-time |
| MsgPack | Small | Fast | Optional | Flexible |
| JSON | Large | Slow | None | Debug |
| Custom Binary | Smallest | Fastest | Custom | Ultra-low latency |
syntax = "proto3";
message PlayerState {
uint32 player_id = 1;
float x = 2;
float y = 3;
float z = 4;
uint32 health = 5;
}
message GameUpdate {
uint64 tick = 1;
repeated PlayerState players = 2;
}
GameUpdate update;
update.set_tick(current_tick);
auto* player = update.add_players();
player->set_player_id(1);
player->set_x(pos.x);
std::string serialized;
update.SerializeToString(&serialized);
struct PacketHeader {
uint16_t type;
uint16_t length;
uint32_t sequence;
};
struct PlayerUpdate {
uint32_t player_id;
float position[3];
uint16_t angle; // Compressed rotation
uint8_t flags;
};
void serialize(Buffer& buf, const PlayerUpdate& p) {
buf.write_u32(htonl(p.player_id));
for (int i = 0; i < 3; i++)
buf.write_float(p.position[i]);
buf.write_u16(htons(p.angle));
buf.write_u8(p.flags);
}
| Technique | Savings | Complexity |
|---|---|---|
| Delta | 50-80% | Medium |
| Quantization | 30-50% | Low |
| LZ4 | 50-70% | Low |
| Error | Root Cause | Solution |
|---|---|---|
| Parse error | Version mismatch | Schema versioning |
| Large packets | No compression | Enable delta/LZ4 |
| Slow parsing | JSON in hot path | Use binary format |
| Corruption | Byte order | Use htonl/ntohl |
// Check serialized size
std::string data;
message.SerializeToString(&data);
std::cout << "Size: " << data.size() << " bytes\n";
// Validate roundtrip
Message parsed;
parsed.ParseFromString(data);
assert(parsed.id() == message.id());
TEST(Serialization, RoundTrip) {
PlayerState original{1, 10.0f, 20.0f, 30.0f, 100};
std::string data;
original.SerializeToString(&data);
PlayerState parsed;
parsed.ParseFromString(data);
EXPECT_EQ(original.player_id(), parsed.player_id());
EXPECT_FLOAT_EQ(original.x(), parsed.x());
}
assets/ - Schema templatesreferences/ - Format benchmarksThis skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.