{"id":16282417,"url":"https://github.com/jtpio/jammer","last_synced_at":"2025-08-04T06:40:33.065Z","repository":{"id":22601295,"uuid":"25943375","full_name":"jtpio/jammer","owner":"jtpio","description":"Minimalist game server for your game jam","archived":false,"fork":false,"pushed_at":"2017-11-25T21:12:06.000Z","size":69,"stargazers_count":26,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-28T22:35:22.406Z","etag":null,"topics":["game-jam","game-server","multiplayer"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jtpio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-29T21:58:12.000Z","updated_at":"2024-11-24T06:01:55.000Z","dependencies_parsed_at":"2022-07-27T03:02:14.388Z","dependency_job_id":null,"html_url":"https://github.com/jtpio/jammer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtpio%2Fjammer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtpio%2Fjammer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtpio%2Fjammer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtpio%2Fjammer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jtpio","download_url":"https://codeload.github.com/jtpio/jammer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244039202,"owners_count":20387835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["game-jam","game-server","multiplayer"],"created_at":"2024-10-10T19:10:35.704Z","updated_at":"2025-03-20T02:30:31.302Z","avatar_url":"https://github.com/jtpio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jammer - A server for your game jam\n\nJammer is a ready-to-use game server to speed up game creation in the context of game jams.\n\nIt is written in Javascript so it focuses on **web based** games.\n\nIt is designed for games with multiple players playing simultaneously on the same screen.\n\n## Usage\n\n### Docker\n\nTo run the server in a docker container, and mount your front-end files:\n\n\tdocker build -t $USER/jammer .\n\tdocker run -t --name=jammer -v /path/to/your/public/files:/app/public:ro -p 4321:4321 $USER/jammer\n\nDoing so, you only have to provide the files doing the client side work, and let node serve them. This is the easiest way to get started. Even though the server will run in a docker container, it is still possible to modify it and rebuild an image, in case you have specific requirements.\n\nThe files are served from the `/app/public` folder. So if you have two files named `game.html` and `player.html`, visit [localhost:4321/game.html](http://localhost:4321/game.html) to create a game instance and [localhost:4321/player.html](http://localhost:4321/player.html) to spawn up a player.\n\n### Install and run manually\n\nIt is also possible to run jammer manually by first installing node.js, and then:\n\n    npm install jammer -g\n\nFollowed by:\n\n    jammer\n\nThis will generate all the files you need in the current working directory and run *npm install* automatically:\n```\npublic/game.html\npublic/player.html\npublic/js/gameClient.js\npublic/js/gameServer.js\nserver.js\npackage.json\nnode_modules/\n```\n\nThen:\n\n    node server.js\n\nAnd you have a server listening on **port 4321**. To start the server listening on port 7890:\n\n    node server.js -p 7890\n\nTo generate the files at a specific path:\n\n    jammer /path/to/destination/\n\n## Documentation\n### Examples\nThe generated files include an example showing the basics.\n\n```\npublic/player.html\npublic/game.html\n```\n\nThey include or the Javascript files:\n```\npublic/js/gameClient.js\npublic/js/gameServer.js\n```\n\nThere is a global depedency on socket.io, so make sure to include it (see example).\n\n#### Game examples using jammer\n\n- [TwinFusion](https://github.com/jtpio/twin-fusion): made at a game jam, but using a previous version (different API).\n- [Squame](https://github.com/jtpio/squame): proof of concept for jammer.\n\n### GameServer\n\n``` js\nvar gameServer = new GameServer();\nvar players = {};\ngameServer.on('gameID', function (gameID) {\n    // display the game ID on screen for the players\n});\n\ngameServer.on('newPlayer', function (player) {\n    // player connected\n    var playerID = player.id;\n    players[playerID] = player; // save it for later use\n    player.x = Math.random() * 500;\n    player.y = Math.random() * 500;\n    player.size = 50;\n\n    // Player listeners\n    // Example of a player event: changeSize\n    player.on('changeSize', function (size) {\n        player.size = size || 50;\n    });\n\n    // Send command to the player\n    player.send('changeColor', '#FF0000');\n\n    player.on('disconnect', function () {\n        delete players[player.id];\n    });\n});\n```\n\n### GameClient\n\n``` js\nvar gameClient = new GameClient();\ngameClient.join(12); // join the game 12\n\ngameClient.on('joined', function () {\n    // player joined, do something with it, for example change the size\n    gameClient.send('changeSize', Math.random() * 100 + 100);\n});\n\ngameClient.on('changeColor', function (color) {\n  // change the color of the player\n});\n```\n\n## List of defaults events and actions\n### On the game side\n``` js\ngameServer.on('gameID', function (gameID) {\n    // Do something here to display the game ID on the screen for the players\n});\ngameServer.on('newPlayer', function (player) {\n    // A new player just joined, do something with the player object, store it for later use\n\n    // Default events for the player\n    player.on('disconnect', function () {\n        // Player disconnected, do something with, remove it from the game for example\n    });\n});\ngameServer.on('disconnect', function (player) {\n    // The game disconnected, could be due to network problems, display something to the players or die silently\n});\n```\n\n### On the player side\n``` js\n// join game number 2\ngameClient.join(2);\n\ngameClient.on('joined', function () {\n   // the player joined the game, display controller or anything else\n});\n```\n\n\n## Motivation\nA game jam is all about making a great game fast, so you shouldn't spend to much time in repetitive and time consuming tasks.\nIf you want to go for a multi-player game, you are going to spend quite a lot of time on the network part, testing it, debugging it.\n\n\nThis idea popped up after using [HappyFunTimes](https://github.com/greggman/HappyFunTimes) in a game jam. HappyFunTimes is great, but is limited to a local network. The missing part for us was to be able to put the game online to make it accessible by everyone.\nJammer uses game sessions to make it work with multiple game running at the same time.\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtpio%2Fjammer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjtpio%2Fjammer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtpio%2Fjammer/lists"}