Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Tutorials ― setup

Merlijn edited this page Jul 30, 2022 · 13 revisions

Requirements

Software

It should run on most operating systems that are capable of running Node.js, but the following have been tested:

  • Windows 10
  • Debian 9 (GNU/Linux)
  • Fedora 30 (GNU/Linux)
  • Manjaro 18.1 (GNU/Linux)

You will need Node.js and the yarn package manager.

Hardware

These are ballpark figures, but a recommended minimum would be the following (for a dedicated / virtual server):

  • 1 vCPU
  • 1GB RAM
  • 1GB storage
  • High bandwidth network (preferably gigabit)

This will support up to 100 marbles on a decent sized map.

The $4 droplet does not seem to have enough memory to run it, unfortunately. The $6 droplet on DigitalOcean suffices, but more CPU and RAM are welcome for larger maps & player counts.

Discord API

The Discord API is optional for development (config.discord.enabled), but we would recommend setting it up for the full experience. You can create and configure your project here: https://discordapp.com/developers/applications/
Be sure to add the following to your OAuth2 redirects:

http://localhost:3004/chat

Download & run the project

Start off by downloading or cloning this repository to any location on your device.

Before you can run the project, you must first download any dependencies using the following command yarn. This will automatically download and install any required dependencies. If you receive any errors during this step, please refer to the module that fails to install. (better-sqlite3 will likely fail if you are installing it on Windows, troubleshooting steps can be found here)

Configuration files

You must also set up configuration files. The project comes with examples that you must copy over and remove the example-part of the filename from e.g. config.user.example.js becomes config.user.js. You must do so in the following locations:

  • \src\server
  • \src\client

Most variables are self explanatory.
For the server configuration specifically, most Discord values are required.

NOTE: Not all variables are currently used.

Building scripts

As an additional step, client scripts are bundled using webpack. There are several benefits to doing this, but explaining those is out of the scope of this tutorial. Simply run yarn build to bundle all client scripts.
You will need to run this every time you change a client script and wish to test your changes.

Running the project

If you have followed all steps above, you should be ready to start the application! Start it using the following command: yarn start. This will launch a web server on port 3004 (unless you have changed this in the config file) which you can reach at localhost:3004 in the web browser of your liking.

Additional configuration

nginx

To make sure websockets work correctly when using nginx, add the following to your location / section:

proxy_http_version 1.1;
proxy_read_timeout 3600s;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;