Documentation

Development 101

Make sure you installed the server and client before proceeding.

Available Languages

Right now, the Server supports Node.js v7.0.0. Client packages can use vanilla JavaScript (via the v8 Engine). User Interfaces can be created using Chromium Embedded Framework.

Server Structure

/client-packages/
/packages/
config.json
Server(.exe)
  • client-packages/: in this directory, you can put client-only packages. See the Package Structure below for more information.
  • packages/: server packages. they can include a client_package inside (see below).
  • config.json: the main configuration file for the Server
  • Server(.exe): the server binary

Packages

Both the Server and Client make use of Packages. Simply put, a Package is an isolated module of your gamemode. This makes it easy to use third-party modules (like a chat, for example) to be added to your server, requiring you to only drop the package in.

Examples for Beginners

If you are new to the whole JavaScript eco-system, we recommend just modifying the freeroam package at first (it ships with the Server download).

Bare Bones Package

You can find a bare package ready to use here: https://gitlab.nanos.io/jc3mp-packages/bare-minimum.

Package Structure

Each Package has to follow the structure below:

package.json
main.js
  • package.json: your Package configuration file. This file should be npm conform. See the package.json documentation for more detailed information.
  • main.js: while you can use a different entry point, the default start file for a package is always main.js. this is where you write your own script.

Having a Client Package inside your Server Package

for easier management of client and server packages, you can embed a Client Package into your Server Package. Just create a folder inside your Server Package named client_package with the structure mentioned above.

Make Sure that the name property in your package.json(server and clientside) match up! Otherwise the client package will not work.

Modifying Packages while the Server is running

The server does currently not hot-reload packages. This means that you have to restart either the Server or the Package when you modify it.

Be Aware of Changing your Client Package

When you modify your client package, you must reload it, otherwise new connections to the server will fail.

Restarting a Package

You can restart a package using the restart_package command in the server console.

Example

restart_package chat

This will restart the Package named chat. Check the following output for errors.

Stay informed

By becoming the newest member of our growing forums, we and hundreds of other players will always keep you up to date on everything JC3:MP related.