$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.
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
CARAorCOROAand can spend oneDOBRAR 2X(2-point round) and oneBLINDAR(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.
Technical highlights
- Server-authoritative draws and tactics: every turn settles inside
executar_rodada_transacional()usingrandom_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 UPDATErow locks and a unique(id_desafio, rodada_num)key. - Idempotent auto-migration and hybrid resolution: the schema upgrades automatically from
v1tov2(8 tables tracked byschema_migrations), while expired turns and 24h open tables resolve via bothcron/resolver.phpand lazy ticks during polling. - Security and deployment: PDO prepared statements, CSRF tokens on forms and JSON endpoints,
password_hash(), XSS output escaping,X-Forwarded-ProtoHTTPS 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.