Skip to content

Commit

Permalink
package things nicely, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
kentywang committed Aug 12, 2023
1 parent a2af8be commit 3ffde6b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 50 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*node_modules*
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,28 @@ Handling of the game logic is distributed between the client and the server. Cli
- Players farther ahead in volume gain volume from objects at a slower rate. To keep their lead, hunting other players is a more efficient tactic.
- The larger you are, the heavier and more unwieldly you become, making movement more cumbersome. Be aware of what and how you pick up different objects and players.

### Installation
To install Agamari on your computer, you will need [Node.js with NPM](https://nodejs.org/en/download/) and [PostgreSQL](http://postgresguide.com/setup/install.html).
### Running locally
The simplest way to have Agamari running locally is to have Docker. Simply do

Once you have Node.js with NPM, install the game's dependencies with the following command:

```js
npm install
```
docker-compose up
```

to start the both app container and db container, and then access the game at `http://localhost:8000`.

When the dependencies have been installed, open PostgreSQL and create a database with the following command:
### Local development
To do local development, you can run Agamari on your computer without Docker, but you will need [Node.js with NPM](https://nodejs.org/en/download/) and [PostgreSQL](http://postgresguide.com/setup/install.html).

```SQL
CREATE DATABASE agamari;
Once you have Node.js with NPM installed and Postgres installed and running on port `5432`, install the game's dependencies with the following command:

```
npm install
```

Then start the server with the following command:

```js
npm start
```
npm run dev
```

The game will then be accessible at `http://localhost:8000`.
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ services:
container_name: agamari-api
build:
context: ./
target: production
image: agamari
depends_on:
- db
Expand Down
38 changes: 0 additions & 38 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const express = require('express');
const path = require('path');
const chalk = require('chalk');
const http = require('http');
const store = require('./store');
const setUpListeners = require('./game/listeners');
const { broadcastState } = require('./game/engine');

Expand Down Expand Up @@ -35,41 +34,4 @@ require(path.join(__dirname, 'db')).db.authenticate()
})
.catch(console.error);

// keep server from falling asleep
setInterval(function() {
// drop previous tables so we don't ever run out of usable rows
require(path.join(__dirname, 'db')).Bug.destroy({
where: {},
truncate: true,
cascade: true,
});
require(path.join(__dirname, 'db')).Event.destroy({
where: {},
truncate: true,
cascade: true,
});
require(path.join(__dirname, 'db')).Player.destroy({
where: {},
truncate: true,
cascade: true,
});
require(path.join(__dirname, 'db')).Score.destroy({
where: {},
truncate: true,
cascade: true,
});
require(path.join(__dirname, 'db')).User.destroy({
where: {},
truncate: true,
cascade: true,
});
require(path.join(__dirname, 'db')).World.destroy({
where: {},
truncate: true,
cascade: true,
});

// http.get("http://agamari.herokuapp.com"); // fire ping
}, 300000); // every 5 minutes (300000)

module.exports = app;

0 comments on commit 3ffde6b

Please # to comment.