Autotable is a tabletop simulator for Riichi Mahjong.
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
:
Run:
yarn
to install frontend packagescd server && yarn
to install server packagesmake parcel
to run and serve frontendmake files
to re-generate static files (textures and models)make server
to run servermake test
to run server testsThe 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;
}
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.
The tile images (img/tiles.svg
) were originally posted at Kanojo.de blog. They're licensed as CC BY-NC-SA.
The table texture (img/table.jpg
) is from CC0 Textures. It's licensed as CC0.
The sounds (sound/
) come from OpenGameArt (Thwack Sounds, Casino sound effects) and are licensed as CC0.
The digit font (img/Segment7Standard.otf
) is the Segment7 font by Cedders under Open Font License.
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:
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.
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 togethersrc/types.ts
- base data typesMainView
- three.js main scene, lights, cameraObjectView
- drawing things and other objects on screenAssetLoader
- loading and constructing the game assets (textures, models)ThingGroup
- instanced meshes for optimized rendering of many objectsWorld
- main game stateThing
- all moving objects: tiles, sticks, markerSlot
- places for a tile to be inSetup
- preparing the table and re-dealing tiles
src/setup-slots.ts
, src/setup-deal.ts
- mode-specific data for slots and how to deal tilesserver/protocol.ts
- list of messagesBaseClient
- base network client, implementing a key-value storeClient
- a client with Autotable-specific data handlingSome terminology: