← All projects
Games & interactive · JavaScript
M

Treasure Hunt: 3D Maze Game

A 3D maze game designed in Unity (C#), with a complete browser version in three.js: five temple levels, sentries, spike traps, coins and an exit.

01 Play the game

The browser version, built in three.js: a third-person camera, five levels, sentries whose sight you can see on the floor, spike traps that glow before they rise, and coins that open the exit. Every hit is named on screen with an arrow to where it came from. It downloads about 220 KB compressed.

The game: the explorer in a corridor, a sentry that has spotted them with its red sight cone on the floor, and a gold coin ▶ Play in browser

Keyboard: W A S D or arrow keys to move, Shift to run, Space to dash, Q/E or drag to turn the camera, P or Esc to pause. On a phone: left thumb moves, right thumb turns. Gamepads work too.

The original Unity WebGL build (27 MB) is kept for reference. Its 3D models were never committed to this repository, so it runs without its art.

02 Maze Generator Preview

Recursive-backtracker maze carving, the algorithm the browser version builds its five levels with (it also opens a few dead ends into loops, so there is always a way around a sentry). The Unity levels are hand-authored; MazeGenerator.cs is an optional script they do not use. Pick a size and generate.

Click "Generate maze" to carve one.

03 Game Features

Five temple levels

Each level is a seeded maze with its own stone and light: coins in the dead ends, the exit at the far end, more sentries and traps as you go.

Sentries you can read

Sentries patrol set routes. Their sight is a lit cone on the floor, cut off by walls; they turn red when they spot you and charge before every shot.

Damage you can see coming

Every hit is named on screen with an arrow to where it came from. Spike traps glow orange before they rise. Dash through an orb to dodge it.

Any controller

Keyboard and mouse, touch (thumb stick and dash button) or a gamepad, with a camera that stays above the walls and a map that fills in as you explore.

04 Technical Details

Engine

Unity 2019.4 LTS (C#); browser version in three.js 0.186

Enemies

Unity: NavMeshAgent. Browser: patrol routes, grid line of sight, sight cones

Mazes

Recursive backtracker with loops, seeded per level (maze.js)

Tests

7 unit tests for the mazes, layout, collision and sight, run in CI

Levels

5 levels + main menu, progress saved in the browser

Platform

Unity desktop build; any modern browser, phone or computer

Play the browser version (section 01), or open the Unity project in Unity 2019.4.17f1+.

Unity 2019.4 LTS · C# · three.js · Built by Umer Hashmi