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
- Phaser example
- Highscore Board
All the issues and difficulties found during developmenmt are documented in the wiki.
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 containingDB_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 theclient/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 theclient/dist/index.html
and with that all the files bundled. Keep in mind to bundle them first withyarn build
.
The setup steps for deployment are documented in the wiki.
-
The code of this repository is licensed under MIT
-
Font: Olive's Font
-
Please checkout the Sound Licenses for further details.
- CSS: github.com/franciscop/picnic
- uWebSockets.js + sifrr-server
- Websocket Handling: github.com/uNetworking/uWebSockets.js
- FileServe: github.com/sifrr/sifrr-server
- ws + express
- Websocket Handling: github.com/websockets/ws
- FileServe: github.com/expressjs/express
- MongoDB Handling: github.com/Automattic/mongoose
- Game Engine: github.com/photonstorm/phaser