This repository contains the code that powers the website. By forking this, you will be able to develop the site code, or use real (github player ai code) or test (just local versions of those scripts) data to generate a battle.
Visit https://jsfight.club to play the game. You do not need a copy of this repo to play.
Initial set-up can be avoided by using the provided Vagrant environment. See the Vagrant website for more information. If you're already set up with Vagrant, run vagrant up
, then vagrant ssh
, and navigate to the /vagrant directory. Once you're there, you can skip down to Dependency Installation for initial set-up.
To work on this application, you must have the following installed:
- Node.js 6.x minimum
- PostgreSQL 9.5 minimum
Run the following command and carefully follow the prompts to install PostgreSQL, create a user, and give that user permission to modify the jsfightclub
database. Simply read the output to know what to do at each step.
database/setup-postgres.sh
Next, copy the config file template so you can configure the application. This file will not be tracked, so you don't have to worry about accidentally committing your passwords and such.
cp config-template.js config.js
The most important pieces of information to add to config.js are the database user and database password. Everything else can be skipped for now.
npm install
bower install
database/initialize.js
psql jsfightclub < ./node_modules/connect-pg-simple/table.sql
Running battles does not require the web server in order to run.
To run a test battle:
node gamerunner/run-test-game.js
The website is not built automatically, but you can do so via the following command:
npm run build
You must build one time before starting the server in order to provide the game engine to the browser. After that, it is only necessary after making changes.
To start the server without connecting to Github, run:
node server.js --no-github
You can also run node server.js
with no options to show the help screen.
Once it's running, you can navigate to http://localhost:8080/ to view the site. (if you're using the Vagrant environment, navigate to http://localhost:4000/ instead)
You can view the "dev build" of the site at dev.html while the built version will be accessible from index.html. There are no pre-compilation steps for doing development via dev.html. Once you're happy with the dev version of the site, re-build it using npm run build
and verify that your changes are alive and well in the built version.