Maicon Ventura
Back to projects
· 4 min read

$MOEDADA

Tactical heads-or-tails duel web game in PHP, MySQL and Docker, with Lobby, automated opponent, pixel-art skins and seasons.

PHPMySQLDockerJavaScript

$MOEDADA is a tactical heads-or-tails duel web game with a light pixel-art aesthetic. It began as a solo project in the Systems Development technical course at SENAI (v1) and evolved into the full version 2.0, live at moedada.maiconventura.dev. (The game interface is in Portuguese.)

Players wager fictional points, challenge opponents in the Lobby or face A Casa (an automated bot), pick their coin face, deploy tactical maneuvers inside the Arena, complete daily missions, unlock achievements and customize their coin and 16×16 pixel-art avatar.

$MOEDADA v2 Tactical Arena showing scoreboard, block countdown timer, pixel-art coin and face selection
Tactical Arena: face pick, DOBRAR 2X and BLINDAR maneuvers, and 8-second block timer

Features

  • Open Lobby tables: create open challenges without a fixed opponent (ABERTO, auto-expiring after 24h) for anyone to accept immediately, or watch live matches from the board.
  • Duels against A Casa: one-click automated opponent available on the Dashboard and Lobby with fast tactical decisions and isolated stats so competitive leaderboards stay fair.
  • Shareable invite links and rematches: 8-character public invite codes (/convite/{codigo}) with post-login redirect and one-click Rematch buttons (capped daily per pair).
  • Real-time Tactical Arena: the active player picks CARA or COROA and can spend one DOBRAR 2X (2-point round) and one BLINDAR (shield that blocks conceding a point on a miss) per duel. Alternating turns run on an 8-second server timer with 1s polling, spectator mode, 6 fixed table emotes and 8-bit visual and audio feedback.
  • Progression and economy: Bankruptcy Floor (+250 PTS once per day when below 100 PTS), 4 rotating daily missions and 8 permanent achievements.
  • Shop, identity and seasons: 6 pixel-art coin skins (including an achievement-exclusive skin), 8 16×16 avatars, an in-app notification center, public profiles with win streaks and face-prediction accuracy, plus Overall and Monthly Season leaderboards.
Arena Lobby with quick duel against A Casa, open tables and recent matches board
Lobby with open tables, instant duel vs A Casa and recent match board
Shop featuring 6 pixel-art 32x32 coin skins and 16x16 avatars
Shop and identity: 6 pixel-art coin skins and 16×16 avatar gallery
Daily missions board with progress bars and permanent achievements
Daily missions with instant claim and permanent achievements
Public player profile with 16x16 avatar, equipped coin, stats, achievements and match history
Public profile with competitive stats, achievements and match history

Technical highlights

  • Server-authoritative draws and tactics: every turn settles inside executar_rodada_transacional() using random_int(0, 1); the browser only submits the chosen face/maneuver and renders server state.
  • Concurrency safety: coin throws, skin purchases and mission claims execute inside InnoDB transactions with SELECT ... FOR UPDATE row locks and a unique (id_desafio, rodada_num) key.
  • Idempotent auto-migration and hybrid resolution: the schema upgrades automatically from v1 to v2 (8 tables tracked by schema_migrations), while expired turns and 24h open tables resolve via both cron/resolver.php and lazy ticks during polling.
  • Security and deployment: PDO prepared statements, CSRF tokens on forms and JSON endpoints, password_hash(), XSS output escaping, X-Forwarded-Proto HTTPS awareness and a Docker setup (Apache/PHP + tuned MySQL 8 behind a Cloudflare proxy).
  • Engineering docs: v2.0 SRS covering 32 functional requirements, 35 business rules, 18 architecture decisions, an OKLCH Pixel Design System and 45/45 passing test cases.

Stack

  • PHP 7.4+ / 8.2 with PDO
  • MySQL 8 / MariaDB
  • Bootstrap 5 + Pixel Design System (OKLCH)
  • JavaScript (fetch, 1s polling and 8-bit Web Audio SFX)
  • Docker & Docker Compose

Points remain strictly fictional: they are never sold or exchanged for real money.