Skip to content

H0rn0chse/node-game-template

Repository files navigation

node-game-template

This project is a template for future game projects based on Node.js. It contains basic implementations for:

  • Easy to use Websocket wrapper for client/ server
  • PlayerData handling for the server
  • MongoDB Connection
  • Inactivity / logoff handling
  • Basic Webpack Configuration
  • Automated Deployment

Basic game relevant features:

  • Lobbies
    • Avatar Select
    • Level Select
    • Kick / Leave
    • Maximum size
  • Game example
    • Phaser example
      • Custom GameObjects
      • Custom ScenePlugins
    • Tiled levels with custom hitboxes
    • Synced in-game position
    • Sounds
    • Scoring
    • Results
  • Highscore Board

All the issues and difficulties found during developmenmt are documented in the wiki.

Local Setup

Because of the websocket library used this project uses yarn and needs additional efforts to be used in a npm only environment.

  • Install all dependencies via yarn install
  • Add a .env file containing DB_URL=<MongoDBConnectionString> replace the <MongoDBConnectionString> with the actual connection string provided by MongoDB.
  • Start local mode via yarn run startLocal. In the local mode the server serves the client/index-local.html and with that all the files in a unbundled way.
  • Start production mode via yarn start. In the production mode the server serves the client/dist/index.html and with that all the files bundled. Keep in mind to bundle them first with yarn build.

The setup steps for deployment are documented in the wiki.

Assets and Licenses

Libraries