Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/schnark/js13kgames-2022

Submission for the Js13kGames competition 2022
https://github.com/schnark/js13kgames-2022

js13k js13kgames js13kgames2022

Last synced: about 1 month ago
JSON representation

Submission for the Js13kGames competition 2022

Awesome Lists containing this project

README

        

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/~~ https://yellow-and-blue.onrender.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` 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.