This document lists all message channels (topics) used in the R-Type Clone ECS system. Channels are used for pub/sub communication between systems and modules.
- Channel Types
- Input Channels
- Network Channels
- Game State Channels
- Rendering Channels
- Sound Channels
- Physics Channels
- System Channels
- Channels by File
| Type | Description |
|---|---|
ECS.subscribe() |
Listen to a channel |
ECS.sendMessage() |
Send to local module |
ECS.sendNetworkMessage() |
Send to server (client only) |
ECS.broadcastNetworkMessage() |
Broadcast to all clients (server only) |
Direction: Engine → Lua
Payload: Key name string ("UP", "DOWN", "LEFT", "RIGHT", "SPACE", "ESCAPE", etc.)
Subscribers: InputSystem, MenuSystem
ECS.subscribe("KeyPressed", function(key)
if key == "SPACE" then
-- Handle shoot
end
end)Direction: Engine → Lua
Payload: Key name string
Subscribers: InputSystem
Direction: Engine → Lua
Payload: "x,y,button" format
Subscribers: MenuSystem
Direction: Engine → Lua
Payload: "x,y" format
Subscribers: MenuSystem
Direction: Engine → Lua
Payload: "width,height" format
Subscribers: MenuSystem
Direction: Client → Server
Payload: MsgPack {k="KEY", s=1/0} or text "KEY 1"
Purpose: Send player input to server
-- Client sends input
ECS.sendBinary("INPUT", {k="UP", s=1})
-- or
ECS.sendNetworkMessage("INPUT", "UP 1")Direction: Server → Clients
Payload: MsgPack with entity state
{
id = "entity_uuid",
x = 0.0, y = 0.0, z = 0.0, -- Position
rx = 0.0, ry = 0.0, rz = 0.0, -- Rotation
vx = 0.0, vy = 0.0, vz = 0.0, -- Velocity
t = 1 -- Type (1=Player, 2=Bullet, 3=Enemy)
}Direction: Server → Clients
Payload: Entity ID string
Purpose: Notify clients to destroy an entity
Direction: Server → Clients
Payload: Entity ID string
Purpose: Trigger hit flash effect on client
Direction: Server → Client
Payload: Player entity ID
Purpose: Assign player entity to connected client
Direction: Client → Server
Payload: "ready"
Purpose: Client confirms it's ready to receive game state
Direction: Server → Client
Payload: Empty
Purpose: Tell client to reset game state
Direction: Engine → Lua (Server)
Payload: Client ID
Subscribers: NetworkSystem
Direction: Engine → Lua (Server)
Payload: Client ID
Subscribers: NetworkSystem
Direction: Internal
Payload: Target state ("MENU", "PLAYING", "GAMEOVER")
Subscribers: GameStateManager
Direction: Internal
Payload: Empty
Purpose: Notify systems that game has started
Direction: Internal
Payload: Empty
Purpose: Notify systems to reset state
Direction: Client → Server
Payload: Empty
Purpose: Request game reset
Direction: Client → Server
Payload: "1"
Purpose: Request to start the game
Direction: Internal
Payload: Final score
Purpose: Signal game over state
Direction: Server → Clients
Payload: Score value string
Purpose: Sync score to clients
Direction: Server → Clients
Payload: Level number string
Purpose: Notify level change
Direction: Internal
Payload: Empty
Subscribers: MenuSystem
Direction: Internal
Payload: Empty
Subscribers: MenuSystem
Direction: Internal
Payload: Empty
Purpose: Notify systems game is paused
Direction: Internal
Payload: Empty
Purpose: Notify systems game resumed
Direction: Lua → Renderer Module
Payload: Command string (see formats below)
Commands:
-- Create entity
"CreateEntity:mesh:id"
"CreateEntity:mesh:texturePath:id"
-- Transform
"SetPosition:id,x,y,z"
"SetRotation:id,rx,ry,rz"
"SetScale:id,sx,sy,sz"
-- Appearance
"SetColor:id,r,g,b"
"SetTexture:id:texturePath"
-- Camera
"SetActiveCamera:id"
-- Particles
"CreateParticleGenerator:id,offsetX,offsetY,offsetZ,..."Direction: Lua → Sound Module
Payload: "id:path:volume"
Example: "laser_1:effects/laser.wav:80"
Direction: Lua → Sound Module
Payload: Empty
Direction: Lua → Sound Module
Payload: "id:path:volume"
Example: "bgm:music/background.ogg:40"
Direction: Lua → Sound Module
Payload: Music ID
Direction: Lua → Sound Module
Payload: Music ID
Direction: Lua → Sound Module
Payload: Music ID
Direction: Lua → Sound Module
Payload: "id:volume"
Direction: Lua → Sound Module
Payload: Empty
Direction: Server → Clients
Payload: Same as SoundPlay
Direction: Server → Clients
Payload: Music ID
Direction: Lua → Physics Module
Payload: Command string
Commands:
-- Body management
"CreateBody:id,mass,friction,fixedRotation,useGravity;"
"DestroyBody:id;"
-- Forces
"ApplyForce:id,x,y,z;"
"ApplyImpulse:id,x,y,z;"
-- Transform
"SetPosition:id:x,y,z;"
"SetRotation:id:rx,ry,rz;"
"SetVelocity:id:vx,vy,vz;"
"SetAngularFactor:id:x,y,z;"Direction: Physics Module → Lua
Payload: "id1:id2"
Subscribers: CollisionSystem
Direction: Lua → Engine
Payload: Empty
Purpose: Request application exit
Direction: Internal
Payload: Empty
Subscribers: EnemySystem
Direction: Client → Server
Payload: Client ID
Purpose: Request player spawn
Direction: Internal (Server)
Payload: Client ID
Purpose: Handle player death on server
Direction: Server → Clients
Payload: "x,y,z,id"
Purpose: Notify enemy death for effects
Direction: Test → Engine
Payload: Test result
Purpose: Signal test completion
| Channel | Type | Description |
|---|---|---|
KeyPressed |
Subscribe | Handle key press |
KeyReleased |
Subscribe | Handle key release |
INPUT |
Send (Network) | Forward input to server |
| Channel | Type | Description |
|---|---|---|
ClientConnected |
Subscribe | Handle new client |
ClientDisconnected |
Subscribe | Handle client disconnect |
CLIENT_READY |
Subscribe | Client ready acknowledgment |
RESET_GAME |
Subscribe | Handle reset request |
GAME_STARTED |
Subscribe | Handle game start |
REQUEST_GAME_START |
Subscribe | Handle start request |
REQUEST_SPAWN |
Subscribe | Handle spawn request |
INPUT |
Subscribe | Process client input |
SERVER_PLAYER_DEAD |
Subscribe | Handle player death |
PLAY_SOUND |
Subscribe | Forward sound to local |
STOP_MUSIC |
Subscribe | Forward music stop |
LEVEL_CHANGE |
Subscribe | Handle level change |
PLAYER_ASSIGN |
Subscribe | Receive player assignment |
GAME_SCORE |
Subscribe | Receive score update |
ENTITY_HIT |
Subscribe | Handle hit effect |
ENTITY_POS |
Subscribe | Update entity position |
ENTITY_DESTROY |
Subscribe | Destroy entity |
ENEMY_DEAD |
Subscribe | Handle enemy death |
CLIENT_RESET |
Subscribe | Handle reset |
| Channel | Type | Description |
|---|---|---|
MousePressed |
Subscribe | Handle mouse click |
KeyPressed |
Subscribe | Handle key input |
MouseMoved |
Subscribe | Handle mouse movement |
PAUSE_GAME |
Subscribe | Show pause menu |
RESUME_GAME |
Subscribe | Hide pause menu |
WindowResized |
Subscribe | Handle window resize |
MusicPlay |
Send | Start background music |
MusicStop |
Send | Stop music |
ExitApplication |
Send | Exit game |
REQUEST_GAME_START |
Send (Network) | Request game start |
GAME_PAUSED |
Send | Notify pause |
GAME_RESUMED |
Send | Notify resume |
| Channel | Type | Description |
|---|---|---|
REQUEST_GAME_STATE_CHANGE |
Subscribe | Handle state change |
GAME_STARTED |
Send | Notify game started |
GAME_RESET |
Send | Notify game reset |
| Channel | Type | Description |
|---|---|---|
Collision |
Subscribe | Handle collision events |
PhysicCommand |
Send | Send physics commands |
SoundPlay |
Send | Play collision sounds |
PLAY_SOUND |
Broadcast | Sync sounds to clients |
ENTITY_HIT |
Broadcast | Notify hit effect |
| Channel | Type | Description |
|---|---|---|
ENEMY_DEAD |
Broadcast | Notify enemy death |
STOP_MUSIC |
Broadcast | Stop music on death |
PLAY_SOUND |
Broadcast | Play death sounds |
SERVER_PLAYER_DEAD |
Send | Notify player death |
ENTITY_DESTROY |
Broadcast | Destroy dead entity |
GAME_OVER |
Send | Signal game over |
| Channel | Type | Description |
|---|---|---|
RESET_DIFFICULTY |
Subscribe | Reset difficulty |
ENTITY_DESTROY |
Broadcast | Destroy out-of-bounds |
| Channel | Type | Description |
|---|---|---|
SoundPlay |
Send | Play shoot sounds |
PLAY_SOUND |
Broadcast | Sync sounds to clients |
| Channel | Type | Description |
|---|---|---|
RenderEntityCommand |
Send | Send render commands |
| Channel | Type | Description |
|---|---|---|
PhysicCommand |
Send | Create/update bodies |
RenderEntityCommand |
Send | Sync transforms |
| Channel | Type | Description |
|---|---|---|
RenderEntityCommand |
Send | Manage particles |
| Channel | Type | Description |
|---|---|---|
LEVEL_CHANGE |
Broadcast | Notify level change |