Server APIs
Server-side Lua APIs for MAEngine
Server APIs
These APIs are available in server-side scripts (Server/init.lua).
Core
Server
Server lifecycle, tick events, and management
Database
SurrealDB persistence with sync/async operations
Game Logic
Player
Connected players, possession, values, kick
Entities
Spawning, destruction, custom classes
Events
Local events and remote client communication
Shared APIs
These are also available on server (identical to client):
Server Authority
The server is authoritative for all game state:
- Entity spawning - Only the server can create entities
- State modification - Server validates and applies all changes
- Database access - Only server has DB access
- Player management - Kick, ban, possess operations
-- Server/init.lua
Server.Subscribe("Start", function()
Log("Server started!")
end)
Player.Subscribe("Spawn", function(player)
local character = Character.Spawn(Vec3(0, 0, 100))
player:Possess(character)
end)