/tanks

Primary LanguageJavaScriptMIT LicenseMIT

Tanks VR

Battle your friends in virtual tanks on any device! Play now at www.bubbletanks.biz screen shot

Tanks is a multiplayer virtual reality game built with A-Frame VR, React, Express, and Socket.io. The connections between clients, the server, and the simulation are shown in this architecture diagram: architecture diagram

Requirements

Setup server

This project is setup to be developed and run either locally, or on a local or deployed docker-machine. Running the app via Docker will ensure a consistent environment across computers and is therefore recommended.

Docker

Docker provides a means of packaging applications and their relevant dependencies into blank Linux 'containers' to ensure consistency between development and production environments.

'Dockerfile' provides instructions for how to build the app image and install dependencies

Use the following instructions to run the Wiki Museum server via docker:

Step 1: Install Docker

If you don't have it already, you will need to install the Docker toolbox. This will enable you to setup Docker machines, build Docker images, and compose containers.

Step 2: Select docker-machine

$ docker-machine ls

The machine marked with an asterix is currently active. To select a docker-machine, run

$ eval $(docker-machine env [name of docker-machine]))

Step 3: Build Docker image

The Dockerfile provides instructions on how to build the docker image (and ultimately run the container). Run the following in the command line to build the image

$ npm run build

Step 4: Run Docker container

Running the container will execute the command in the CMD line of the Dockerfile. To run the container based on the newly-built images, run the following:

$ npm run deploy

To see running containers on your docker-machine:

$ docker ps

Use the '-a' flag to view all containers, as opposed to just those which are running.

To see the most recent logs from a container process, run

$ docker logs [container ID]

Step 5: Remove container and image to rebuild

If you make changes to the server code, you will need to destroy the existing Thumbroll container and image to allow Docker to rebuild. The postgres container and image do not need to be removed.

To see all containers on the docker-machine:

$ docker ps -a

To force stop and delete a container:

$ docker rm -f [container id]

To see all images on the docker-machine:

$ docker images

To remove an image:

$ docker rmi [imageID]

Local

Instead of running the server within Docker containers, the server may also be run locally.

Step 1: Install dependencies

$ npm install

Step 2: Install Webpack

$ npm install -g webpack

Step 3: Run server

$ npm start