Coder Social home page Coder Social logo

tarhses / teturisu Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 0.0 361 KB

Online multiplayer Tetris clone

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

License: MIT License

Svelte 20.31% TypeScript 75.03% JavaScript 2.19% CSS 1.28% HTML 0.65% Dockerfile 0.54%
tetris online typescript deno sveltejs game nodejs tetris-clone multiplayer

teturisu's Introduction

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

teturisu's People

Contributors

tarhses avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.