Skip to content

Ia50nas/Artificial-Intelligence-Videogame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AI in Souls-Like Games


Overview

This project aims to study and implement artificial intelligence (AI) mechanics inspired by "Souls games" into a custom-designed 2D game. The game is created in the Godot game engine. The focus is on developing adaptive AI that reacts to player behavior, creating challenging, immersive, and engaging experiences. The game will feature AI-driven enemies that adapt to player strategies, punish repetitive actions, and foster dynamic encounters.

In this game, there are two modes: "Normal" and "Hard." The primary difference between the two modes lies in the AI opponent's adaptability. The AI of the game is implemented and operated using a Markov Decision Process (MDP) algorithm where the transition between states is determined by probabilities.


Game Modes

Normal Mode

  • Standard probabilities dictate the AI's transitions between states.

Hard Mode

  • AI probabilities are adapted in real-time based on player actions and game events.

Rule Based Mode

  • I chooses the following state based on events or player actions following a rule-based approach..

Hard Mode AI Mechanics

1. Reactivity

  • When hit, the AI turns to face the player before choosing its next action.
  • If recently hit the AI increases the probability of attacking for the following two seconds.

2. Health-Based Behavior

  • As health decreases, the AI becomes more aggressive:
    • For every 50 health lost, the probability of attacking increases.
    • If health drops below 5%, enter "panic mode":
      • Attack left and right have a huge increase in range.
      • Reduce walking probability to a range of 1.
      • Reduce buff probability to a range of 5.

3. Attack Performance

  • Attack 1: If successful, increase its probability.
  • Attack 2: If successful, increase its probability.

4. Proximity-Based Behavior

  • If the player is close:
    • Decrease the probability of walking.
    • Prioritize attack 1 and attack 2.
  • If the player is far:
    • Increase the probability of Attack 2(long range attack).
    • Decrease the probability of Attack 1(short range attack).


Rule-Based Mode - Lord of Cynder AI

This mode introduces a rule-based AI approach instead of a probabilistic algorithm. The AI decides its actions solely based on player location, actions, and other game events.

Lord of Cynder AI Ruleset:

  • If the player is within the distance of Attack 1 → Perform Attack 1.
  • If the player is within the distance of Attack 2 but not Attack 1 → Perform Attack 2.
  • If the player is outside of the attack range of both attacks → Use Buff ability.
  • If AI is buffed and the player is outside of range → Move towards the player.
  • If AI just took 3 hits (or 50 damage) → Walk back once.
  • If AI takes damage from behind → Turn around immediately.
  • Create a vision cone → If the player is within vision, follow the player.

This mode makes the AI more deterministic and strategy-driven rather than probability-based.


Variables Monitored

The AI system tracks and responds to the following variables in real-time:

  • Successful player hits.
  • Damage taken from the player.
  • Player health percentage.
  • AI health percentage.
  • Distance from the player (Counted in pixels).
  • Direction of damage (Right or Left).
  • Enemy Vision

Technology Stack


Features

  • Adaptive AI Mechanics:

    • Real-time probability adjustments (Hard Mode).
    • Reactive decision-making based on in-game variables.
    • Rule-based deterministic AI behavior (Rule-Based Mode).
  • Dynamic Game Modes:

    • "Normal" mode for standard AI.
    • "Hard" mode with advanced adaptive behavior.
    • "Rule-Based" mode for deterministic, logic-driven AI encounters.
  • Challenging Encounters:

    • AI punishes repetitive actions.
    • Encounters evolve based on player performance.
    • More strategic behavior in Rule-Based Mode.

About

Study how different AI implementations affect the experience, reactivity, difficulty and intelligence of the opponent

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors