A Vietnamese-style cement tile matching game built with C++, WebAssembly (asm.js), and React.
🌐 Play online: gachbong.yellowstudio.vn
Gạch Bông (Vietnamese Cement Tiles) is a tile-matching puzzle game inspired by the beautiful traditional cement tiles found across Vietnam. The game engine is written in C++ and compiled to JavaScript (asm.js) via Emscripten, with a React + TypeScript frontend powered by Vite.
gach-bong/
├── gach-bong-core/ # C++ core game engine (static library)
│ ├── include/ # Public headers (geometry, renderer, patterns, board, pathfinder)
│ └── src/ # Implementation (board logic, pattern rendering, pathfinding)
├── wasm/ # Emscripten wrapper & build config
│ ├── src/ # WASM bindings (engine.cpp, canvas_renderer.cpp)
│ └── CMakeLists.txt # CMake config for Emscripten build
├── src/ # React + TypeScript web frontend
├── public/ # Static assets & compiled JS output
├── deploy/ # Deployment scripts
└── .github/workflows/ # CI/CD pipeline
- Node.js >= 20
- Emscripten SDK (for compiling C++ to asm.js) — Installation guide
- CMake >= 3.13
npm installnpm run dev# First time: configure & build
npm run wasm:build
# Subsequent rebuilds
npm run wasm:rebuild
# Clean build artifacts
npm run wasm:cleanThe compiled output (gach_bong.js) will be placed in wasm/build/.
npm run buildA C++ tool is provided to render a 512x512 PNG avatar displaying a 2x2 grid of traditional tiles using the core renderer.
cd tools/export_avatar
mkdir -p build && cd build
cmake ..
make
./export_avatar ../gachbong-icon.pngThis generates gachbong-icon.png inside the tools/export_avatar directory.
-
gach-bong-core/— A pure C++ library containing the game logic: board management, tile pattern rendering (20 traditional Vietnamese patterns), and pathfinding for tile matching. -
wasm/— An Emscripten wrapper that exposes the C++ engine to JavaScript via embind. It compiles to asm.js (a single.jsfile) for easy auditing and portability. -
src/— A React + TypeScript frontend that loads the compiled engine and renders the game using HTML5 Canvas.
This project is licensed under the MIT License — see the LICENSE file for details.