1
0
James Ketrenos ff35c7fbbc Add animations turn off
Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
2022-10-31 17:14:29 -07:00
2022-10-31 17:14:29 -07:00
2020-04-25 13:38:54 -07:00
2022-06-23 14:07:53 -07:00
2022-10-31 14:52:19 -07:00
2022-03-14 10:53:00 -07:00
2022-01-02 22:27:58 -08:00

Peddlers of Ketran

This project consists of both the front-end and back-end game API server.

The front-end is launched from the 'client' directory in development mode via 'npm start'. In production, you build it via 'npm build' and deploy the public front-end.

The back-end is launched out of the 'server' directory via 'npm start' and will bind to the default port 8930.

If you change the default port of the REST API server, you will need to change client/package.json's "proxy" value to reflect the new port change.

NOTE:

Board.js currently hard codes assetsPath and gamesPath to be absolute as the dynamic router and resource / asset loading isn't working correctly.

Building

Native

Prerequisites

sudo apt-get install -y nodejs npm python
sudo -E npm install --global npm@latest

In container

Architecture

skinparam componentStyle rectangle

component "Server" as server
component "Resources" as res
component "Client" as client
component "Game" as game
component "Player" as player

package "Game" as game {
  component Players as players
}

server <-> resource : serves to client
client <-> server
player <-> client
players -r-> player
server -> game

Ketr.Ketran REST API

POST /api/v1/game

Request

{}

Response

{
  gameId: id
  gameState: {
    tiles: []
  }
}

Configuring / installing

Build

git clone git.ketrenos.com:jketreno/peddlers-of-ketran.git
cd server
npm install
npm start &
cd ../client
npm install
npm start

Install

export BASEPATH=${PWD}
# Ensure sudo has password ready
sudo -l 
sudo rsync -avprl install/ /etc/
sudo touch /var/log/ketr-ketran.log
sudo chown system:adm /var/log/ketr-ketran.log
sudo systemctl daemon-reload
sudo systemctl restart rsyslogd
sudo systemctl restart logrotate
sudo systemctl restart ketr.ketran

Install the following into your nginx server configuration:

  location /ketr.ketran {
    root /var/www/ketrenos.com;
    index unresolvable-file-html.html;
    try_files $uri @index;
  }

  # This seperate location is so the no cache policy only applies to the index and nothing else.
  location @index {
    root /var/www/ketrenos.com/ketr.ketran;
    add_header Cache-Control no-cache;
    expires 0;
    try_files /index.html =404;
  }

  location /ketr.ketran/api {
    proxy_pass http://192.168.1.78:8930;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    proxy_pass_header Set-Cookie;
    proxy_pass_header P3P;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }

Add security tokens in ketr.ketran/config/local.json:

cat << EOF > config/local.json
{
  "tokens": [ {
    "$(whoami)": "$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;)"
  } ]
}
EOF

Launch

sudo systemctl start ketr.ketran

To test

New game

curl -k -s -X POST http://localhost:8930/ketr.ketran/api/v1/games/

Game status

curl -k -s -X GET http://localhost:8930/ketr.ketran/api/v1/games/:id

States

Chat is available at all times by registered players

Lobby

  • Register session+name
  • Register session with color
  • Unregister player+name from color
  • Roll dice for player position
  • Shuffle board
  • Set "Ready" for player
  • All ready? state == active

License attribution

The dice faces (dice-six-faces-*.svg) are Copyright https://delapouite.com/ and licensed as CC-BY-3.0.

Active

Description
No description provided
Readme 194 MiB
Languages
TypeScript 86.5%
JavaScript 5.8%
CSS 5.7%
Shell 0.9%
Dockerfile 0.6%
Other 0.5%