From b2c10fda17c105957d8b75e4ccb47cc21d8882bf Mon Sep 17 00:00:00 2001 From: AlecM33 Date: Sat, 21 Jan 2023 19:23:49 -0500 Subject: [PATCH] update README --- README.md | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e4148f0..ff38800 100644 --- a/README.md +++ b/README.md @@ -20,16 +20,17 @@ This app is still being actively developed. Find the latest production deploymen ## Overview -An application to run games of Werewolf (Mafia) +A free, anonymous application to run games of Werewolf (Mafia) smoothly when you don't have a deck, or when you and your friends are together virtually. Basically, a host builds a game and deals a role to everyone's device, and then the app keeps track of the game state (timer, who is killed/revealed, etc). -Since people tend to have their own preferences when it comes to what roles they use or how they run the game, the app tries to take a generalized, flexible, hands-off approach - it won't run day and night for you and won't implement any role abilities. Hosts can use any roles they want, in any configuration, and can create their own roles if the provided ones don't meet their needs (though neutral/third-party roles are currently not supported - only good and evil). If you have a role that you think should be available by default, and that isn't already there, feel free to let me know. Otherwise, any roles you create will be saved in your cookies, or can be exported for use later. +Since people tend to have their own preferences when it comes to what roles they use or how they run the game, the app tries to take a generalized, flexible, hands-off approach - it won't run day and night for you and won't implement any role abilities. Hosts can use any roles they want, in any configuration, and can create their own roles if the provided ones don't meet their needs. + A good overview of usage can be found on the app's "How to Use" page: https://play-werewolf.app/how-to-use The app prioritizes responsiveness. A key scenario would be when a group is hanging out with only their phones. Inspired by my time playing Ultimate Werewolf and by -2020's quarantine. The app is free to use, anonymous, and fully open-source under the MIT license. After a long hiatus I've rewritten a lot of the code. This was (and still is) fundamentally a learning project, so feedback or assistance is appreciated. +2020's quarantine. After a long hiatus I've rewritten a lot of the code. This was (and still is) fundamentally a learning project, so feedback or assistance is appreciated. ## Features @@ -50,16 +51,26 @@ You can: This is a Node.js application. It is written purely using JavaScript/HTML/CSS, with no front-end framework. The main dependencies are Express.js and Socket.io. It runs as a containerized application -via Google Cloud Run. There is no data persisted in any database. +via Google Cloud Run. -In the event I need more scaling, I will likely integrate with a datastore like Redis. +There is no data persisted in any database. The app is almost entirely stateless, with instances kept in sync via +Redis, specifically with the pub/sub model. +The exceptions are Node.js child processes that are spawned to +keep track of games with a timer, which are stored in an instance's memory and communicated to other instances if needed. ## Contributing and Developers' Guide ### Running Locally The entrypoint for the application is `index.js` at the root. -If you haven't already, install Node.js. This should include the node package +Before starting the Node.js server, you'll need a Redis server running locally on the default port. This is what's used +to store active games and keep any number of Node.js servers in sync. I followed +this tutorial, specifically using the installation method that uses +Windows Subsystem for Linux (WSL), since I am on a windows machine. Once I got WSL installed and was in a linux environment +running in the powershell, I tested out the Redis server by using the Redis CLI +(see their getting started page). + +Once that's done, if you haven't already, install Node.js. This should include the node package manager, npm. Run `npm install` from the root directory to install the necessary dependencies. @@ -72,6 +83,8 @@ If you simply want to run the app on the default port of **5000**: `npm run start:dev` (if developing on a linux machine)
`npm run start:dev:windows` (if developing on a windows machine) +If everything is okay, you should see logs indicating a connection to Redis and a starting of the web server. + This command uses nodemon to listen for changes to **server-side code** (Node.js modules) and automatically restart the server. If you do not want this, run instead `npm run start:dev:no-hot-reload` or `npm run start:dev:windows:no-hot-reload`.