Telegram Mini AppReal-money rooms
01The brief
simulation tick1 284 330
From Unity to PixiJS
Unity WebGLNakama
02Unity WebGLNakama
03PixiJS v8TypeScriptNode.jsWebSocketPostgreSQL
04< 1 MBTelegram + browser
05How it works
01 / 07
Browser
Telegram Mini App


One TypeScript codebase
PixiJS v8 + Vitesrc/simsrc/rendersrc/netsrc/ui
02 / 07

Input packet4 bytes
03
A1
6B
01
typeangleflags
direction132°booston
Never sent by the player
- position
- score
- money
03 / 07
Room · stake $0.2560 Hz
1 284 330
simulation tick
04 / 07

rate30 / scontentsonly what is on screencoordinatesint16 · 1/8 px
05 / 07
1begin;
2select real, bonus, locked, pending from wallets where user_id = $1 for update;
3update wallets set bonus = bonus + $2 where user_id = $1;
4insert into ledger(user_id, bucket, delta, reason, label) values ($1, 'bonus', $2, 'entry', $3);
5commit;
| bucket | delta | reason | label |
|---|
06 / 07
A
Account ATelegram linked
pending$1.00
bonus$0.00
B
Account Bsame device as account A
pending$1.00
bonus$0.00
locked · winnings made with bonus money wait here until the first deposit
07 / 07
wormex · tests