This commit is contained in:
Martin Slachta
2026-07-18 14:31:15 +02:00
commit a04f0dc262
3343 changed files with 1140208 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
edition = "2023";
package mmo.chat;
message SendChatMessageRequest {
uint64 channel_id = 1;
string message = 2;
}
message JoinChannelRequest {
uint64 channel_id = 1;
}
message LeaveChannelRequest {
uint64 channel_id = 1;
}
message ChatMessageBroadcastRequest {
uint64 channel_id = 1;
uint64 sender_id = 2;
string message = 3;
}
// Server -> Client responses
enum ChatErrorCode {
CHAT_ERROR_CODE_OK = 0;
CHAT_ERROR_CODE_UNAUTHORIZED = 1;
CHAT_ERROR_CODE_CHANNEL_NOT_FOUND = 2;
CHAT_ERROR_CODE_ALREADY_IN_CHANNEL = 3;
CHAT_ERROR_CODE_NOT_IN_CHANNEL = 4;
}
message JoinChannelResponse {
uint64 channel_id = 1;
ChatErrorCode error = 2;
}
message LeaveChannelResponse {
uint64 channel_id = 1;
ChatErrorCode error = 2;
}
message SendChatMessageResponse {
uint64 channel_id = 1;
ChatErrorCode error = 2;
}
+30
View File
@@ -0,0 +1,30 @@
edition = "2023";
package mmo.cluster;
// XZ-plane area owned by a zone (vec2.y maps to world Z).
message ZoneBounds {
float min_x = 1;
float min_z = 2;
float max_x = 3;
float max_z = 4;
}
// Opaque zone identity assigned by ZoneCoordinator.
// Carries bounds so receivers can build their routing table without a separate lookup.
message ZoneId {
uint32 id = 1;
ZoneBounds bounds = 2;
}
// Sent by a zone server to every peer it discovers from the coordinator.
// Establishes the sender's identity on the cluster link.
message ZoneHello {
ZoneId zone = 1;
}
// Sent by a zone server just before it shuts down.
// Receivers must remove the named zone from their peer tables.
message ZoneBye {
ZoneId zone = 1;
}
+9
View File
@@ -0,0 +1,9 @@
syntax = "proto3";
package mmo;
message Pos3 {
float x = 1;
float y = 2;
float z = 3;
}
+13
View File
@@ -0,0 +1,13 @@
syntax = "proto3";
package mmo;
message EntitySpawnMessage {
uint32 entity_id = 1;
bool is_player = 2;
string name = 3;
}
message EntityDespawnMessage {
uint32 entity_id = 1;
}
+14
View File
@@ -0,0 +1,14 @@
edition = "2023";
package mmo;
message LoginRequest {
string username = 1;
string password = 2;
}
message LoginResponse {
bool success = 1;
string message = 2;
int32 entity_id = 3;
}
+30
View File
@@ -0,0 +1,30 @@
syntax = "proto3";
package mmo.peer;
message PeerInput {
float x = 1;
float y = 2;
float z = 3;
}
message PeerHello {
uint32 peer_id = 1;
}
message PeerAction {
uint32 frame_idx = 1;
PeerInput input = 2;
}
// All unacked history frames for one sender, plus a piggybacked ack.
// Sent as a single datagram / framed TCP message per tick.
message PeerActionBatch {
uint32 peer_id = 1;
uint32 ack_frame = 2; // sender's committed_frame
repeated PeerAction actions = 3;
}
message PeerBye {
uint32 peer_id = 1;
}
+15
View File
@@ -0,0 +1,15 @@
syntax = "proto3";
package mmo;
message PlayerInput {
float x = 1;
float y = 2;
float z = 3;
}
message PlayerMoveMessage {
int32 frame_idx = 1;
PlayerInput input = 2;
}
+16
View File
@@ -0,0 +1,16 @@
struct Vec3 {
x: float;
y: float;
z: float;
}
table PlayerInfo {
id:int;
pos:Vec3;
}
table WorldState {
players:[PlayerInfo];
}
root_type WorldState;
+28
View File
@@ -0,0 +1,28 @@
syntax = "proto3";
package mmo;
message EntityPosition {
int32 id = 1;
float x = 2;
float y = 3;
float z = 4;
}
message SpawnEntity {
int32 id = 1;
}
message DespawnEntity {
int32 id = 1;
}
message WorldStateMessage {
uint32 frame_idx = 1;
repeated SpawnEntity spawns = 2;
repeated EntityPosition entities = 3;
repeated DespawnEntity despawns = 4;
}