gro-ove / ac-server-wrapper

Wraps around Assetto Corsa server, caches and extends responses
Other
19 stars 4 forks source link

ac-server-wrapper

Small Node.JS script which wraps around Assetto Corsa server and then caches and extends responses.

TODO

Features

Usage

Requirements

For Windows, you can get both of them (they are shipped together) here.

Installation
npm install ac-server-wrapper -g

With flag -g, this command will make ac-server-wrapper available system-wide.

Update
npm update ac-server-wrapper -g

Since it’s still very much WIP, please, update it frequently.

Configuration

Open server preset’s directory (usually, it’s called something like “SERVER_00”) and add a file cm_wrapper_params.json, here is an example:

{
  /* Optional description for clients, */
  "description": "Server description.",

  /* Port, at which wrapping HTTP-server will be running. Don’t forget to open it. 
   * Also, it should be a unique port, not the one from AC server’s config! */
  "port": 8050,

  /* Print AC server output to the log. */
  "verboseLog": true,

  /* Limit download speed to keep online smooth. Set to 0 to avoid limiting. Just in case,
   * 1e6 is about 1 MB per second */
  "downloadSpeedLimit": 1e6,

  /* Do not allow to download content without a password (if set). */
  "downloadPasswordOnly": true,

  /* Publish password checksum so clients’ software would be able to check if password is valid 
   * or not without connecting. Checksum is generated using SHA-1 algorithm with a salt, so it should be safe. */
  "publishPasswordChecksum": true,
}

To allow clients download missing content, add next to it a directory called cm_content, and put inside file content.json:

{
  "cars": {
    "<CAR_1_ID>": {
      "version": "0.9.9",
      …
      "skins": {
        "<SKIN_1_ID>": { … }
      }
    },
    {
    "<CAR_2_ID>": { … }
  },
  "weather": {
    "<WEATHER_1_ID>": { … },
    "<WEATHER_2_ID>": { … }
  },
  "track": { … }
}

Instead of “…”, either put "url": "<URL_TO_DOWNLOAD>" if you want users to download content from somewhere else or "file": "<FILE_NAME>" if package with missing thing is located in cm_content directory. Property "version" is optional.

Here is a server preset example, if needed. Sorry about the inconvinience, some UI is in progress.

Running server with prepared preset
  1. Go to server’s directory, the one in which acServer executable is located;

    For Windows, you could either use cd /D <DIRECTORY PATH> in any CMD window or open it with Windows Explorer, open context menu while holding Shift and select a specific menu item.

  2. To start the server, use: ac-server-wrapper presets/<PRESET ID> (for example, ac-server-wrapper presets/SERVER_EXT);

  3. That’s all! Now, server should be running.

If needed, you can run it from any other directory, just don’t forget to specify full path to the preset and acServer executable location with --executable=<PATH> argument. Also, if you’re running server in some VDS and want to keep it running in background, you could use forever. But I’m not really familiar with Linux, and with Node.JS, there might be better ways.

Running latest version from GitHub (git required)
git clone https://github.com/gro-ove/ac-server-wrapper.git
cd ac-server-wrapper
npm install
node ac-server-wrapper.js -e <AC SERVER DIR>/acServer <AC SERVER DIR>/presets/PRESET

In action

Notes