Case study · GameDev & Telegram

Digital Mafia Assistant: offline game master tools, ratings, and stats tracker.

Replaced pen and paper with a smart Telegram assistant. The bot helps the host manage offline Mafia games with 16+ players and complex custom roles. It controls phase logic, prevents illegal moves, logs night histories, and automatically updates the club leaderboards in Google Sheets.

ProjectOffline Gaming Club Automation RoleFullstack Development (Python) Key FeatureGame Logic Engine + Google Sheets API
3000+ lines of code
under the hood
10+ complex roles
with custom logic
0 logic errors at
the gaming table
01 / Context

Why the host's notepad doesn't cut it anymore

When 10 to 16 players sit at a Mafia table, and the roster includes not just standard mafiosi but also a Boss, a Courtesan, a Sheriff, a Doctor, and a Serial Killer — hosting the game becomes an absolute stress fest. You have to memorize all night actions, keep track of waking orders, and remember whose actions were blocked.

Originally we used Google Apps Script for simple automation, but it lagged heavily and couldn't process complex game states. So, we leased a solid VPS server and coded a fully-fledged game engine from scratch inside Telegram with over 3,000 lines of code.

No Digital Assistant / With Host Bot

— Before
  • Host notes down all moves by hand on paper
  • Human error: forgetting whom the sheriff checked
  • Post-game arguments over incorrect night logic resolution
  • Manual calculations of club leaderboards after every game
+ After
  • Host simply clicks inline buttons in Telegram
  • Bot automatically resolves action conflicts (kills vs heals vs blocks)
  • System warns the host about illegal moves
  • Ratings and game stats sync immediately with Google Sheets
02 / Under the hood

An objective referee and statistical engine

The bot doesn't replace the live banter at the table — it simply takes care of the boring ledger work. Before starting a match, the host pulls the player roster (loading the previous game's players in one click) and assigns roles. Then, the game engine takes over.

  • Validator Error Prevention. If the host tries to make an illegal move — like picking an action for a dead player, or targeting someone who was blocked by the Courtesan — the bot alerts the host and locks the input.
  • Protocol Log Action Logging. The bot records a detailed log of every check, shoot, and block. This eliminates post-match disputes in the style of "you forgot to heal me".
  • Big Data Leaderboards. All statistics export directly into Google Sheets dashboards. The club gets transparent access to win rates, role survival stats, and a dynamic leaderboard.
This began as a hobby project but grew into a serious Game Logic Engine. The bot accelerated match speeds, removed human error from game mathematics, and let the host focus on creating the table atmosphere rather than drafting journals.

Need similar workflow automation? Tell me about your task — I’ll draft what is feasible.

Message on Telegram
Back to cases