Migrating a RAGE MP game mode to SixL
SixL's scripting API follows RAGE MP's (mp.*), so most of a RAGE MP mode runs as it is. Some members are not there yet, and some behave differently because GTA VI is not GTA V. This guide says which is which, so you can estimate a port before you start it.
It describes the current development version. What changed since the last release is in the release notes. The exact state of every member is in the API status table, and every member's description is in the API reference: a member this guide does not mention is not promised to work until you have looked it up there.
How to read the status
mpandSixLare the same object. A RAGE MP script'smp.*calls run unchanged where the member is implemented.- Every member has a status in the API status table:
- done: implemented, with the behaviour RAGE MP documents (a difference, if there is one, is listed below);
- partial: implemented with a limit or a difference, written in the member's remarks in the reference;
- todo: not implemented yet; it is not in the typings, so a TypeScript build tells you;
- not applicable: does not apply to SixL (for example, running arbitrary code on a client).
- The table also says how each member was checked: in the game (a scenario or a frame), on a real server with test clients, by unit tests, or not yet. A member that nobody has run is written to RAGE MP's behaviour but unverified: test what your mode depends on.
- Totals today. Server: 158 done, 151 partial, 7 todo, 20 not applicable. Client (without
mp.game): 216 done, 266 partial, 974 todo, 22 not applicable. A server mode is the better-supported port; the client API is the smaller part. - The server typings and the client typings are separate, as in RAGE MP.
mp.gameexists on the client only.
What works
Server
| Area | State | What to know |
|---|---|---|
mp.events (add, addCommand, addProc, call, remove, reset, getAllOf, binded) | done | delayInitialization and delayShutdown are fields that delay nothing: the server does not wait for them. |
mp.players | done, some members partial | Join, spawn, health, armour, position, heading, dimension, weapons, clothes, props, head blend and face features, kick, ban, notify, chat output, calls to clients and procedures (callProc). The partial members are listed below. |
mp.vehicles | mostly partial | Create, destroy, position, heading, dimension, occupants, velocity, lock, repair, explode, trailers, mods, colours. Most properties are stored and sent to the clients as data; what the game shows is described below. |
mp.colshapes | done | newSphere, newCircle, newCuboid, newRectangle, newTube, isPointWithin, shapeType. Use the new* functions: RAGE MP has no new mp.Colshape() either. |
mp.dummies, mp.world (time, requestIpl, removeIpl), mp.config, mp.network, mp.Vector3, mp.joaat | done or partial | mp.world.weather, setWeatherTransition and trafficLights reach the clients and the scripts but do not change the game yet. |
Entity pools (at, exists, forEach, forEachFast, forEachInRange, forEachInDimension, getClosest, getClosestInDimension, apply, toArray, length, size) and entity members (id, type, position, dimension, data, getVariable, setVariable, setVariables, the own-variable forms, dist, destroy) | done | The same names and results as in RAGE MP. |
mp.blips, mp.markers, mp.labels, mp.checkpoints, mp.peds, mp.objects | partial | Created, kept and streamed to the clients; what the game draws is limited (see below). |
Client
The client API is smaller. What is there:
| Area | State | What to know |
|---|---|---|
mp.events (add, remove, call, callRemote, callRemoteProc, addProc, addDataHandler, new mp.Event) | done | callRemoteUnreliable is delivered reliably. cancelPendingProc and hasPendingProc are todo. |
mp.keys (bind, unbind, isDown, isUp), mp.storage, mp.console | done | Key codes are Windows virtual-key codes. mp.console.verbosity filters the mp.console lines below it; clear and reset do nothing (there is no in-game console). |
mp.gui.chat | done | The built-in chat: T opens it, messages and /commands go to the server. Formatting and history are not finished. |
mp.gui.cursor, mp.browsers | partial | Pages run in an overlay: new, url, active, call, execute, reload, destroy, markAsChat. Headless textures, injected mouse input, callProc and executeCached are todo. |
mp.players.local and the player's name, heading, health, armour, vehicle | done or partial | health and armour are read-only and exist for the local player only; vehicle is { handle } or null, not a VehicleMp. Most other client player members are todo. |
mp.cameras and mp.game.cam | done or partial | Script cameras (create, position, rotation, field of view, point at, activate, render) and the screen fade. |
mp.blips, mp.markers, mp.labels, mp.checkpoints | done or partial | The client reads what the server sent: position, scale, visibility, text, colour, dimension, data. Their setters on the client are mostly todo. |
Entity pools, mp.Vector3 | done | mp.Vector3 has the same differences as on the server (below). |
mp.game is the client's way into the game, in RAGE MP's section layout (mp.game.vehicle, mp.game.ped, mp.game.task and so on). About 900 of its 5716 members are done today; the best covered sections are ped, vehicle, task, entity, graphics, hud, player, audio and streaming. The members RAGE MP leaves unnamed are not part of SixL and will not be added.
The screen fade: mp.game.cam.doScreenFadeOut(ms) and doScreenFadeIn(ms) fade the screen to black and back (0 is at once). isScreenFadedOut(), isScreenFadedIn(), isScreenFadingOut() and isScreenFadingIn() answer at once, not with a Promise, and report the screen's real state, including the fades the game starts itself.
What does not work yet
Server
| Member | Status |
|---|---|
PlayerMp.weaponAmmo | partial: the ammo the server gave for the weapon in hand; it does not fall as the player shoots |
new mp.Colshape() | not applicable: RAGE MP has no public constructor either; use mp.colshapes.newSphere and the other new* functions |
PedMp.controller | not applicable: server peds are moved only by the server, no player controls them (undefined) |
The event playerReachWaypoint | partial: raised from the player's client (the waypoint gone with the player within 50 m) while it is connected and its runtime runs; the client asks once a second, no client script needed |
The events trailerAttached, vehicleSirenToggle | partial: from the driver's reported state, not yet confirmed in the game; trailerAttached names only a server vehicle and is also raised with null when the trailer is let go |
The event vehicleHornToggle | todo: GTA VI has no horn query SixL can use |
PlayerMp.eval, PlayerMp.invoke | not applicable: no code runs on a client from the server |
new mp.Player(), mp.config.csharp, mp.config.encryption | not applicable: players are made by a connection; the two config keys exist and are always false |
Partial player members that give a fixed or estimated answer, so do not build rules on them:
| Member | Answer |
|---|---|
isClimbing, isEnteringVehicle, isLeavingVehicle, isInCover, isInMelee, isOnLadder, action, aimTarget | always false, '' or null: the client does not report them |
isJumping | follows the client's state, which does not report a jump yet |
gameType | the constant SixL |
serial | a hardware serial the client computes (64 hex characters, the same on every SixL server); a modified client can forge it. rgscId and socialClub do not exist: GTA VI has no Social Club |
isStreamed, VehicleMp.isStreamed, streamedPlayers of a vehicle | an estimate by distance (the server's streaming range, 200 m by default), not the real stream list |
playAnimation, playScenario, stopAnimation | remembered on the server only; no client plays them yet |
putIntoVehicle, removeFromVehicle | change the server's seat state only; the client is not moved, and its next report overrides the change |
weapons, allWeapons | built from the script's own giveWeapon calls; weapons the player picks up are not seen |
ban | in memory only: forgotten when the server restarts |
disableOutgoingSync | the flag is kept, nothing reads it yet |
eyeColor, hairColor, hairHighlightColor, the head-blend shape and skin fields | stored and sent to the clients as data; the game does not show them yet |
callUnreliable and its pool forms | delivered reliably |
Client
Of the client members (without mp.game), 974 are todo. The biggest groups are the shared ped members, the vehicle members, the player members and the shared entity members; many of them are covered in part by mp.game.*. Whole client namespaces that are todo include mp.voiceChat, mp.raycasting, mp.nametags, mp.system, mp.user, mp.colshapes, mp.peds, mp.dummies, and most of mp.gui apart from the chat and the cursor.
What differs from RAGE MP
Client getters answer with a Promise when the game holds the value
On the client, a member that reads a value from the game returns a Promise, where RAGE MP answers at once. Members answered from the client's own copy (a player's snapshot, position, entity variables) and the camera and screen-fade getters answer at once. The remarks of each member in the reference say which. mp.game getters behave the same way, and vectors from the game come as plain { x, y, z }, not Vector3.
// RAGE MP (client)
const alpha = player.getAlpha();
// SixL (client)
const alpha = await player.getAlpha();
A render handler that reads the game every frame has to be an async function, or keep its own cache.
Models: 64-bit keys, and GTA V names do not resolve
GTA VI identifies models by a 64-bit key. A GTA V model name (of a car, a prop or a weapon) does not select a GTA VI model, and a 32-bit hash of one (mp.joaat of such a name) does not either. Use a GTA VI name or key that you have checked in the game; a key is written 0x and 16 hex digits, as a string or a number, and is taken as it is. A model argument to mp.vehicles.new, mp.peds.new and mp.objects.new takes a name, a hash or such a key.
entity.model of a vehicle, ped or object is the model as it was given at creation (a name; an unknown hash becomes its decimal string). A player's model is a number. Setting a player's model reaches the client; setting it on a vehicle, ped or object changes the server's copy and raises entityModelChange, but is not sent to the clients yet. Weapons are GTA VI hashes too: giveWeapon, removeWeapon, getWeaponAmmo and setWeaponAmmo take the numeric hash.
Blips
A GTA VI blip has a style rather than a sprite id, and its colour is a modifier. Colours and sprites are GTA VI values: RAGE MP's (GTA V's) colour and sprite ids are not translated. The server keeps and streams every blip property; the game shows the position, the scale and the style, while the name, alpha, draw distance and the route to a blip are sent but not shown yet. On the client a blip's type, position, dimension and handle are read-only.
A destroyed object is hidden
The game cannot free an object, so destroy() hides it. For vehicles, peds and objects the entity is gone from its pool as soon as destroy() returns (exists is false), and entityDestroyed follows. Players cannot be destroyed: use kick().
Vehicle health and properties
bodyHealth and engineHealth start at 1000 (full), the range RAGE MP scripts expect, but they are not limited to 0: explode() sets engineHealth to -4000. Write a "destroyed" check as health <= 0, never === 0. Reading gives the health the driver's client reports; writing is stored on the server and is not applied in the game yet. A drop raises vehicleDamage; vehicleDeath fires once per death (the vehicle's dead flag, which a script reads but does not set). spawn() and repair() set the health back to 1000.
Vehicle properties that reach the game today: the lock, movable (frozen), the engine, the high beams, the siren, repair, explode and trailers. Colours, mods, extras, neon, livery, window tint, the number plate and the like are stored and sent to the clients as data, but not shown yet.
Creation options: only some are read
| Call | Read | Not read |
|---|---|---|
mp.vehicles.new | heading, dimension, numberPlate | alpha, color, color1, color2, engine, locked: set the properties after creation. The plate is not shown in the game yet. |
mp.peds.new | heading, invincible, frozen, dimension | dynamic, lockController |
mp.objects.new | rotation, dimension | alpha. Only the yaw (z) of the rotation is applied in the game, once, when the object is created. |
Other differences (server and both sides)
| Member | Difference |
|---|---|
mp.Vector3 | max and min also take a vector (then they return a vector); toAngles returns a Vector3 (pitch, 0, heading in degrees), not RAGE MP's two numbers. normalize() and distance() are SixL additions. add, subtract, multiply, divide take a vector or a number, and angleTo returns radians, as in RAGE MP. |
EntityMp.type, ColshapeMp.shapeType | Plain strings ('vehicle', 'sphere'), where RAGE MP's typings use enums with the same values. |
MarkerMp.type, CheckpointMp.type | The kind of marker or checkpoint, a number, as given to mp.markers.new and mp.checkpoints.new. |
MarkerMp.direction, CheckpointMp.destination | A plain { x, y, z } object (or null), not a Vector3. |
TextLabelMp.color | Four numbers [r, g, b, a]. getColor and setColor are SixL additions. A checkpoint's colour is read and set with getColor and setColor only. |
PlayerMp.weapons | A list of { hash, ammo } built from your own giveWeapon calls, not RAGE MP's { current, reset() }. |
PlayerMp.getHeadOverlay | Returns the stored array, with the length the script set (RAGE MP: four). |
PlayerMp.setCustomization | No hair-highlight-colour parameter: faceFeatures is the 13th argument, RAGE MP's is the 14th. |
PlayerMpPool.call, callUnreliable | The form that takes an array of players first is not supported. |
VehicleMp.getPaint, extras, mods | getPaint returns { type, color }; extras is an object of extra id to boolean; mods is an object of mod slot to index. |
BlipMp.routeFor | The colour and scale arguments are not supported. |
mp.events | Handlers get no this.cancel: events cannot be cancelled. remove needs the handler (it does not clear every handler of a name). |
PlayerMp.look, PedMp.look, VehicleMp.look, PedMp.giveWeapon, PedMp.weapon, PlayerMp.language, PlayerMp.login | SixL additions: GTA VI outfits and paint recipes, a weapon for a ped, the player's language, the verified lobby login ('' for a guest). |
Other differences (client)
| Member | Difference |
|---|---|
PlayerMp.health, armour, heading | Read-only on the client: set them with setHealth, setArmour, setHeading. |
PlayerMp.vehicle | { handle } or null, not the VehicleMp instance. |
EntityMp.getQuaternion | Takes no arguments and returns { x, y, z, w }. |
| Labels, markers, checkpoints and blips | position, dimension, text, drawDistance, los and visible are read-only: only the server changes them. A label is drawn over walls (los is not applied). |
render | The handler gets no arguments: the nametag list RAGE MP passes is not computed. |
browserLoadingFailed | The handler also gets the address and the reason after the browser; a RAGE MP handler ignores them. |
mp.game | Some members differ in the shape of the result or the number of arguments: a result can be { result, value } where RAGE MP returns the bare value, getScreenCoordFromWorldCoord returns { x, y } in 0..1, and calls the game gives no answer to return nothing. Each member's remarks in the reference say how it differs. |
Events
The server and the client have separate event lists, as in RAGE MP. Server events cannot be cancelled, so a mode that vetoes with this.cancel needs a different design: validate before acting. The events page lists every event with its arguments; in short:
- Server, done:
playerJoin(the connection is made, before the client has loaded: do not spawn here),playerReady(the client has loaded: teleport orspawn()here),playerSpawn,playerQuit(exitTypeis'disconnect','timeout'or'kicked'),playerDeath,playerDamage,playerChat,playerCommand(only for a command with noaddCommandhandler),playerEnterVehicle,playerExitVehicle, the colshape and checkpoint events,playerStreamIn,playerStreamOut,vehicleDamage,vehicleDeath,entityCreated,entityDestroyed,entityModelChange,packagesLoaded,serverShutdown. - Server, partial:
incomingConnectionhas(ip, serial, login)(no Social Club fields; the connection cannot be refused from the handler),playerStartEnterVehicleandplayerStartExitVehicle,playerWeaponChange(GTA VI weapon hashes). - Server, SixL additions:
playerWeaponHitandpedWeaponHit(a hit a client reports: a request your script validates and applies),pedDamageandplayerHurt(the source of damage that happened),dummyEntityCreatedanddummyEntityDestroyed. - Server, todo:
vehicleHornToggle(GTA VI has no horn query SixL can use).trailerAttachedandvehicleSirenToggleare partial: from the driver's reported state, not yet confirmed in the game.playerReachWaypointis partial: raised from the player's client while it is connected (asked once a second, no client script needed). - Client, done:
playerReady,playerChat,playerCommand,browserCreated,browserDomReady,uncaughtException,unhandledRejection((promise, error), as in RAGE MP). - Client, partial:
entityStreamInandentityStreamOut(also for the server's blips, markers, labels and checkpoints),playerJoinandplayerQuit(only for players that come into or leave the client's range),playerEnterVehicleandplayerLeaveVehicle,playerDeathandplayerSpawn(the local player),incomingDamage,outgoingDamage,playerWeaponShot,render,browserLoadingFailed. - Client, todo:
click,consoleCommand,explosion,meleeActionDamage,projectile, the colshape, checkpoint and waypoint events,playerStartTalking,playerStopTalking,playerResurrect,playerRuleTriggered,entityControllerChange,dummyEntityCreated,dummyEntityDestroyed, the pause-menu events,replayEditorRequest. Do that work on the server, which raises the colshape, checkpoint and damage events.
Between the client and the server, player.call('name', [args]) and mp.events.callRemote('name', ...args) carry plain JSON values; a server handler receives the player first. Do not send entities or functions. mp.events.callRemoteProc returns a Promise that is rejected after 10 seconds without an answer.
Joining and ports
A RAGE MP conf.json does not carry over: SixL reads server.json (server configuration). A player's client first asks the server's TCP entry (gamePort, 31130 by default) for its information and a place, then plays over UDP on the port the server gives it. Open the ports as they are, with no remapping: the server tells the client which port to use. The ports and what to open are on the server configuration page.
Client scripts (RAGE MP's client_packages) are served by the same entry: the player's client downloads and checks them before it runs them (resources and packages).
Porting a typical mode
A mode is node/packages/<name>/index.js: the server loads every package at start and then raises packagesLoaded, as RAGE MP loads packages/<name>/index.js. Client scripts go to client_packages. The example package is a small working mode with both parts.
- Copy the mode in as it is. Put each RAGE MP package into
node/packages/<name>/and start the server.mp.events.add,mp.players,mp.vehicles,mp.Vector3and the entity members keep their names. Read the log for a thrown error before anything else.
- Spawn in
playerReady, notplayerJoin.``
js mp.events.add('playerReady', (player) => { player.position = new mp.Vector3(100, 200, 30); player.health = 75; player.setVariable('score', 7); player.call('welcome', [player.id]); });``playerJoinfires before the client has loaded.player.spawn(position)works too, andplayerSpawnfollows.
- Replace every model. A GTA V vehicle, prop or weapon name does not resolve in GTA VI: give a GTA VI name or key that you have checked in the game, then set what the creation options do not read, for example
car.locked = false.Redo everything tied to the GTA V map. GTA VI is a different map: every coordinate in the mode (spawn points, shops, garages, checkpoints, teleports, blips), every interior and every place name has to be found again in GTA VI. The mode's logic (commands, events, systems, databases) moves over; its places do not.
/posin the freeroam example prints where you stand, which helps to collect the new coordinates.
- Decide damage in the script. The game does not apply weapon damage for you: the server receives the hit a client reports, and your mode decides.
``
js mp.events.add('playerWeaponHit', (attacker, target, hit) => { target.health = Math.max(0, target.health - hit.damage); }); mp.events.add('playerDeath', (player, reason, killer) => player.call('died', [player.id]));``playerDeathhasreasonandkilleronly when a hit was reported in the 5 seconds before.
- Talk to the client with
callandcallRemote, and keep state in variables.player.setVariable('score', 7)andplayer.getVariable('score')work as in RAGE MP. A client handler is registered withmp.events.add('welcome', ...), and a client sendsmp.events.callRemote('addScore', 5).
- Commands and quitting.
``
js mp.events.addCommand('hp', (player, fullText, ...args) => { player.health = 100; }); mp.events.add('playerQuit', (player, exitType, reason) => { /* save */ });``A command with a handler does not raise
playerCommand.kick(reason)removes a player.
- Port the client scripts last. Move
client_packagesover, then look up every client member in the reference. Expect to addawaitto getters, and to replace voice and raycasting code, which is todo.
Name tags over players are drawn by the server: SixL draws no built-in name tags (mp.nametags is accepted and changes nothing). A mode can put a server text label with the player's name over each player and move it with the player. The freeroam example (server/examples/freeroam) does this.
Before you ship
- Every model name and every weapon hash in the mode is a GTA VI one.
- Every coordinate and interior of the mode is a GTA VI place.
- Every member the mode calls is done or partial in the API status table; a todo member is missing from the typings.
- Every event the mode uses is raised (the events page).
- No rule depends on a partial player member that gives a fixed answer, or on
this.cancel. - Every client getter that now answers with a Promise is awaited.
- The ports are open as they are, with no remapping.
- What the mode depends on and nobody has run yet is tested on a real server: the game is needed for what the player sees.