Skip to content

Server: Configuration

Mark Eliasen edited this page Feb 11, 2018 · 4 revisions

Server: Configuration

The config.json file generated first time you run the server, is where you specify most of the general logic for the server and game.

Composition

The default config file will look something like this.

{
    "mongo_db": "mongodb://localhost:27017/ptp",
    "redis_server": "//localhost:6379",
    "twitch": {
        "clientId": ""
    },
    "server": {
        "port": 8086,
        "certificate": {
            "cert": "",
            "key": "",
            "ca": ""
        }
    },
    "game": {
        "logout_timer": 5000,
        "defaultStats": {
            "health_max": 100,
            "money": 300,
            "bank": 0
        },
        "timers": [
            {
                "name": "autosave",
                "enabled": true,
                "interval": 10000
            },
            {
                "name": "newday",
                "enabled": true,
                "interval": 1800000
            }
        ],
        "playerCooldowns":  {
            "move": 0.3,
            "attack": 2.0,
            "aim": 1.0,
            "chat": 1.0,
            "faction_invite": 3.0,
            "skill_snoop": 10.0,
            "skill_hide": 30.0,
            "skill_search": 5.0
        }
    }
}

General Configuration

  • mongo_db: The mongoDB connection string. By default it will assume the database is on the same server.
  • redis_server: Disregard. Redis has not been implemented yet.
  • twitch.clientId: Your Twitch application client id. You can create a Twitch application here.
  • server.port: The port you want the server;s web socket server to listen on. Remember to update your client config to reflect the same port if required.
  • server.certificate.cert: Absolute path to your SSL certificate for your server.
  • server.certificate.key: Absolute path to your SSL certificate's private key.
  • server.certificate.ca: Absolute path to your SSL certificate's fullchain/bundle file.

Game Configuration

  • game.logout_timer: This is the amount of time in ms (1000ms per second) from the client disconnects, til there character is logged out from the game.
  • game.defaultStats: This is the default stats any new character starts with.
  • game.timers: This array contains any global game timers. Each object consists of the follow:
    • name: The name of the timer. You will need to define it in the onTimer method, in the ./game/game.js file.
    • enabled: Whether the timer is enabled or not.
    • interval: How often (in ms) the timer should trigger.
    • Important note: timers do not run when created. They will run first time after the first interval period.
  • game.playerCooldowns: These are the cooldown times for actions and related, for each character. The times are in seconds.
Clone this wiki locally