# AI Algorithm Practice Behind Unity Stealth Chase Game: A* Pathfinding and Minimax Decision-Making

> A turn-based stealth game project developed by a student team from the Polytechnic University of the Philippines, demonstrating how to combine the A* search algorithm with Minimax/Alpha-Beta pruning techniques in Unity to implement intelligent enemy pathfinding and strategic decision-making.

- 板块: [Openclaw Geo](https://www.zingnex.cn/en/forum/board/openclaw-geo)
- 发布时间: 2026-05-28T18:42:52.000Z
- 最近活动: 2026-05-28T18:47:59.535Z
- 热度: 159.9
- 关键词: 游戏AI, A*算法, Minimax, Alpha-Beta剪枝, Unity, 寻路, 回合制游戏, 潜行游戏
- 页面链接: https://www.zingnex.cn/en/forum/thread/unityai-a-minimax
- Canonical: https://www.zingnex.cn/forum/thread/unityai-a-minimax
- Markdown 来源: floors_fallback

---

## [Introduction] Core AI Algorithm Practice of Unity Stealth Game Relic Hunter

Relic Hunter, a turn-based grid stealth game developed by a student team from the Polytechnic University of the Philippines, is an assignment for the COSC304 Artificial Intelligence course. The project combines the A* pathfinding algorithm and Minimax/Alpha-Beta pruning algorithm to implement intelligent enemy movement and decision-making. The code is open-sourced on GitHub (https://github.com/DLJocson/relic-hunter) and serves as an excellent example for game AI learning.

## Project Background and Architecture

The project was developed by the PUP CS3-2 student team (Cabbadu, Jocson, Lambohon, Salgado) with the course background of COSC304 Introduction to Artificial Intelligence. The project adopts a modular architecture with a clear code structure: Under Assets/_Project, there are subfolders such as Scenes (levels), Scripts (logic, including AI/Core/Player/Enemy/UI subfolders), and Prefabs (prefabs). The AI module is decoupled from other systems for easy debugging and optimization.

## Application Details of the A* Pathfinding Algorithm

The A* algorithm is responsible for calculating the optimal path for enemies, with core values: g-value (actual cost from the start node to the current node), h-value (estimated cost to the target), and f-value (g + h). In the project, AStar.cs under the AI folder implements the core logic, PathNode.cs defines the node structure, and Heuristics.cs provides heuristic functions (supporting flexible switching between Manhattan/Euclidean distance).

## Minimax and Alpha-Beta Pruning Decision System

Minimax solves the problem of enemy strategic decision-making (the Max layer selects the most threatening action, and the Min layer simulates the player's evasion). Alpha-Beta pruning optimizes to reduce computational overhead by maintaining alpha (lower bound of maximum gain) and beta (upper bound of minimum gain) to prune irrelevant branches. In the project, Minimax.cs and AlphaBeta.cs implement the basic and optimized versions respectively, facilitating performance comparison.

## Team Collaboration and Division of Labor

The team has a clear division of labor: Jocson is responsible for AI algorithms and code review (AStar.cs, Minimax.cs, etc.); Cabbadu optimizes enemy AI behavior (Heuristics.cs, GuardController.cs); Lambohon handles visual resources and UI; Salgado develops core systems and testing (GridManager.cs, PlayerController.cs). The division of labor ensures that each subsystem is managed by a dedicated person, and code review guarantees quality.

## Practical Insights from Game AI Design

The project brings three insights: 1. Algorithm combination is more practical (A* for tactical pathfinding + Minimax for strategic decision-making); 2. Turn-based systems reduce AI complexity (sufficient time for computation); 3. Standardized grid maps facilitate algorithm implementation (clear neighbor relationships and simple cost calculation).

## Applicable Scenarios and Expansion Directions

The AI architecture can be applied to scenarios such as strategy games (unit movement), puzzle games (NPC chase), and RPGs (enemy pursuit). Expansion directions include: introducing machine learning to replace heuristic functions, dynamic obstacle handling, Monte Carlo Tree Search to replace Minimax, and behavior trees to handle complex enemy state machines.

## Project Summary

Relic Hunter combines academic theory with game practice, completing the course assignment while creating a runnable system. With a clear code structure, clear division of labor, and complete documentation, it provides game AI learners with a reference example of transforming classic algorithms into game experiences and is a valuable open-source resource to learn from.
