DUAT
Two games of ancient Egypt, one box
My own ancient-Egyptian board-game product and its Next.js platform: sales site, playable Senet and Tjau demo with a card-playing AI, and online matches.
- Country
Egypt
- Type
- Own product
- Timeline
- 2026
- Platforms
- Web · Mobile web
- automated tests, all passing
- 222
- win rate over 160 matches vs. the old AI
- 64%
- per card decision in the browser
- ~0.5 s
- games and Heka cards in one box
- 2 + 8
Overview
DUAT is a physical board-game box sold in Egypt. It holds Senet, played by Egyptians since the First Dynasty, and Tjau, the twenty squares, plus 8 Heka cards: a modern, optional twist that can turn a match.
Its web platform has three jobs: sell the box through an Arabic-first landing page with cash-on-delivery orders, let people play both games before they buy against a 3-level computer, on one device or online, and run the business through an owner dashboard.
The challenge
- 01
Few people know these games, so the site has to teach and convince before it can sell. Hence a playable demo, not just photos.
- 02
The ancient rules survive only in part. Each rule set needed a clear, testable reading, and the 8 printed cards one exact meaning on screen.
- 03
A computer that plays cards at random feels dumb. It has to know when a card actually matters.
- 04
Online play must be fair: hidden cards and dice throws can't be visible to, or changeable by, the browser.
- 05
Most visitors are on phones, so long boards must fit like a game app and the order form must stay usable with the keyboard open.
Highlights
Games and AI
- Senet with 4 rule sets, from basic to the full challenge
- Tjau on the Egyptian board and the Board of Ur, with Babylon-tablet and extra-throw variants
- Computer opponent at 3 levels; Medium and Hard decide on cards with full-match rollouts
- Heka cards: none, one or two per player, applied exactly as printed
Play modes
- Against the computer, two players on one device, or online
- Online by invite link shared on WhatsApp, or a random opponent with a fallback to the computer after 30 s
- Free trials per device, counted on the server; more unlock after a 6-digit e-mail code
Commerce and dashboard
- Cash-on-delivery orders with a shipping fee per governorate and prices copied onto each order
- Branded order-alert and invoice e-mails, readable on a phone
- Prices, trial limits, shipping table, content and tracker IDs editable without a deploy
- GA4, Clarity and ad pixels load only after cookie consent, plus a built-in funnel: visits, demo starts, form opens, orders
Mobile-first
- On phones the game table is a full-screen landscape screen however the phone is held
- An app-style tab bar replaces floating buttons on the landing page and hides while typing
- Fully bilingual: Arabic RTL and English across site, demo and e-mails
Signature feature
A computer that knows when a card matters
- Each Heka card has a power and a price. The first version revealed its cards on turn one, when they did nothing.
- Easy tries the card on a copy of the table, scoring the best targets, the board left behind and the turns gained or lost, and stays patient in the opening.
- Medium and Hard play the match to the end 40 or 100 times, once with the card and once without. Both branches get the same dice, so the difference comes from that decision alone.
- Against the old always-reveal computer it won 64% of 160 matches, with each decision taking about half a second in the browser.
- At the table, a spotlight shows the revealed card's power, price and result for 5 seconds.
Screens
Swipe for more
Engineering notes
- 01
One reducer, two runtimes
A whole match, both games and all 8 cards, is one pure
reduce(state, action)in@duat/match. The browser runs it offline; the server runs the same code online, throws the sticks and keeps face-down cards, so fair play comes from the design, not from trusting the client. - 02
Printed cards as the single source of truth
The 8 Heka cards are generated from the print source in Arabic and English, so the box and the screen always say the same thing. Edge-case readings are recorded as decisions and covered by tests.
- 03
Rollouts with common random numbers
Paired playouts with and without the card share the same dice sequence. That cuts the noise enough for 40 to 100 playouts to give a stable decision in about 0.5 s on the main thread.
- 04
The phone table as a landscape screen
Browsers can't lock orientation reliably, so on an upright phone the whole table rotates a quarter turn in CSS, and zoomed cards open inside the rotated screen. Checked from 320 px to 1440 px in both languages with no sideways overflow.
- 05
Trials without accounts
Visitors get a random device ID in a signed cookie, and trials are counted on the server. E-mail codes are hashed, expire in 15 minutes, allow 5 attempts and are rate-limited.
- 06
Settings, not deploys
Prices, trial counts, the shipping table, the WhatsApp number and tracker IDs live in a zod-validated settings store that the owner edits from the dashboard.
Results
- 2 complete games (Senet with 4 rule sets, Tjau on 2 boards) and 8 Heka cards, playable against a 3-level computer, on one device or online.
- 222 automated tests in 18 files, all passing.
- Fully bilingual Arabic (RTL) and English across the site, the demo and the e-mails.
- A complete physical product: box, two boards, pieces, throw sticks, cards and three bilingual rule sheets, with print-ready and factory files.
- Live public demo.
Stack
- Next.js 15
- React 19
- TypeScript
- Tailwind CSS 4
- next-intl
- zod
- Prisma
- MySQL / TiDB
- pnpm workspaces
- Nodemailer
- three.js
- WebAudio
- Vitest
- Vercel