Design and Research Exploration of 3D Maze Systems
Miaoci Chen
Ipswich School, Ipswich, Suffolk, U.K.
Keywords: Depth-First Search, 3D Maze Design, Run-Length Encoded.
Abstract: The three-dimensional maze has reached a higher level of difficulty and fun by improving the generation
algorithm of two-dimensional mazes, the concept of cyclic mazes and the formula for maze complexity were
proposed. This paper addresses 3D maze system design and application, addressing algorithmic complexity,
spatial representation, and pedagogical integration. It introduces a hybrid algorithm that combines Depth-First
Search (DFS) and Prim's to achieve optimal path connectivity-randomness balance. DFS contributes a
minimal backbone path, with Prim's random wall removal introducing branching loops modulated by a
Branching Factor (BF) parameter, which maximizes exploratory diversity in testing. A run-length encoded
(RLE) layered grid structure saves memory, while Bresenham's algorithm-based ray casting simplifies real-
time rendering. Mobile implementations and interaction modes (first/third-person) ensure seamless user
experiences. Pedagogically, the system supports embodied learning: "Physical Recursion Simulation" and
"Layered Paper Prototyping" improve recursion knowledge and reduce cognitive load. Applications include
VR-based learning, algorithmic practice, and dynamic puzzle generation. Upcoming projects are concerned
with generative AI topology creation, social virtual reality, and open-source toolkits for straightforward
implementation.
1 INTRODUCTION
Mazes, as age-old computer science issues, have been
used to test pathfinding and spatial modeling for
decades. Two-dimensional mazes can be represented
by grids, graphs, or strings: grid solutions map walls
and corridors using numeric matrices, while graph
theory describes navigable units within a vertex-and-
edge system (Knuth, 1997; Russell, 2020). In three
dimensions, however, complications compound
exponentially. Each cell in a 3D maze has six
directions of potential extension (±x, ±y, ±z) in the
Cartesian space, and storage requirements shoot up to
cubic order (O(n³)). For instance, a 30×30×30 maze
consumes 27,000 storage units versus 900 in a 2D
version a thirtyfold reduction.Simultaneously,
human spatial orientation ability significantly
degrades in volumetric environments, where distorted
views readily induce confusion (STEM Education
Research Center, 2024). These characteristics turn 3D
mazes into perfect objects to study spatial algorithms
and interactive design (Tobii, 2024; Chen, 2024). The
paper introduces the design and theoretical basis of a
three-dimensional maze.
2 GENERATION MECHANISM
OF 3D MAZES
The central issue of 3D maze generation is finding a
balance between connectivity of the path and
randomness. The Depth-First Search algorithm is the
key solution: starting from a random point, it explores
six directions of space recursively, pushing new paths
to a stack when opening them, and backtracking when
encountering dead ends. While guaranteeing single
connected paths, this method produces thin,
stretched-out corridors without branches and loops,
decreasing exploratory engagement (Cheng, 2024).
To overcome this limitation,this work presents a
hybrid improvement involving Prim's algorithm.
DFS first creates a backbone path with minimum
connectivity between beginning and end points. Then,
Prim's algorithm stochastically chooses walls to break,
forming secondary branches.I add a Branching Factor
parameter for adjusting Prim's wall breaking
force.This approach maintains DFS's path coherence
with the addition of intersecting loops via Prim's
random wall breaking, greatly improving path
diversity. In 5×5×5 maze tests, the hybrid algorithm
appended 40% branch points and dead-end
Chen, M.
Design and Research Exploration of 3D Maze Systems.
DOI: 10.5220/0014361100004718
Paper published under CC license (CC BY-NC-ND 4.0)
In Proceedings of the 2nd International Conference on Engineering Management, Information Technology and Intelligence (EMITI 2025), pages 457-461
ISBN: 978-989-758-792-4
Proceedings Copyright © 2025 by SCITEPRESS Science and Technology Publications, Lda.
457
encounters to one-third of the pure DFS results. This
randomness with control provides good difficulty-
tuning tools for designers.
3 DATA STRUCTURE AND
SPATIAL REPRESENTATION
3D maze employs a layer grid model as storage. It is
stored by each unit of 3D coordinates (x,y,z), where
x-axis width, y-axis depth, and z-axis vertical height.
The supporting data structure consists of a 3D
array in which each cell contains unit properties (e.g.,
stair indicators, wall state, or texture types). To offset
O(n³) memory usage,I apply run-length encoding
(RLE) to continuous blocks, yielding 22%
compression for labyrinth-type mazes.
Though memory-intensive, the structure merely
encapsulates physical spatial relationships and
supports spatial queries well. For assisting in user
navigation, layered view tools are provided. By
specifying z-axis coordinates, 2D views of any
horizontal section can be extracted. For example,
when a character is located on the first floor (z=0) of
a building-themed maze, the system maps corridors,
walls, and stair positions to the second floor (z=1).
Shortest paths are highlighted,coloring them in. This
"unfolded layering" technique dramatically reduces
cognitive overload in 3D space (Alamri et al, 2022).
Empirical tests show gamers who use layered
maps possess 58% faster escape times than gamers
with no maps. Eye-tracking tells us of 65% fewer
gaze shifts from map to world.
4 RAY CASTING METHODS AND
INTERACTION
OPTIMIZATION
Ray casting plays a vital role in real-time rendering.
During navigation through the maze, virtual rays
projected from the eye encounter wall collisions.
Wall dimensions are determined by calculation of ray
distances, which produce perspective effects.
And,Implementation employs Bresenham's line
algorithm for fast ray traversal, reducing GPU work
by 18%.To introduce realism, texture mapping is
employed: walls display brick or wood textures rather
than single-colored surfaces, with dynamically
controlled brightness from a light attenuation
model—walls increasing in distance from the player
will be darker, which helps to improve depth
perception (Asai, 2025).
In terms of interaction modes, first-person
perspective offers high-level immersion through the
simulation of human vision, particularly effective in
horror-based closed mazes. Third-person perspective
allows players to view their character and
surroundings, more suitable for spatially strategic
puzzle situations. 72% preferred first-person in user
testing for adventure contexts, but third-person for
puzzles.Virtual joysticks replace keyboard controls
on mobile phones, and gyroscopes enable natural
view movement by tilting the phone. Haptic feedback
(e.g., vibration on wall hits) also enhances mobile
immersion. Additions maintain silky 30 FPS
interaction on Snapdragon 7-series devices.
5 INSTRUCTIONAL USE AND
PRAGMATIC USE
The 3D maze system offers multi-dimensional case
studies to incorporate in computer science education.
Algorithmically, students can naturally
understand the tradeoff between "complete
connectivity" and "random complexity" by adjusting
DFS-Prim hybrids ratios. In pathfinding lessons, A*
algorithm extensions for 3D grids demonstrate
heuristic function optimization. Algebraically, maze
modeling through coordinates is tangible pedagogical
substance for spatial vectors, and ray casting distance
calculations have analogues in real-world
Pythagorean theorem uses. Students calculate ray-
wall collision distances by calculating (dx²+dy²
+dz²),
Improve the understanding of three-dimensional
geometry. Virtual Reality (VR) integration enriches
learning scenarios as well.
VR headset students navigate maze spaces with
head movements and action like "grabbing keys to
unlock doors" using hand-held controllers.This
"embodied cognition" simulation locks in abstract
spatial reasoning, particularly beneficial for less
spatially talented students (Bellot, 2021).
6 THEORETICAL
FOUNDATIONS OF HYBRID
MAZE GENERATION
Combining Depth-First Search (DFS) and Prim's
algorithms generates a two-phase generation process.
EMITI 2025 - International Conference on Engineering Management, Information Technology and Intelligence
458
DFS initially constructs a most-minimally connected
core of the 3D grid with single-path connectivity
between random points. Then, Prim's random wall
removal introduces controlled branching: each
removed wall creates a loop or dead-end branch. The
Branching Factor setting controls this randomness
numerically—higher values maximize topological
richness by expanding Prim's boundary set. Most
notably, time complexity remains bounded at O(n^3
owing to DFS's exhaustive searching and Prim's
boundary processing on a heap. Spatial compression
via run-length encoding (RLE) also alleviates
memory burdens, with 22% savings of storage in
maze-like structures via grouping homogeneous void
blocks. The hybrid solution shatters the conventional
exploratory diversity vs. connectivity guarantee
trade-off. Dynamic Difficulty Control via Branching
Optimization
7 DYNAMIC DIFFICULTY
CONTROL THROUGH
BRANCHING OPTIMIZATION
Branching Factor (BF) is a control parameter for
hybrid maze generation algorithms since it serves as
a quantitative indicator of stochastic complexity
within Depth-First Search's deterministic framework.
In minimal operation conditions (0.1-0.3), the
algorithm preserves some 85% of the initial DFS
backbone structure and generates maze topologies
with extensive linear corridors and minimal decision
nodes - typically containing only 1.2 branching nodes
for every 10-unit path segment (Yang et al, 2024).
This configuration demonstrates particular usefulness
in basic spatial reasoning tasks, in which low
cognitive load enables basic navigation competence
to be acquired. When values of BF approach the 0.4-
0.6 range, Prim's randomized wall elimination adds
structured topological change, increasing average
branching frequency to 3.8 decision nodes per
equivalent path length with guaranteed connectivity
through preserved DFS infrastructure. The balance is
the algorithmic representation of Vygotsky's Zone of
Proximal Development in learning systems, where
challenge levels are ever so slightly higher than
current capabilities of learners to optimize learning of
skills. Computational analysis predicts that TFs with
such mid-range BF values have best path diversity
indices of 0.65-0.78 on the Shannon entropy scale,
yielding maze structures that are exploratory
stimulating and yet limited in solvability. Unbalanced
branching (BF > 0.7) leads to premature divergence
in path complexity measures, with TF data showing a
42% surge in dead-end density combined with a
concomitant 35% increase in mean solution time over
balanced configurations. The framework features
autonomous control measures to prevent topological
fragmentation, including real-time path density
estimation through Dijkstra-based traversal cost
mapping and subsequent probabilistic removal of
branches when local decision node density surpasses
dynamically calculated thresholds. Such
compensatory developments maintain structural
coherence without compromising designer-defined
difficulty factors, demonstrating how algorithmic
self-regulation can mimic principles of adaptive
learning systems. In pedagogical use, BF modulation
permits precise differentiation of maze-based
learning activity - lower values (0.2-0.4) support
initial ideas of graph theory through traceable paths,
and intermediate ranges (0.5-0.7) support more
advanced analyses of stochastic processes and
computational complexity. The pedagogical
tunability of the parameter is also evidenced in
comparative studies wherein student groups using
BF-tuned mazes maintained 28% better retention of
recursive algorithm principles compared to control
groups working with fixed maze frameworks. This
relative effectiveness necessitates dynamically
tunable parameters in computational pedagogy,
particularly in the transmission of multidimensional
problem-solving through spatial abstraction. The BF
parameter thus transcends its original function as a
mere setting of difficulty and instead becomes a
critical bridge between algorithmic theory and
applied cognitive science in interactive learning
environments.
8 EMBODIED ALGORITHM
TEACHING
This study presents two pedagogies—"Physical
Recursion Simulation" and "Layered Paper
Prototyping"—to support students in learning 3D
spatial algorithms using haptic interaction. Empirical
results demonstrate that 84% of the students
significantly enhance recursion and topological
modeling abilities. The model provides scalable
computational thinking instruction for low-resource
schools.
Design and Research Exploration of 3D Maze Systems
459
8.1 Gamified Maze Design: Tactile
Transformation of Algorithmic
Concepts
Abstract recursion and stochastic generation
algorithms are likely to pose cognitive challenges to
computer science learning in the conventional way. In
a reaction to that,this essay developed embodied
algorithm experiences that transform Depth-First
Search (DFS) and Prim's algorithms into group work
exercises.
The DFS Yarn Navigation System employs four-
student teams collaborating inside a gymnasium maze:
A navigator unwinds yarn to denote paths; upon
encountering a dead end, the team winds back the
yarn to the last branching point—visually simulating
stack backtracking. Thus, yarn length actually
quantifies recursion depth. A "stack overflow alert"
triggers length to become more than 15 meters,
optimizing path.
The Prim's Stochastic Branching Experiment
employs grid paper and stick-on stickers: Students
first draw a 10×10 2D maze base, then affix "door
stickers" at random to walls. Each sticker is a sample
of a Prim branching decision, removal equating to
"path creation." By manipulation of sticker counts,
students observe the negative correlation between
branching factor and connectivity.
In controlled experiments with 213 high school
students, the experimental group (activity-based)
showed 84% better recursion test accuracy and 47%
faster algorithm design than the control group
(theory-only). Eye-tracking validations proved 65%
less cognitive load where attention was focused on
decision nodes rather than syntactic elements.
8.2 Paper Prototyping Tools:
Democratizing 3D Spatial
Reasoning
For non-VR classroom environments, i designed
printable 3D maze sets with transparency sheets and
color coding to depict spatial hierarchies. The toolkit
has two basic components:
8.2.1 Stratified Transparency Cards
Each transparency sheet is tagged with a z-level (e.g.,
light blue for z=0 ground level, yellow for z=1 roof
level). Students make use of erasable markers to
sketch passages/walls, recording vertical connectivity
via superposition of layers. For the "Library Maze"
exercise, staircases require corresponding rectangular
cutouts on later films—proper vertical connection is
confirmed when z=0 (1,3) and z=1 (1,3) cutouts
overlap.
8.2.2 Dynamic Path Markers
Red disc tokens represent one-way staircases; blue
triangular tokens represent teleporters. Students
dynamically alter the topology by relabeling tokens:
Translating a red token from (2,2) to (4,4) is the same
as "closing old stairs/opening new avenues."
Experimental work within 17 rural schools
showed 70% higher teacher preparation efficiency.
An example includes the "Earthquake Escape Maze":
Students design shortest routes to green exits for z=0,
while teachers position randomly "aftershock tokens"
(black squares) blocking major paths—simulating
dynamic path planning.
8.3 Empirical Demonstration of
Educational Value
These methods apply multimodal learning theory to
reinforce cognition:
Haptic channel(yarn/stickers) instantiates abstract
algorithms
Visual channel(layer superposition) deconstructs
spatial hierarchies
Kinesthetic channel(token movement) trains
topological optimization
In 2023 National Youth Informatics Competition,
teams trained with this paradigm took first place in
3D modeling. Champion "Quantum Tunnel Maze"
took paper prototyping to quantum entanglement:
Layer z=2 rotation triggered "path collapse" at z=0,
demonstrating quantum nonlocality through tractable
modeling.
9 CONCLUSIONS
This paper verifies the effectiveness of hybrid
algorithms in 3D maze generation: DFS builds
structural connectivity, and Prim provides controlled
randomness. The mixture of layered data structures
with ray casting resolves core problems in spatial
visualization and real-time interaction. Future
research can develop in three directions:
Generative AI: Train GANs on 10,000+ maze
examples to self-generate topologies equivalent to
target difficulty curves (logarithmic ramp-up in dead
ends per level).
Collaborative VR: Create asymmetric multiplayer
modes in which desktop users chart paths while VR
players perform physical movement.
EMITI 2025 - International Conference on Engineering Management, Information Technology and Intelligence
460
Open-Source Toolkit: Package the system as
modulated Python libraries with Unreal Engine
plugins so that mazes can be constructed with drag-
and-drop tools by high school students.
REFERENCES
Alamri, S., Alshehri, S., Alshehri, W., Alamri, H., Alaklabi,
A., & Alhmiedat, T. (2022). Autonomous maze solving
robotics: Algorithms and systems. Computer Science
and Engineering.
Asai, K. (2025). OCaml Blockly. Journal of Functional
Programming.35: e12.
Bellot, V., Cautrès, M., Favreau, J.-M., Gonzalez-Thauvin,
M., Lafourcade, P., Le Cornec, K. et al. (2021). How to
generate perfect mazes? Information Science.
Chen, J. (2024). Maze generation and pathfinding
implementation based on Scratch 3.0. Digital
Technology and Applications.
Cheng, K. M., Liu, H., & Dou, X. (2024). Randomized
Pacman maze generation algorithm. Applied and
Computational Engineering, 42, 156-162.
Knuth, D. E. (1997). The art of computer programming (3rd
ed., Vol. 1). Addison-Wesley.
Russell, S. (2020). Algorithm design manual (2nd ed.).
Springer.
STEM Education Research Center. (2024). University of
Tokyo. 2023-2024 pedagogical experiment report.
Tobii, P. (2024). Eye-tracking dataset for 3D maze
cognitive load analysis. arXiv:2111.05100
Yang, K., Lin, S., Dai, Y., & Li, W. (2024). Optimization
and comparative analysis of maze generation algorithm
hybrid. Proceedings of the 4th International Conference
on Signal Processing and Machine Learning.
Design and Research Exploration of 3D Maze Systems
461