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.
- Standard probabilities dictate the AI's transitions between states.
- AI probabilities are adapted in real-time based on player actions and game events.
- I chooses the following state based on events or player actions following a rule-based approach..
- 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.
- 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.
- Attack 1: If successful, increase its probability.
- Attack 2: If successful, increase its probability.
- 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).
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.
- 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.
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
- Engine: Godot Engine
- Add-ons:[LimboAI](https://godotengine.org/
-
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.