Giter Site home page Giter Site logo

boss-balloon's Introduction

TODO

iOS version does not load

Add score list to the UI

Need respawn timer on screen

Player respawn sometimes flakes out

Future:

  • Server selection in-game
  • User database
  • Chat

HOW-TO: Local Development

To set up a development environment:

npm update
npm run genkey
(accept all defaults)

Update server binary and run it locally:

npm run debug
npm run client
npm run testserver

Navigate to: https://localhost:8443/

To update client side, run these commands and refresh the browser:

npm run debug
npm run client

HOW-TO: Server Deployment

To update all of the servers to latest code, log into master server and run:

./scripts/deploy.sh

Server List

BossBalloon.io -> sf

DigitalOcean:

- sf: 165.232.141.94
- ny: 67.205.173.217
- lon: 188.166.156.97

Linode:

- jpn: 172.104.122.175
- aus: 192.53.169.160

SphereShooter.io BalloonShooter.io

HOW-TO: Server Setup

Add ~/.vimrc Add sf to ~/.ssh/authorized_keys sudo apt install nginx Remove default server from /etc/nginx/sites-enabled

Latest nvm/node:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

Restart shell here.

nvm install node
nvm install-latest-npm

Edit /etc/nginx/nginx.conf:

http { 
    ## 
    # Basic Settings 
    ## 
    include mime.types; 
    types { 
        application/wasm wasm; 
    }

UPDATE THE URLS!!!!😮 /etc/nginx/sites-available/bossballoon

server { 
    listen 80; 
    server_name *.bossballoon.io; 
    return 301 https://ny.bossballoon.io$request_uri; 
} 
server { 
    listen 443 ssl http2; 
    server_name *.bossballoon.io; 
    ssl_certificate /etc/nginx/certs/default.crt;
    ssl_certificate_key /etc/nginx/certs/default.key;
    root /var/www/bossballoon.io; 
    index index.html; 
}

Make symlink /etc/nginx/sites-enabled

https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-20-04

ufw allow 10000:30000/udp
ufw allow OpenSSH
ufw allow "Nginx Full"
ufw allow 8443/tcp
ufw enable
mkdir /etc/nginx/certs/
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/certs/default.key -out /etc/nginx/certs/default.crt
sudo systemctl restart nginx
sudo systemctl status nginx

on err:
sudo journalctl -fu nginx

Change domain:

certbot --nginx -d ny.bossballoon.io

Update the site file as below:

server { 
    listen 80; 
    server_name *.bossballoon.io; 
    return 301 https://ny.bossballoon.io$request_uri; 
} 
server { 
    listen 443 ssl http2; 
    server_name *.bossballoon.io; 
    ssl_certificate /etc/letsencrypt/live/ny.bossballoon.io/fullchain.pem; # managed by Certbot 
    ssl_certificate_key /etc/letsencrypt/live/ny.bossballoon.io/privkey.pem; # managed by Certbot 
    root /var/www/bossballoon.io; 
    index index.html; 
}

Nodejs setup:

apt install g++ cmake libssl-dev
npm install -g pm2

cd ~/server
npm install

Link the letsencrypt keys as ~/server/key.pem and ~/server/cert.pem

ln -s /etc/letsencrypt/live/ny.bossballoon.io/fullchain.pem ~/server/cert.pem
ln -s /etc/letsencrypt/live/ny.bossballoon.io/privkey.pem ~/server/key.pem

Run server on boot:

pm2 startup
npm run server
pm2 save
pm2 monit

Restart server automatically on the first of each month:

crontab -e

Add this line:

* * 1 * * /root/git/boss-balloon/scripts/restart.sh

Gamedev Notes

Touch/mouse input: https://patrickhlauke.github.io/getting-touchy-presentation/#157

MSDF fonts: https://codesandbox.io/s/css-tricks-msdf-text-fks8w?from-embed=&file=/src/Text.js

AssemblyScript:

AS WebGL bindings: https://github.com/battlelinegames/ASWebGLue The ASWebGLue examples now need the --exportRuntime flag to work

AS web snake game example: https://github.com/JairusSW/ASMultiSnake/

AS math: https://github.com/lume/glas/tree/master/src/as/math newer: https://github.com/data-ux/as-3d-math/tree/master/src/as/math

Texture load in background example: https://codepen.io/trusktr/pen/vYgVbVw

Asteroids walkthrough: https://wasmbook.com/asteroidstutorial.html

AS classes tutorial: https://wasmbook.com/assemblyscriptclassdeepdive.html

AS stdlib: https://www.assemblyscript.org/stdlib/map.html#constructor

Snapshot interpolation: https://github.com/geckosio/snapshot-interpolation#readme

WebRTC UDP nodejs library: https://github.com/geckosio/geckos.io#readme "node-datachannel is much lighter and faster compared to wrtc"

node-datachannel package: https://www.npmjs.com/package/node-datachannel

localtunnel package: https://www.npmjs.com/package/localtunnel

db package: https://www.npmjs.com/package/rezidb

serve package: https://www.npmjs.com/package/serve

as-websocket: https://www.npmjs.com/package/as-websocket

as-bind: https://www.npmjs.com/package/as-bind

as-bitray: https://www.npmjs.com/package/as-bitray

Audio: Probably just use a normal OGG file for audio. https://github.com/petersalomonsen/javascriptmusic/tree/master/wasmaudioworklet https://petersalomonsen.com/webassemblymusic/livecodev2/?gist=a74d2d036b3ecaa01af4e0f6d03ae7c4 https://www.youtube.com/watch?v=C8j_ieOm4vE&list=PLv5wm4YuO4IxRDu1k8fSBVuUlULA8CRa7

Canvas Rescaling:

Reference: https://stackoverflow.com/questions/33515707/scaling-a-javascript-canvas-game-properly

Screen size stats: https://www.rapidtables.com/web/dev/screen-resolution-statistics.html

Disable image smoothing: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled

canvas.width and canvas.height set the size of the canvas. canvas.style.width and canvas.style.height set the resolution.

boss-balloon's People

Contributors

catid avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.