Online platform for The Resistance! Play the game.
We are actively developing a new re-write of ProAvalon on newPA branch. If you are interested in assisting, please make an issue and I will contact you!
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Other useful resources:
- Visual Studio Code, a code editor/IDE by Microsoft
- ConEmu (Windows program to open multiple cmds (terminals) in one window
- Clone (using git) a copy of the code:
> cd path/to/your/folder
> git clone https://github.com/vck3000/ProAvalon.git
- Set up the required environment variables on your machine:
Method 1: Set permanent environment variables on your machine:
MY_PLATFORM = "local"
MY_SECRET_KEY = "AnythingThatYouWant"
DATABASEURL = "mongodb://localhost/TheNewResistanceUsers"
Method 2: Create a file named .env
in the root directory with the following lines:
MY_PLATFORM=local
MY_SECRET_KEY=INSERT_ANYTHING_YOU_WANT_HERE
DATABASEURL=mongodb://localhost/TheNewResistanceUsers
-
Create the database in MongoDB:
- Create the folder
/data/db
(C:/data/db
on Windows). - Start the database:
> mongod
- Open a mongo shell (in a new terminal or command prompt):
> mongo
- Create the database:
> use TheNewResistanceUsers switched to db TheNewResistanceUsers
- Create the folder
-
Install Node modules
> npm install
- Optional: (This will install nodemon globally)
> npm install -g nodemon
> node app.js
Or with nodemon (automatically restarts the server when changes are saved):
> nodemon app.js
On the registration page, create an account ProNub with any password you like. Or you can edit the admins file and not stage it in your future commits.
This is a Node.js express application that is currently deployed on Heroku. There are three stages: Production (live server), Development/staging (master branch of this repo) and other Heroku servers for each pull request.
When a pull request is made, a Heroku server is generated with those changes. Testing can be done on that online server. I will find a way to provide the link when you make the pull request if possible.
After a pull request has been merged to master, it will be on the development server. When approved, I will promote it to the production server.
User authentication is handled by Passport.js and client-server communication is handled by Socket.io. They are combined by passport.socketio.
The server is run from app.js
.
Routes are all under the routes
folder. index.js
is the upper most layer (most broad).
After users log in, they are redirected to the lobby page where sockets/sockets.js
handles socket communication.
All scripts and stylesheets are under the assets folder.lobby.ejs
is perhaps the most complicated. I have broken the file down into smaller pieces and required them at the bottom of lobby.ejs
.
There is a server-wide cache of 30 minutes for all files. This helps cut down on data usage, while also solving the issue of certain iPhone devices "flashing" every game iteration (the browser would re-download each image every time before caching was introduced).
There is also a middleware
folder which contains useful functions mainly for authentication purposes on forums and profiles.
Other useful global functions can be found under the myFunctions
folder.
If you are new to coding and would like to help contribute, I highly recommend this course on Udemy made by Colt Steel. It gave me the starting nudge I needed to make this site. Small contributions are always welcome!
When contributing, please make a new branch and then make pull request. If you require any help, throw me a message through Discord or through the server. (Link to the server is included in this Github repository)
- Ref-rain and Hakha3 for their immense suppport and continuous user feedback for the site.