This repository hosts my submission for https://js13kgames.com/.
There are several versions of the game:
- Official version: https://js13kgames.com/entries/yellow-and-blue (the description page, the game itself is the deployed version below)
- Development version: https://schnark.github.io/js13kgames-2022/
- Debug version for 2 players: https://schnark.github.io/js13kgames-2022/iframe-debug.html
- Minified version: https://schnark.github.io/js13kgames-2022/public/
- Deployed version: https://yellow-and-blue.herokuapp.com/
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
andtest
folders (including their contents), as well as the files.gitignore
,index.js
,package.json
,package-lock.json
, andProcfile
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
andgame-lib/index.html
). - The contents of the
public
folder are generated by my build system.public/server.js
is a minified version ofgame-lib/server.js
,public/index.html
is generated fromindex.html
by minifying and inlining all resources (includinggame-lib/client.js
).dist.zip
is generated from thepublic
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 fromindex.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 forgame-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.