0.0.2 • Published 7 years ago

mh-game-kit v0.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
7 years ago

###Mangahigh HTML5 game starter kit

####Quick start npm init In package.json dependencies add mh-game-kit npm install mh-game-init

What this does:

  • Updates package.json with dev dependencies, scripts
  • Sets up webpack deps
  • Creates folder structure
  • Sets up basic scaffold:

    • Game wrapper for integration into Mangahigh launcher
    • Scaling management
    • Core game states (boot, preload, play)
    • Asset management (assetManifest, preload, atlas creation)
    • Game data and API management
    • Common UI elements
    • Translation management
    • Testing framework
    • Mock server for data testing
    • Build pipeline (webpack)

####To build:

  • You will need node and npm installed globally
  • Or run in node container - at MH towers run ./bin/dockerise.sh
  • Dev build (no minification): npm run build
  • Prod build : npm run full-build

####To serve:

  • Run static server from dist: e.g. python -m SimpleHTTPServer, http-server
  • Game options can be edited in index.html (see below)

####Translations

  • We use i18next to handle translations
  • Strings should be wrapped in i18nUtils.t()
  • Numbers should be wrapped in i18nUtils.formatNumber()
  • Can be scraped from the source code with npm run translate-get. This will create a set of json files in ./src/translations/pending.
  • Once these have the correct translations included, copy them to the main translations folder with npm run translate-import.

####Index.html gameVars These are passed to the game from the index page

  • baseUrl: URL for the Mangahigh API
  • resourceUrl:
  • locale: determines the local i18next will use
  • activityId: determines which challenge to start. Null should default to freeplay
  • gameId: the MH id for the game. Lite and full versions have different game ids.
  • userId: ths id for the user playing the game

####Mangahigh API

  • bin/devServer contains a mock server that will return stubs and debugging information
  • spin up with npm run dev-server
  • make sure game is using baseUrl https://localhost/8090

####Before deploy: All games are served from Mangahigh's 'Play' server. Source files are housed on that server and in that repo. Prior to deploying to Mangahigh's live or test server, game source code must be copied to the play server.

  • ./bin/copy-to-play.sh - copies to correct directories on Mangahigh's Play server