Skip to content

js13kGames/yellow-and-blue

 
 

Repository files navigation

This repository hosts my submission for https://js13kgames.com/.

There are several versions of the game:

Note that the versions deployed on schnark.github.io only allow for games in single player mode. For two players the game must be run in the correct server environment, e.g. deployed on herokuapp.com. The debug version simulates the server, using two iframes on one page (not a very acurate test, but still useful for a quick look).

An overview over the contents:

  • The lib and test folders (including their contents), as well as the files .gitignore, index.js, package.json, package-lock.json, and Procfile come from js13kserver skeleton at https://github.com/js13kGames/js13kserver.
  • The game-lib folder and its contents I created for this game, but the library can be used independently for other games, and has a few features I actually don’t use in the game. It is not documented, though, but you should be able to figure out things by looking at the source and the simple test files (game-lib/test.js and game-lib/index.html).
  • The contents of the public folder are generated by my build system. public/server.js is a minified version of game-lib/server.js, public/index.html is generated from index.html by minifying and inlining all resources (including game-lib/client.js). dist.zip is generated from the public folder by zipping it.
  • All other files (especially those in the res folder) are the files created for the game itself. Note that the game may be run from index.html even without server (just as a file or from Github pages). Of course, in this case only the single-player mode is available. The same is true for game-lib/index.html.

A basic idea about how the library works:

  • The clients connect to the server, which puts them together in pairs and signals them when both are ready.
  • The clients then send all events to the server.
  • The server sends back all events to both clients.
  • The clients react to these events. Since both get the same events in the same order from the server, they are always in the same internal state, though they might have a different display for the different players.