A simple library for Node and the browser that allows you to rapidly develop stateful, socketed multiplayer games and web applications.

Overview

gameroom.js

Overview

gameroom.js is a simple library for Node and the browser that allows you to rapidly develop stateful, socketed multiplayer games and web applications. Built with Socket.IO, gameroom.js allows you to run multiple named instances of a game or application on a single server, allowing clients to easily connect to and switch between these instances (or 'game rooms'). The library handles the basics of connection, authentication, and clean-up, allowing you to focus on your game or application logic.

gameroom.js consists of:

Games using gameroom-js

Quickstart

Server.ts

import express from "express";
import { ConnectionController } from "@gameroom-js/server";
import { MyGameRoom } from './MyGameRoom'

// use Express.JS or any other http server library (http, Koa, etc.) to create a server
const app = express();
const server = app.listen(3000);

// pass the server to a new ConnectionController
const connection = new ConnectionController(server);

// create a GameRoom and register it with the ConnectionController
const defaultGameRoom = new MyGameRoom({ gameRoomID: "Lobby" });
connection.registerGameRoom(defaultGameRoom);

index.ts

import {SocketConnection} from "@gameroom-js/client"

// create a new connection that will be used to communicate with the server via websockets
const connection = new SocketConnection({gameRoomID: "Lobby"});

// register listeners for roomState and gameState updates
connection.on("updateRoomState", (data) => {
  updateUIWithRoomState(data);
}
connection.on("updateGameState", (data) => {
  updateUIWithGameState(data);
}

// send Protocol, Action, and Transfer events
const clientStateButtonHandler = () => {
  connection.sendProtocol('REQUEST_CLIENT_STATE');
}
const nextTurnButtonHandler = () => {
  connection.sendAction('nextTurnPressed');
}
const formSubmitHandler = () => {
  connection.sendTransfer('updateClientName', {name: 'newName'});
}
You might also like...

It is an app that allows you to create lists of books and authors made in the course of Microverse. This project was develop using JavaScript, HTML and CSS.

AWESOME BOOKS This is an Awesome book store project that add store and diplay books on the UI. Built With HTML,CSS, JavaScript Frameworks Github, Lint

Jul 28, 2022

We are a group of videogame URJC students making a brand new Phaser3.0 browser multiplayer game. Come and support us!

COOKIE MAYHEM - JUEGOS EN RED Este proyecto está sujeto a cambios. Somos un grupo de estudiantes de Diseño y Desesarrollo de Videojuegos en la Univers

Dec 19, 2022

A tool that enables developers to connect multiple applications without the need to develop any interface.

Flooq A tool that enables developers to connect multiple applications without the need to develop any interface. Environments Env Service Status stagi

Jul 1, 2022

This is a development platform to quickly generate, develop & deploy smart contract based applications on StarkNet.

This is a development platform to quickly generate, develop & deploy smart contract based applications on StarkNet.

generator-starknet This is a development platform to quickly generate, develop, & deploy smart contract based apps on StarkNet. Installation First, in

Nov 18, 2022

A quotaless, partially limitless, and fast Node.js Multiplayer Piano server implementation that efficiently makes use of the protocol and uWebSockets.js

speedymppserver A quotaless, partially limitless, and fast Node.js Multiplayer Piano server implementation that efficiently makes use of the protocol

Oct 14, 2022

Quickly develop, deploy and test Solana programs from the browser.

Solana Playground SolPg allows you to quickly develop, deploy and test Solana programs(smart contracts) from the browser. Note SolPg is still in beta

Dec 29, 2022

rGUI is a GUI Library made for the GTA Multiplayer Modification RAGE:MP

rGUI is a GUI Library made for the GTA Multiplayer Modification RAGE:MP

rGUI - RAGE:MP A multifunctional GUI Library made for the GTA Multiplayer Modification RAGE:MP which is easy to use and understand. Will be updated fr

Jan 3, 2023

GameLand is an online gaming web application that allows users to view different kind of games available and share their views on each game.

GameLand is an online gaming web application that allows users to view different kind of games available and share their views on each game.

GameLand is an online gaming web application that allows users to view different kind of games available and share their views on each game.Users can like and make reservations to play online. Built with HTML/CSS , JAVASCRIPT,API.

Sep 9, 2022
Owner
Jackson Bierfeldt
I'm a fullstack web developer working mostly with Node.JS, Typescript, Vue and React. I'm currently looking for contract opportunities!
Jackson Bierfeldt
API, web and mobile application for finding a partner to play online multiplayer games.

Duo Finder Duo Finder is a simple mobile and web application for gamers looking for partners to play a game with. It's basics was developed during the

José Guilherme Fernandes Moura 2 Sep 20, 2022
A Parsimmon-like, stateful parser-combinator library with TypeScript.

terrario A Parsimmon-like, stateful parser-combinator library with TypeScript. Try it out! The terrario is a parser-combinator library inspired by PEG

marihachi 11 Dec 2, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Service Installer for VMware Tanzu is a one-click automation solution that enables VMware field engineers to easily and rapidly install, configure, and operate VMware Tanzu services across a variety of cloud infrastructures.

Service Installer for VMware Tanzu Service Installer for VMware Tanzu seeks to provide a one-click automation solution to enable our VMware engineers

VMware Tanzu 42 Dec 1, 2022
CLI tool to rapidly create setches with p5.js and Typescript

P5 Studio Table of matters Getting Started CLI Writing sketches Getting started Installation P5 Studio is available as a CLI, it is recommended to ins

Antoine 10 Nov 4, 2022
A toolkit to rapidly scaffold out a new tauri-apps project using the framework of their choice.

create-tauri-app Component Version create-tauri-app About Tauri Tauri is a polyglot and generic system that is very composable and allows engineers to

Tauri 408 Jan 4, 2023
Cindy Dorantes 12 Oct 18, 2022