This project is a comprehensive implementation of advanced Game AI techniques, demonstrating high-performance pathfinding algorithms, sophisticated agent behaviors using Behavior Trees, and machine learning-based decision-making through Decision Tree Learning. The project showcases a complete workflow from hand-crafted AI systems to machine learning-optimized solutions, achieving 45% faster decision-making while maintaining equivalent behavior.
- Dijkstra's Algorithm: Complete implementation for optimal pathfinding
- A Search Algorithm*: Enhanced with multiple heuristic functions
- Large-Scale Optimization: Handles graphs with up to 10,000 nodes and 100 million edges
- Advanced Heuristics: Manhattan distance and Haversine formula for 2D grids and geographical coordinates
- Velocity Matching: Synchronized agent movement
- Orientation Matching: Coordinated agent rotation
- Position Matching: Precise spatial alignment
- Wander Behavior: Natural autonomous movement patterns
- Flocking Behavior: Emergent group behaviors with multiple agents
- Modular Decision-Making: Complex, stateful agent AI
- Hand-Crafted Logic: Sophisticated behavior tree implementation
- Interactive Visualization: Real-time behavior visualization using SFML
- Decision Tree Learning: Custom implementation from scratch in Python
- Data Generation Pipeline: Automated telemetry collection from game sessions
- Model Training: Gini impurity-based classifier training
- Performance Optimization: 45% faster decision-making compared to Behavior Trees
| Technology | Purpose |
|---|---|
| C++17 | Core simulation, pathfinding, and agent logic |
| Python 3 | Decision Tree Learning algorithm |
| SFML 2.5 | 2D graphics, windowing, and visualization |
| Boost C++ | Graph data structures and algorithms |
Game-AI-Pathfinding-Decision-Trees-and-Behavior-Trees-master/
โ
โโโ 01_Basic_Agent_Behaviors/ # Fundamental agent behaviors
โ โโโ adiyora_solution/
โ โโโ Task_2/ # Basic movement behaviors
โ โโโ Task_3/ # Advanced interaction patterns
โ
โโโ 02_Steering_Behaviors/ # Autonomous steering behaviors
โ โโโ task1/ # Velocity matching
โ โโโ task2/ # Orientation & position matching
โ โโโ task3_final/ # Wander behavior (optimized)
โ โโโ task4/ # Flocking behavior
โ
โโโ 03_Pathfinding_Algorithms/ # Pathfinding implementations
โ โโโ adiyora_solution/
โ โโโ Task2-small/ # Small graph pathfinding
โ โโโ Task2-large/ # Large graph optimization
โ โโโ Task3/ # Heuristic analysis
โ โโโ Task4/ # SFML visualization
โ
โโโ 04_Behavior_Trees_and_Decision_Trees/ # AI decision-making systems
โโโ Submit/
โโโ Task1/ # Manual decision tree
โโโ Task2/ # Behavior tree implementation
โโโ Task3/ # Learned decision tree
โโโ Task3_data_collection_new/ # Data generation
โโโ DecisionTreeLearning.py # ML training script
- C++ Compiler (GCC 7+ or Clang 5+)
- Python 3.6+
- CMake (optional, for some modules)
- SFML 2.5+
- Boost C++ Libraries
# Update package lists
sudo apt-get update
# Install Boost libraries
sudo apt-get install libboost-all-dev
# Install SFML
sudo apt-get install libsfml-dev
# Install Python 3
sudo apt install python3# Using Homebrew
brew install boost sfml python3- Install vcpkg or use pre-built libraries
- Install Boost and SFML through vcpkg or download pre-compiled binaries
- Install Python 3 from python.org
Each module can be built and run independently:
# Navigate to the desired module
cd 02_Steering_Behaviors/task1
# Clean previous builds (optional)
rm -rf main main.o
# Compile
make
# Run
./main-
Generate Training Data:
cd 04_Behavior_Trees_and_Decision_Trees/Submit/Task3_data_collection_new make ./main # This generates data.csv with agent telemetry
-
Train the Model:
cd 04_Behavior_Trees_and_Decision_Trees/Submit python3 DecisionTreeLearning.py -
Implement Learned Tree:
- Copy the output tree structure from the Python script
- Implement it in
Task3/main.cpp - Build and run to see optimized AI behavior
| Metric | Behavior Tree | Learned Decision Tree | Improvement |
|---|---|---|---|
| Decision Time | Baseline | 45% faster | โก 45% |
| Behavior Accuracy | 100% | 100% | โ Equivalent |
| Code Complexity | High | Low | ๐ Reduced |
The project includes interactive visualizations for:
- Pathfinding Algorithms: Real-time path computation and visualization
- Steering Behaviors: Agent movement patterns and flocking
- Behavior Trees: Decision-making process visualization
- Decision Trees: Learned tree structure representation
Screenshots and visual outputs are available in each module's screenshots/ directory.
- Dijkstra's Algorithm: Guaranteed shortest path finding
- A Search*: Optimal pathfinding with heuristic guidance
- Heuristic Functions:
- Manhattan distance for grid-based navigation
- Haversine formula for geographical coordinates
- Large-Scale Optimization: Efficient handling of massive graphs
- Kinematic Steering: Direct velocity and rotation control
- Dynamic Steering: Acceleration-based movement with realistic physics
- Flocking: Emergent behaviors through local rules (separation, alignment, cohesion)
- Composite Nodes: Sequences, selectors, and decorators
- Leaf Nodes: Actions and conditions
- State Management: Persistent blackboard for agent memory
- Modularity: Reusable behavior components
- Decision Tree Learning: Custom implementation using Gini impurity
- Feature Engineering: Environment state and agent context
- Data Collection: Automated telemetry from game sessions
- Model Translation: From Python to optimized C++ implementation
Fundamental agent movement and interaction patterns. Demonstrates core concepts of agent-based systems.
Advanced autonomous steering behaviors including velocity matching, orientation control, wander patterns, and emergent flocking behaviors.
High-performance pathfinding implementations with support for both small and large-scale graphs, including visual demonstrations.
Complete AI decision-making system showcasing:
- Hand-crafted Behavior Trees for complex agent logic
- Machine learning pipeline for data collection and model training
- Optimized Decision Tree implementation achieving 45% performance improvement
This is a portfolio project demonstrating advanced Game AI techniques. For questions or discussions, please refer to the implementation details in each module's README.
This project is for educational and portfolio purposes.
Anjan Diyora (adiyora)
- Portfolio project demonstrating Game AI expertise
- Implementation of pathfinding, steering behaviors, and machine learning for game AI
- SFML community for excellent graphics library
- Boost C++ Libraries for graph data structures
- Game AI research community for algorithms and techniques
Built with โค๏ธ for Game AI Development
โญ Star this repo if you find it helpful!