{"id":23163037,"url":"https://github.com/script-js/firemp","last_synced_at":"2025-07-15T21:39:40.073Z","repository":{"id":267730777,"uuid":"902120164","full_name":"script-js/FireMP","owner":"script-js","description":"Multiplayer game library for Firebase Realtime Databases","archived":false,"fork":false,"pushed_at":"2024-12-27T22:44:39.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T05:14:29.058Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://script-js.github.io/FireMP/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/script-js.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-12T00:14:44.000Z","updated_at":"2024-12-27T22:44:43.000Z","dependencies_parsed_at":"2024-12-12T05:19:14.875Z","dependency_job_id":"0c974c1a-050a-4782-804a-7aef707ec15c","html_url":"https://github.com/script-js/FireMP","commit_stats":null,"previous_names":["script-js/firemp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/script-js%2FFireMP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/script-js%2FFireMP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/script-js%2FFireMP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/script-js%2FFireMP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/script-js","download_url":"https://codeload.github.com/script-js/FireMP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249028,"owners_count":20908202,"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":[],"created_at":"2024-12-18T00:15:42.915Z","updated_at":"2025-04-04T20:35:54.284Z","avatar_url":"https://github.com/script-js.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FireMP\r\n## A JavaScript library for creating multiplayer games using a Firebase Realtime Database\r\n### Demo\r\n[Client](https://script-js.github.io/FireMP/demo/client) | [Host](https://script-js.github.io/FireMP/demo/host)\r\n### Getting Started\r\n\r\n**1. Create your database**\r\n\r\n1. Create a Firebase Project\r\nGo to console.firebase.google.com and click Create a project.\r\n2. Add an app\r\nClick the small \u003c/\u003e icon on the home page and set up your app. Make sure you save the firebase config variable it gives you.\r\n3. Create a Realtime Database\r\nUnder the build tab in the sidebar, click Realtime Database. Click create database and go through the setup. Once you've set it up change the rules so they look like this:\r\n```\r\n{\r\n  \"rules\": {\r\n    \"gameid\": {\r\n    \".read\": true,\r\n    \".write\": true\r\n    }\r\n  }\r\n}\r\n```\r\n5. Add this code to your game (make sure to replace the firebaseConfig variable with the one from step 1):\r\n```\r\n\u003cscript type=\"module\"\u003e\r\n    import { initializeApp } from \"https://www.gstatic.com/firebasejs/10.8.0/firebase-app.js\";\r\n    import { getDatabase, ref, set, get, child, onValue } from \"https://www.gstatic.com/firebasejs/10.8.0/firebase-database.js\";\r\n    import { firemp } from \"https://script-js.github.io/FireMP/main.js\";\r\n\r\n        const firebaseConfig = \u003cYour Firebase Config Variable\u003e\r\n    // Initialize Firebase\r\n    const app = initializeApp(firebaseConfig); \r\n    firemp.registerFunctions(getDatabase, ref, set, get, child, onValue)\r\n\u003c/script\u003e\r\n```\r\n\r\n### createGame\r\nUsed to start a new game\r\n\r\nExample: \r\n```\r\nfiremp.createGame(function(gameid) {\r\n  alert(\"Game ID: \" + gameid)\r\n})\r\n```\r\n\r\n### endGame\r\nUsed to end the game\r\n\r\nExample:\r\n```\r\nfiremp.endGame()\r\n```\r\n\r\n### startGame\r\nUsed to start the game\r\n\r\nExample:\r\n```\r\nfiremp.startGame()\r\n```\r\n\r\n### joinGame\r\nAllows players to join the game\r\n\r\nExample:\r\n```\r\nvar playerName = prompt(\"Player Name\")\r\nvar gameId = prompt(\"Game ID\")\r\nfiremp.joinGame(gameId,playerName,function() {alert(\"Game Started\")},function() {alert(\"Game Over\")})\r\n```\r\n\r\n### leaveGame\r\nAllows a player to leave the game\r\n\r\nExample:\r\n```\r\nfiremp.leaveGame()\r\n```\r\n\r\n### listen\r\nListens for changes in a specified value\r\n\r\nExample:\r\n```\r\nfiremp.listen(\u003cValue Name\u003e,function(data) {alert(\"Value Data: \" + data)},function() {alert(\"Value Non-existent\")})\r\n```\r\n\r\n### send\r\nAdd or update a game value\r\n\r\nExample:\r\n```\r\nfiremp.send(\u003cValue Name\u003e,\u003cValue Data\u003e)\r\n```\r\n\r\n### remove\r\nRemove a game value\r\n\r\nExample:\r\n```\r\nfiremp.remove(\u003cValue Name\u003e)\r\n```\r\n\r\n### playerDataAdd\r\nAdd or update player data\r\n\r\nExample:\r\n```\r\nfiremp.playerDataAdd(\u003cValue Name\u003e,\u003cValue Data\u003e)\r\n```\r\n\r\n### playerDataRemove\r\nRemove player data\r\n\r\nExample:\r\n```\r\nfiremp.playerDataRemove(\u003cValue Name\u003e)\r\n```\r\n\r\n### getPlayerList\r\nGet a list of players in the game\r\nFires every time the player list changes\r\n\r\nExample:\r\n```\r\nfiremp.getPlayerList(function(players) {\r\n  alert(\"List of Players\" + players) // Outputs an array\r\n})\r\n```\r\n\r\n### removePlayer\r\nRemoves a player from the game\r\n\r\nExample:\r\n```\r\nfiremp.removePlayer(\u003cPlayer Name\u003e)\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscript-js%2Ffiremp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscript-js%2Ffiremp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscript-js%2Ffiremp/lists"}