Skip to content
This repository was archived by the owner on Dec 3, 2025. It is now read-only.

sanzserif/GameAI_CW1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Unity Game AI Project - Intelligent Combat Arena

A Unity 3D game demonstrating advanced AI behaviors, procedural generation, and group coordination mechanics. This project showcases intelligent enemy agents with different AI architectures working together in dynamically generated environments.

๐ŸŽฎ Project Overview

This project implements two distinct gameplay experiences:

  • Section 1 (NPCScene1): Close-quarters combat in procedurally generated cave arenas
  • Section 2 (TerrainScene2): Open-world exploration with procedural terrain and biome systems

Key Features

  • Smart AI Enemies with Finite State Machines and group coordination
  • Procedural Content Generation using Cellular Automata and Perlin Noise
  • Dynamic Pathfinding with Unity's NavMesh system
  • Probabilistic Combat with critical hits and miss chances
  • Dual Camera System (First-Person and Top-Down views)

๐Ÿค– AI Systems

Patrol Bot (Red Enemy) - Sensor-Based AI

  • Technology: Raycast-based perception and navigation
  • Behavior: Uses Finite State Machine (Patrol โ†’ GroupChase โ†’ Retreat)
  • Intelligence: Dynamic path selection with anti-predictability algorithms
  • Special: Long-range planning with randomized decision-making to prevent loops

Hunter Bot (Violet Enemy) - NavMesh-Based AI

  • Technology: Unity's A* pathfinding system
  • Role: Squad leader that coordinates group attacks
  • Behavior: Advanced terrain navigation and global communication
  • Special: Broadcasts player location to other AI agents

Group Coordination

  • Leader-Follower dynamics between Hunter and Patrol bots
  • Shared state management through global memory system
  • Synchronized attacks when player is detected
  • Coordinated retreat when health drops below 30%

๐ŸŒ Procedural Generation

Arena Generation (Cellular Automata)

  • Algorithm: Cellular Automata for organic cave-like structures
  • Grid Size: 50x50 with 4 smoothing iterations
  • Parameters: 45% fill rate with fixed seed for reproducibility
  • Result: Bounded combat arenas with natural cover and open spaces

Terrain Generation (Perlin Noise)

  • Heightmaps: Generated using Perlin Noise with Animation Curves
  • Biomes: Altitude-based placement system
  • Features: Rivers, ice spikes, vegetation, and collectibles
  • Validation: NavMesh pathfinding verification ensures all areas are accessible

๐ŸŽฏ Combat System

Player Mechanics

  • Movement: Physics-based with Rigidbody (WASD controls)
  • Combat: Projectile-based shooting (Spacebar)
  • Health: 100 HP with damage cooldown and respawn system
  • Camera: Toggle between First-Person and Top-Down views (C key)

Probabilistic Combat

  • Player Critical Hits: 10% chance for double damage
  • Enemy Miss Chance: 20% probability of missing shots
  • Asymmetric Design: Favors player engagement while maintaining challenge

๐Ÿ› ๏ธ Technical Implementation

Core Technologies

  • Unity 3D with Universal Render Pipeline
  • NavMesh Surface for AI pathfinding
  • Physics System for realistic movement and collisions
  • Finite State Machines for AI behavior management

AI Architecture

  • Raycast-based sensors for environment perception
  • A pathfinding* through Unity's NavMesh system
  • Shared state management for group coordination
  • Probabilistic decision making for varied behaviors

๐Ÿš€ Getting Started

Prerequisites

  • Unity 2022.3 LTS or newer
  • Git (for cloning the repository)

Installation

  1. Clone the repository:
git clone https://github.com/[username]/GameAI_CW1.git
  1. Open Unity Hub and click "Add project from disk"

  2. Navigate to the cloned folder and select it

  3. Open the project in Unity

Running the Game

  1. Open either NPCScene1 or TerrainScene2 from the Scenes folder
  2. Press the Play button in Unity
  3. Use WASD for movement, Spacebar to shoot, C to toggle camera

๐ŸŽฎ Controls

Key Action
W/A/S/D Move player
Spacebar Shoot
C Toggle camera (First-Person โ†” Top-Down)
Mouse Look around (First-Person mode)

๐Ÿ“Š Performance Metrics

  • Generation Time: 0.5-8.3 seconds (depending on complexity)
  • Frame Rate: Optimized for 60+ FPS
  • Memory Usage: Efficient object pooling for projectiles
  • AI Response: Real-time decision making with configurable update frequencies

๐ŸŽฏ Educational Objectives

This project demonstrates:

  • AI Programming: FSMs, pathfinding, sensor systems
  • Procedural Generation: Multiple PCG techniques and algorithms
  • Game Systems: Combat, health, respawn, and UI systems
  • Performance Optimization: Efficient algorithms and Unity best practices

๐Ÿ“ Project Structure

Assets/
โ”œโ”€โ”€ Scripts/          # Core game logic and AI controllers
โ”œโ”€โ”€ Scenes/           # Game scenes (NPCScene1, TerrainScene2)
โ”œโ”€โ”€ PreFabs/          # Game objects and enemy prefabs
โ”œโ”€โ”€ Materials/        # Visual materials for different biomes
โ”œโ”€โ”€ Documentation/    # Academic documentation and images
โ””โ”€โ”€ Resources/        # Runtime loadable assets

๐Ÿ”ง Customization

AI Parameters

  • Modify detection ranges and movement speeds in enemy prefabs
  • Adjust FSM transition conditions in AI scripts
  • Tune pathfinding parameters in NavMesh settings

Procedural Generation

  • Change terrain parameters in TerrainGeneration script
  • Modify cellular automata settings for different arena layouts
  • Adjust biome placement algorithms for varied environments

๐Ÿ“š Academic Context

This project was developed as part of the 6CCGD007W Game AI coursework, demonstrating:

  • Advanced AI implementation techniques
  • Procedural content generation algorithms
  • Unity game development best practices
  • Performance analysis and optimization

๐Ÿ† Features Showcase

  • Dynamic AI Behaviors: Watch enemies adapt and coordinate
  • Procedural Worlds: Every playthrough offers unique environments
  • Intelligent Pathfinding: AI navigates complex terrain seamlessly
  • Engaging Combat: Probabilistic mechanics create exciting moments
  • Professional Quality: Polished systems ready for portfolio presentation

๐Ÿ“ License

This project is for educational purposes and portfolio demonstration.

๐Ÿ‘ค Author

Nipun Kariyawasam

  • Student ID: w1901979 / 20212143
  • Course: 6CCGD007W Game AI
  • Institution: University of Westminster

This project showcases advanced Game AI techniques including intelligent agents, procedural generation, and group coordination systems implemented in Unity 3D.

About

Unity 3D Game AI project demonstrating intelligent enemy behaviors, procedural generation, and group coordination mechanics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors