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

What works

Server

AreaStateWhat to know
mp.events (add, addCommand, addProc, call, remove, reset, getAllOf, binded)donedelayInitialization and delayShutdown are fields that delay nothing: the server does not wait for them.
mp.playersdone, some members partialJoin, 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.vehiclesmostly partialCreate, 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.colshapesdonenewSphere, 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.joaatdone or partialmp.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)doneThe same names and results as in RAGE MP.
mp.blips, mp.markers, mp.labels, mp.checkpoints, mp.peds, mp.objectspartialCreated, kept and streamed to the clients; what the game draws is limited (see below).

Client

The client API is smaller. What is there:

AreaStateWhat to know
mp.events (add, remove, call, callRemote, callRemoteProc, addProc, addDataHandler, new mp.Event)donecallRemoteUnreliable is delivered reliably. cancelPendingProc and hasPendingProc are todo.
mp.keys (bind, unbind, isDown, isUp), mp.storage, mp.consoledoneKey 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.chatdoneThe built-in chat: T opens it, messages and /commands go to the server. Formatting and history are not finished.
mp.gui.cursor, mp.browserspartialPages 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, vehicledone or partialhealth 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.camdone or partialScript cameras (create, position, rotation, field of view, point at, activate, render) and the screen fade.
mp.blips, mp.markers, mp.labels, mp.checkpointsdone or partialThe client reads what the server sent: position, scale, visibility, text, colour, dimension, data. Their setters on the client are mostly todo.
Entity pools, mp.Vector3donemp.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

MemberStatus
PlayerMp.weaponAmmopartial: 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.controllernot applicable: server peds are moved only by the server, no player controls them (undefined)
The event playerReachWaypointpartial: 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, vehicleSirenTogglepartial: 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 vehicleHornToggletodo: GTA VI has no horn query SixL can use
PlayerMp.eval, PlayerMp.invokenot applicable: no code runs on a client from the server
new mp.Player(), mp.config.csharp, mp.config.encryptionnot 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:

MemberAnswer
isClimbing, isEnteringVehicle, isLeavingVehicle, isInCover, isInMelee, isOnLadder, action, aimTargetalways false, '' or null: the client does not report them
isJumpingfollows the client's state, which does not report a jump yet
gameTypethe constant SixL
seriala 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 vehiclean estimate by distance (the server's streaming range, 200 m by default), not the real stream list
playAnimation, playScenario, stopAnimationremembered on the server only; no client plays them yet
putIntoVehicle, removeFromVehiclechange the server's seat state only; the client is not moved, and its next report overrides the change
weapons, allWeaponsbuilt from the script's own giveWeapon calls; weapons the player picks up are not seen
banin memory only: forgotten when the server restarts
disableOutgoingSyncthe flag is kept, nothing reads it yet
eyeColor, hairColor, hairHighlightColor, the head-blend shape and skin fieldsstored and sent to the clients as data; the game does not show them yet
callUnreliable and its pool formsdelivered 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

CallReadNot read
mp.vehicles.newheading, dimension, numberPlatealpha, color, color1, color2, engine, locked: set the properties after creation. The plate is not shown in the game yet.
mp.peds.newheading, invincible, frozen, dimensiondynamic, lockController
mp.objects.newrotation, dimensionalpha. Only the yaw (z) of the rotation is applied in the game, once, when the object is created.

Other differences (server and both sides)

MemberDifference
mp.Vector3max 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.shapeTypePlain strings ('vehicle', 'sphere'), where RAGE MP's typings use enums with the same values.
MarkerMp.type, CheckpointMp.typeThe kind of marker or checkpoint, a number, as given to mp.markers.new and mp.checkpoints.new.
MarkerMp.direction, CheckpointMp.destinationA plain { x, y, z } object (or null), not a Vector3.
TextLabelMp.colorFour 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.weaponsA list of { hash, ammo } built from your own giveWeapon calls, not RAGE MP's { current, reset() }.
PlayerMp.getHeadOverlayReturns the stored array, with the length the script set (RAGE MP: four).
PlayerMp.setCustomizationNo hair-highlight-colour parameter: faceFeatures is the 13th argument, RAGE MP's is the 14th.
PlayerMpPool.call, callUnreliableThe form that takes an array of players first is not supported.
VehicleMp.getPaint, extras, modsgetPaint returns { type, color }; extras is an object of extra id to boolean; mods is an object of mod slot to index.
BlipMp.routeForThe colour and scale arguments are not supported.
mp.eventsHandlers 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.loginSixL 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)

MemberDifference
PlayerMp.health, armour, headingRead-only on the client: set them with setHealth, setArmour, setHeading.
PlayerMp.vehicle{ handle } or null, not the VehicleMp instance.
EntityMp.getQuaternionTakes no arguments and returns { x, y, z, w }.
Labels, markers, checkpoints and blipsposition, dimension, text, drawDistance, los and visible are read-only: only the server changes them. A label is drawn over walls (los is not applied).
renderThe handler gets no arguments: the nametag list RAGE MP passes is not computed.
browserLoadingFailedThe handler also gets the address and the reason after the browser; a RAGE MP handler ignores them.
mp.gameSome 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:

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.

  1. 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.Vector3 and the entity members keep their names. Read the log for a thrown error before anything else.
  1. Spawn in playerReady, not playerJoin.

    ``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]); }); ``

    playerJoin fires before the client has loaded. player.spawn(position) works too, and playerSpawn follows.

  1. 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. /pos in the freeroam example prints where you stand, which helps to collect the new coordinates.

  1. 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])); ``

    playerDeath has reason and killer only when a hit was reported in the 5 seconds before.

  1. Talk to the client with call and callRemote, and keep state in variables. player.setVariable('score', 7) and player.getVariable('score') work as in RAGE MP. A client handler is registered with mp.events.add('welcome', ...), and a client sends mp.events.callRemote('addScore', 5).
  1. 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.

  1. Port the client scripts last. Move client_packages over, then look up every client member in the reference. Expect to add await to 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