Skip to content

Latest commit

 

History

History
44 lines (28 loc) · 2.14 KB

File metadata and controls

44 lines (28 loc) · 2.14 KB

Goblin Base Server

Clash of Cats game

It's an html5 game developed with Phaser engine and Goblin Base Server demonstrating capabilities of Backend profiles, leaderboards, matchmaking, and real-time PvP.

Check out the demo here: http://rmg-clocats-dev.goblinserver.com. It's PvP only so try to play with your friend or in different browsers.

Find out more about Goblin Base Server here: https://github.com/red-machine-games/goblin-base-server

Running

It runs with Webpack:

  • Configure config.js;
  • Install dependencies with npm i command;
  • Run as development version: $ cd ./clash-of-cats-game && webpack;
  • Modify index.html;
  • Build a production version: $ cd ./clash-of-cats-game && webpack --config "webpack.production.js". Get build from dist.

Net code

Pvp-related cloud function stored at cloudFunctions folder. Real-time networking is powered by a deterministic ping-pong model.

Here are some theses about net code to help you understand it better:

  • Deterministic model powered by Mersenne twister random to be synced for both players - common seed provided by backend;
  • The model implements time traveling: it means that you can place opponent input in past time what will change the present;
  • The model fully syncs with opponent every 2.5 secs;
  • The client sends ~10 direct messages per second to the opponent. Turns are used only for a game over announcement;
  • Check out deterministic model's code here: https://github.com/red-machine-games/clash-of-cats-game/blob/master/src/model/deterministicPong.js

All networking is done with js SDK (https://github.com/red-machine-games/goblin-javascript-asset)

Check out SDK exposure here: https://github.com/red-machine-games/clash-of-cats-game/blob/master/src/controllers/ControllerHowardResponsibleForNetworking.js

License

All code and code-related files are under MIT license.

All images, sounds, and music under CC BY-NC-ND