All Projects → pwmarcz → autotable

pwmarcz / autotable

Licence: other
An online mahjong table

Programming Languages

typescript
32286 projects
HTML
75241 projects
CSS
56736 projects
Makefile
30231 projects

Projects that are alternatives of or similar to autotable

Deep-Learning-Mahjong---
Reinforcement learning (RL) implementation of imperfect information game Mahjong using markov decision processes to predict future game states
Stars: ✭ 45 (+15.38%)
Mutual labels:  mahjong
mah
a html5 mahjong solitaire game
Stars: ✭ 33 (-15.38%)
Mutual labels:  mahjong
mahjong-ai
A program for investigation on deep learning model for Hong Kong Mahjong.
Stars: ✭ 24 (-38.46%)
Mutual labels:  mahjong
akochan-reviewer
🔍🀄️ Review mahjong game log with mjai-compatible mahjong AI.
Stars: ✭ 503 (+1189.74%)
Mutual labels:  mahjong
16mj
16 Mahjong
Stars: ✭ 15 (-61.54%)
Mutual labels:  mahjong
MajsoulAI
雀魂/天凤四人麻将AI;目前段位 雀魂雀圣3 天凤8段。
Stars: ✭ 93 (+138.46%)
Mutual labels:  mahjong
tjmj
网页的天津麻将,从 GoogleCode 导入,不活跃
Stars: ✭ 29 (-25.64%)
Mutual labels:  mahjong
pantheon
Primary Pantheon project repository
Stars: ✭ 21 (-46.15%)
Mutual labels:  mahjong
MahjongKit
Riichi Mahjong Kit: (1) Game log crawler (sqlite3, json, bs4); (2) Game log preprocessor; (3) Deterministic algorithms library
Stars: ✭ 39 (+0%)
Mutual labels:  riichi-mahjong
tenhud
HUD for tenhou.net riichi mahjong server. Shows tsumogiri and hidden tiles.
Stars: ✭ 12 (-69.23%)
Mutual labels:  mahjong
JapaneseMahjong
日本麻将的库,“求向听数”、“判断胡牌”、“牌面拆解”采用查表法。
Stars: ✭ 96 (+146.15%)
Mutual labels:  mahjong
mahjong soul api
Python wrapper for the Mahjong Soul (Majsoul) Protobuf objects. It allows to use their API.
Stars: ✭ 30 (-23.08%)
Mutual labels:  mahjong
ChineseOfficialMahjongHelper
国标麻将小助手——包含算番器、线下实麻计分器、番种详细说明、牌理等
Stars: ✭ 82 (+110.26%)
Mutual labels:  mahjong

Autotable

Autotable is a tabletop simulator for Riichi Mahjong.

Running

This repository uses Git LFS to track large files. To clone all files, you need to install it first.

You need the following utilities installed and present in PATH:

  • GNU make
  • node and yarn
  • Inkscape 1.0+ (for textures: .svg -> .png conversion)
  • Blender (for 3D models: .blend -> .glb conversion)

Run:

  • yarn to install frontend packages
  • cd server && yarn to install server packages
  • make parcel to run and serve frontend
  • make files to re-generate static files (textures and models)
  • make server to run server
  • make test to run server tests

Deployment

The frontend can be served as static files. Run make build.

The server is a WebSocket application. You can run it on the server listening on localhost, and use your HTTP server to expose it to the world.

By default, the frontend should be under /autotable/ and server under /autotable/ws.

Here is what I use for nginx:

location /autotable/ {
    expires 0d;
    alias <path_to_autotable>/dist/;
}

location /autotable/ws {
    proxy_pass http://127.0.0.1:1235/;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";

    # Prevent dropping idle connections
    proxy_read_timeout 7d;
}

License

All of my code is licensed under MIT. See COPYING.

However, I'm also using external assets, licensed under CC licenses. Note that the tile images are under a Non-Commercial license.

Contributions

This is a very opinionated project. I will be grateful for contributions that fix bugs or improve player experience. However, I will probably not want to merge any of:

  • Making the engine too general, at the cost of simplicity. I'm not interested in a general-purpose tabletop engine.
  • Other mahjong variants than Riichi Mahjong, unless it has a low maintenance cost. Same reason as above - I would rather have a great support for Riichi than mediocre support for all kinds of mahjong.
  • Any form of automation, such as automatic tile drawing, sorting, scoring etc. This is contrary to the project's philosophy.

However, please don't feel discouraged from making these changes in your own fork! While I want to do my thing here, I would be very interested to see in what directions people take the project.

Development

See the blog post for explanation of many technical decisions: https://pwmarcz.pl/blog/autotable/

The main parts are:

  • Game - main class, connecting it all together
  • src/types.ts - base data types
  • view:
    • MainView - three.js main scene, lights, camera
    • ObjectView - drawing things and other objects on screen
    • AssetLoader - loading and constructing the game assets (textures, models)
    • ThingGroup - instanced meshes for optimized rendering of many objects
  • game logic:
    • World - main game state
    • Thing - all moving objects: tiles, sticks, marker
    • Slot - places for a tile to be in
    • Setup - preparing the table and re-dealing tiles
      • src/setup-slots.ts, src/setup-deal.ts - mode-specific data for slots and how to deal tiles
  • network:
    • server/protocol.ts - list of messages
    • BaseClient - base network client, implementing a key-value store
    • Client - a client with Autotable-specific data handling

Some terminology:

  • thing - all moving objects: tiles, sticks, marker
    • thing type - tile/stick/marker
    • thing index - a unique number
  • slot - a space that can be occupied by a thing
    • slot name - a string identifying the slot in game
  • seat - table side (0..3)
  • thing rotation - a 3D orientation, represented by a quaternion
  • place - information about thing's position, rotation, and dimensions
  • shift - moving things that currently occupy the destination when dragging; used e.g. when sorting tiles in hand and swapping them
  • collection - a key-value dictionary stored on the server, a game state consists of various collections
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].