tarhses / teturisu

Online multiplayer Tetris clone

Home Page:https://tetris.e-kot.be/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TETURISU!

An online multiplayer Tetris clone written in Typescript with a Svelte front-end and a Deno back-end.

A screenshot of the game.

Getting started

To run the server, Deno is required:

export PORT=8080 # or 8001 by default

# Use an in-memory score database
deno run --allow-env --allow-net server/main.ts

# Or specify a sqlite database
export DATABASE='db.sqlite3'
deno run --allow-env --allow-net --allow-read=db.sqlite3 --allow-write=db.sqlite3 server/main.ts

The client interface uses Svelte and can be built with Rollup:

npm install

# Make a production build into "public/"
npm run build

# Or directly serve static files (in dev mode!)
npm run dev

In production, you should serve the public directory and redirect every WebSocket request (the /ws route) to the Deno server. This can be achieved with a reverse-proxy. For instance, an Nginx configuration file could look like this:

server {
  # Serve static files.
  root "/path/to/public";

  # Any room ID (i.e. 12 characters base64 string) is
  # rewritten to return "index.html".
  rewrite "^/[A-Za-z0-9\-_]{12}$" "/index.html";

  # Send WebSocket requests upstream.
  # See https://www.nginx.com/blog/websocket-nginx/.
  location = /ws {
    proxy_pass $to_my_server;
  }

  # ...
}

Tetris Guideline

The game tries to follow the Tetris Guideline as close as possible but it deviates on certain points:

  • T-spins, Back-to-Backs, and Combos are not rewarded.
  • Hard drops are not implemented.
  • You cannot hold a piece.
  • There is no ghost piece.
  • There is no garbage system.
  • The game uses infinity to handle its lock delay. It actually is compliant to the Guideline, but another locking type could be preferable (well maybe, I dunno).

These features might be implemented in the future though. See the roadmap and feel free to contribute 😉!

License

This project is MIT licensed.

©️ 2021, Pierre Luycx

About

Online multiplayer Tetris clone

https://tetris.e-kot.be/

License:MIT License


Languages

Language:TypeScript 75.0%Language:Svelte 20.3%Language:JavaScript 2.2%Language:CSS 1.3%Language:HTML 0.7%Language:Dockerfile 0.5%