Godfather v0.1 Draft
This is the surface v0.1 is being designed to. Nothing here is built yet, and names can change until v0.1 ships. Everything is in the Godfather namespace.
Gamemode
Base class for a gamemode. The server creates one instance and calls its events on the main thread.
[Gamemode(string id, Version = "x.y.z")]
Marks the class the server loads. The id is shown in the launcher's server list.
virtual void OnServerStart()
Called once after the world has loaded and before players can join.
virtual void OnPlayerJoined(Player player)
Called when a player has connected and their character exists but is not yet spawned.
virtual void OnPlayerLeft(Player player)
Called when a player disconnects. The player object is still readable during the call.
virtual void OnTick(float deltaSeconds)
Called every server tick. Keep it light.
virtual void OnServerStop()
Called before shutdown. Storage is flushed after it returns.
IReadOnlyList<Player> Players
Everyone currently connected.
Player
A connected player. Methods run on the server; the client follows.
int Id · string Name
Session id and the name chosen in the launcher.
Vector3 Position { get; set; } · float Heading
World position in metres and facing in degrees.
void Spawn(Spawn spawn)
Places the character in the world and gives control to the player. Spawn.Default uses the server's spawn point.
void Freeze() · void Unfreeze()
Stops or restores movement and input. Used while UI is open.
void Toast(string text, ToastKind kind = ToastKind.Info)
Shows a short message on the player's screen.
void Kick(string reason)
Disconnects the player with a reason they can read.
Camera
Per-player camera control, reached through player.Camera.
void FlyOver(Landscape path)
Slow cinematic flight along a path while the player is frozen, as behind the NG-RP sign-in. Landscape.Default circles Los Santos.
void FlyTo(Vector3 position, float seconds)
Moves the camera down to a point, for example the spawn after sign-in.
void Follow()
Returns to the normal third-person camera.
Storage
Key-value data kept on the server. SQLite is the default backend; another backend implements IStorage.
static Bucket For(Player player) · static Bucket Server
Data for one player (by account, not session) or for the whole server.
T Get<T>(string key, T fallback = default) · void Set<T>(string key, T value)
Values are serialized as JSON. Writes are batched and flushed each second and on shutdown.
bool Remove(string key)
Deletes a key; returns false if it was not there.
Accounts
Sign-in helpers for gamemodes such as NG-RP: Accounts.Create(name, password), Accounts.Verify(name, password). Passwords are salted and hashed with a slow hash, never logged and never stored in plain text. Attempts are rate-limited.
UI
Server-driven screens in the black-glass style shown in the UI kit. The server describes the screen; the client draws it and sends back input.
static Panel UI.Panel(Player player, string title)
Opens a centered glass panel. Only one panel per player is open at a time.
panel.Text(string) · panel.Field(string label, bool password = false)
Adds text and input fields. Fields return a handle whose Value is read in callbacks.
panel.Button(string label, Action onClick, ButtonKind kind = Primary)
Adds a button. Callbacks run on the server.
panel.Tabs(params string[] names) · panel.Error(string) · panel.Busy(bool)
Tabs such as Sign in / Create account, an inline error line and a loading state.
panel.Close()
Closes the panel and restores the HUD.
Loading and versions
How the server finds gamemodes and how versions work.
plugins/
The dedicated server loads every DLL in its plugins folder through the engine's plugin loader and starts the gamemode named in server.json.
Versioning
Godfather follows semantic versioning from v1.0. Before that, minor versions may break gamemodes, and every break is listed in the changelog.