/ai-battle-website

Run and replay game battles.

Primary LanguageJavaScript

Build Status

Javascript Fight Club

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.

Playing The Game

Visit https://jsfight.club to play the game. You do not need a copy of this repo to play.

Development

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.

Requirements

To work on this application, you must have the following installed:

Initial Setup

Database Setup

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

Configuration

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.

Dependency Installation

npm install
bower install

Add Database Tables

database/initialize.js
psql jsfightclub < ./node_modules/connect-pg-simple/table.sql

Running a Battle

Running battles does not require the web server in order to run.

To run a test battle:

node gamerunner/run-test-game.js

Starting the Web Server

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)

Changing the Website

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.