Pony Town

A game of ponies building a town

Prerequisites

Installation

npm install

Setting up OAuth keys

Get OAuth keys for authentication platform of your choice (github, google, twitter, facebook, vkontakte, patreon)

Configuration

Add config.json file in root directory with following content. You can use config-template.json as a starting point for your own config.

{
  "title": "Pony Town",
  "twitterLink": "https://twitter.com/<twitter_name>", // optional
  "supporterLink": "https://www.patreon.com/<patreon_name>", // optional
  "contactEmail": "<your_contact_email>",
  "port": 8090,
  "host": "http://localhost:8090/",
  "secret": "<some_random_string_here>",
  "token": "<some_random_string_here>",
  "db": "mongodb://<username>:<password>@localhost:27017/<database_name>",
  "analytics": { // optional google analytics
    "trackingID": "<tracking_id>"
  },
  "facebookAppId": "<facebook_id>", // optional facebook app link
  "assetsPath": "<path_to_graphics_assets>", // optional, for asset generation
  "oauth": {
        "google": {
            "clientID": "<CLIENT_ID_HERE>",
            "clientSecret": "<CLIENT_SECRET_HERE>"
        }
  },
  "servers": [
    {
      "id": "dev",
      "port": 8090,
      "path": "/s00/ws",
      "local": "localhost:8090",
      "name": "Dev server",
      "desc": "Development server",
      "flag": "test", // optional flag ("test", "star" or space separated list of country flags)
      "flags": { // optional feature flags
        "test": true, // test server
        "objects": true, // in-game editor
      },
      "alert": "18+", // optional 18+ alert (also blocks underage players)
    },
  ]
}

Running

Production environment

npm run build
npm start

Giving/removing roles

node cli.js --giverole <account_id> <role>   # roles: superadmin, admin, mod, dev 
node cli.js --removerole <account_id> <role>

To setup superadmin role use following command

node cli.js --giverole <your_account_id> superadmin

Admin panel is accessible at <base_url>/admin/ (requires admin or superadmin role to access)

Starting as multiple processes

1
2
3
4
node pony-town.js --login        # login server
node pony-town.js --game main    # game server 1 ('main' has to match id from config.json)
node pony-town.js --game safe    # game server 2 ('safe' has to match id from config.json)
node pony-town.js --admin --adm  # admin server

For these to work on the same URL, paths to game servers and admin server need to be bound to correct ports, using http proxy.

It is recommended to run processes with larger memory pool for large user bases (especially admin and game processes), example:

node --max_old_space_size=8192 pony-town.js --game main

Beta environment (with dev tools and in-development features)

npm run build-beta
node pony-town.js --login --admin --game --tools --beta

Running in development

1
2
3
4
npm run ts-watch    # terminal 1
npm run wds         # terminal 2
gulp dev            # terminal 3
gulp test           # terminal 4 (optional)
1
2
3
gulp dev --sprites  # run with generation of sprite sheets (use src/ts/tools/trigger.txt to trigger sprite generation without restarting gulp)
gulp dev --test     # run with tests
gulp dev --coverage # run with tests and code coverage

Customization

  • package.json - settings for title and description of the website
  • assets/images - logos and team avatars
  • favicons - icons
  • src/ts/common/constants.ts - global settings
  • src/ts/server/maps/* - maps configuration and setup
  • src/ts/server/start.ts - world setup
  • src/ts/client/credits - credits and contributors
  • src/style/partials/_variables.scss - page style configuration

Custom map introduction

  • src/ts/server/start.ts:35 - adding custom map to the world
  • src/ts/server/map/customMap.ts - commented introduction to customizing maps
Edit
Pub: 27 Aug 2019 16:44 UTC
Views: 32