Cocos Maze: An Open Source Web Maze Game
Cocos Maze is part of the project I developed during my probation as a full-time Frontend Developer in Growild Technology Inc., and then decided to open source it for future reference.
Project Introduction
The maze generation is inspired by the ideas from liuyubobobo/Play-with-Algorithm-Visualization and Imymirror/maze-generalization. It uses the BFS (Breadth-First Search) algorithm to non-recursively generate a random maze map.
Open Source Project Link
GitHub: billyjojojobulido/Cocos-Maze
Development Environment
- Operating system: MacOS
- Game engine: Cocos Creator 2.4.7
- Programming language: TypeScript
Key Features
Feature 1: Maze Generation and Display

Feature 2: Character Movement Control

Feature 3: Level Tracking and Game Over
- If the character reaches the finish point before the countdown ends, the maze will be regenerated, and the level will be reset after updating the completion count.
- When the countdown ends and the character has not triggered the finish point's collision callback, the game will result in a Game Over.

Development Challenges
Challenge 1: Character movement step size
You can use cc.Tween to ensure the character moves a fixed step size each time. Since the character and the path have equal widths, calculating the x and y values of the node based on time in update() might cause the character to not correctly enter the path (even a 1px difference could block the character by the wall), increasing the game difficulty.
Challenge 2: Random maze
Using a Queue to generate the maze should produce the same maze every time. You can refer to Imymirror's implementation to introduce randomness when popping the queue, avoiding the repetition of generated mazes.
Challenge 3: Reusing bricks
If you want to keep track of the number of completions, you can't simply reload the scene to start a new game. Therefore, the entire maze must be manually rebuilt. You can use NodePool to reduce the need to repeatedly instantiate & destroy bricks.
Disclaimer
Sharing my work that based on an open-source project without implanting any company-owned resources & technologies does not violate the Non-Disclosure Agreement I signed with Growild Technology Inc.