Skip to content

Getting started

What you need

  • Node.js 24 (or 22.18+): gamemodes are TypeScript files Node runs directly (type stripping), or plain JavaScript.
  • The SAGL server package, @sagl/server on npm, for Linux x64 and Windows x64 (npm install @sagl/server). To work on SAGL itself, build it from node/ in this repository instead (npm run build there builds the native addon and the TypeScript).
  • Players need GTA San Andreas (v1.0 US) with the SAGL client installed; scripts/package-client.sh builds the client package.

Running the example

The repository has an example gamemode, examples/freeroam:

cd node && npm install && npm run build
cd ../examples/freeroam && npm install && npm start

It listens on UDP port 7777.

Versions

SAGL's client, server and SDK share one version. Clients and servers of the same minor version (0.4.x) always work together: a new minor version changes the network protocol, so update your server and your players' clients together. "@sagl/server": "^0.4.0" in a gamemode's package.json takes the fixes of 0.4.x but not 0.5. Prereleases, built from every change, are npm install @sagl/server@next. Players connect by putting the server in their sagl.ini: %LOCALAPPDATA%\SAGL\sagl.ini, where the client keeps everything it writes (settings, key bindings, logs and each server's downloaded files), so the game folder can stay read-only. The first time the game starts, that file is copied from the one installed in the game's sagl\ folder:

[client]
host = 127.0.0.1
port = 7777
name = YourName

The standalone server

build/server/server/sagl-server is a server with no gamemode: players can join and drive about. Useful for testing the client.

sagl-server [--port N] [--name NAME] [--max-players N] [--time HH:MM]
            [--freeze-time | --run-time] [--money N] [--weather N]
            [--proxy IP]... [--client-files DIR]

Next: write your first gamemode.