# A Health Point-Based Dynamic Difficulty Adjustment Strategy for Video Games

Juan Suaza, Edwin Gamboa, María Trujillo

► To cite this version:

Juan Suaza, Edwin Gamboa, María Trujillo. A Health Point-Based Dynamic Difficulty Adjustment Strategy for Video Games. 1st Joint International Conference on Entertainment Computing and Serious Games (ICEC-JCSG), Nov 2019, Arequipa, Peru. pp.436-440, 10.1007/978-3-030-34644-7_42 hal-03652039

HAL Id: hal-03652039

https://inria.hal.science/hal-03652039

Submitted on 26 Apr 2022

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# A health point-based dynamic difficulty adjustment strategy for video games

Suaza Juan¹,², Gamboa Edwin¹,², and Trujillo María¹,²

¹ University of Valle, Cali, Colombia

² {juan.suaza, edwin.gamboa, maria.trujillo}@correounivalle.edu.co

**Abstract.** Commonly, video games make a clear division on the difficulty offered (e.g. Easy, Medium, Hard), causing that players often do not experience what game designers intended. In this document, we propose a dynamic difficulty adjustment strategy for health point-based video games based on a heuristic evaluation performed at play time. This means that a video game may change its difficulty based on players' performance while they play. To test our strategy, we implement a fighting video game and perform an evaluation with 10^th^ grade students from Institución Educativa Multipropósito. Based on our results, the students considered that the game is balanced, suggesting that this strategy is a viable choice to implement and test in other video games.

**Keywords:** Video games · Dynamic Difficulty Adjustment · Heuristics.

## 1 Introduction

Game balance is key to provide a fun and engaged experienced to players [2]. It is defined as a state where the game is fair for a player, providing him/her with challenges that match their skill. Commonly, video games make a clear division on the difficulty offered, e.g. Easy, Medium, Hard, being these difficulties subjective and unclear, specially to new players. Therefore, players do not often experience what game designers intended. On the other hand, there are video games that have a single difficulty, to deliver the intended experience designed. In some cases, causing players to quit because it is too hard.

In this document, we propose a dynamic difficulty adjustment strategy composed of two components: a playing agent with multiple difficulties and a heuristic function that swaps between them by measuring players' performance. To test our strategy, we implement a fighting video game and perform a Player Experience (PX) evaluation. The results show that the students considered the game is balanced and each component of the strategy serves its purpose.

## 2 Methodology

Our Dynamic Difficulty Adjustment (DDA) mechanism is based on the work done by [1] and [3], and extended to support more video games. It is composed of two core components: a heuristic function and a playing agent with multiple difficulty levels that will be swapped based on the heuristic value.
## 2.1 Playing Agent

The playing agent is the character players face during their play-through. This agent has difficulty levels that are interchanged based on a heuristic. A playing agent should have at least three difficulties: easy, intended, and hard.

The most common types of agents are Finite State Machines (FSMs) which allow an easy difficulty adjustment since FSMs rely on parameter values that can be changed to increase or decrease the difficulty.

## 2.2 Heuristic Function

A heuristic function is in charge of selecting the difficulty of the agents a player will face. To address this task, we identify two different scenarios: an immediate evaluation and a episodic evaluation:

**The immediate heuristic function** measures the *aggression of a player* using a proportion of the character's Health Point (HP) difference. Eq. 1 shows the proposed heuristic's equation.

$$H(PHP_c, EHP_c, PHP_m, EHP_m) = \frac{PHP_c}{PHP_m} - \frac{EHP_c}{EHP_m} \quad (1)$$

$H \in [-1, 1]$ and it is calculated every $T$ time-steps. $PHP_c, PHP_m, EHP_c, EHP_m$ are the current and maximum HP levels for both characters. $H = 1$ means the player has won and vice versa. The goal is to keep $H \approx 0$, meaning that both characters have similar HP such that they reach the end of a fight in similar conditions. For each difficulty level, different selection intervals need to be established to switch between them. For example, for three playing agents, the intervals would be: $[-1, -\alpha)$, $[-\alpha, \alpha]$, and $(\alpha, 1]$.

**The episodic heuristic function** measures how well a player has performed in the past levels, or gameplay episodes, of a video game. This heuristic's equation is shown in Eq. 2.

$$H(P) = \text{Count}(\text{Successful episodes}) - \text{Count}(\text{Player's deaths}) \quad (2)$$

$H$ is calculated after an episode has finished, $H \in \mathbb{Z}$. The count of successful episodes and player's deaths are natural numbers, including zero. If $H > 0$, means a harder difficulty should be selected and viceversa. An episode can be interpreted as a level, task, enemies defeated, among others, depending on the game.

## 3 The Forest of the Guardians

The Forest of the Guardians is a 2.5D fighting mobile video game developed to test the DDA proposed. The game consists on a 1 Vs. 1 fight against an agent. The agent uses a FSMs with three difficulty levels and the immediate heuristic.
## 3.1 Finite State Machine

The enemy uses a FSM that has four core combat states, described below:

- The *base attack* state casts *k* long-range attacks in the direction of the player.

- In the *move towards the player* state, the agent moves towards the player.

- The *melee attack* state is triggered once the agent is close enough to the player's character.

- Finally, in the *move away* state, the agent moves to the farthest corner/wall from the player's character. While in this state, if the player's character is close enough, the agent will transition to the *melee attack* state.

## 3.2 Difficulties

The three levels of difficulty proposed are: easy, medium, and hard difficulty. All of the FSMs variations have the same parameters. The parameters are shown in Table 1. These values were chosen experimentally.

<table><caption>Table 1: Difficulties' parameter values</caption><thead><tr><td>Difficulty</td><td>Attack speed (attacks/second)</td><td>Movement speed (units/action)</td><td>Armour points</td></tr></thead><tbody><tr><td>Easy</td><td>0.8</td><td>4</td><td>0</td></tr><tr><td>Medium</td><td>1</td><td>6</td><td>2</td></tr><tr><td>Hard</td><td>1.5</td><td>6</td><td>5</td></tr></tbody></table>

# 4 Strategy Evaluation

## 4.1 Participants

Nineteen 10^th^ grade students from Institución Educativa Multipropósito were involved in the evaluation process (58% are males and 42% are females). All the students were asked to play the game once. The students' age ranged from 15 to 18 years-old (Mean = 16.5, SD = 1.3).

## 4.2 Methods

**Player Experience Inventory** is a standardised questionnaire proposed by [4]. Player Experience Inventory (P XI) incorporates two sub-scales: the functional level, which evaluates the dynamics situated at the usage level, i.e., immediate consequences experienced; and at the psycho-social level, i.e., which exceed the usage level and focuses on the consequences at the psycho-social level.

## 4.3 Results and Discussion

**Immersion** presents positive results: 73.7% of students were not aware of their surroundings, 79% were immersed in the game, and all of the students were focused on the game. Even though there was another student playing another video game, students were focused on the fight; indicating that the Flow channel was achieved in some of them.
**Challenge** This dimension presents positive results, 63.1% of the students considered that the game was not too easy nor too hard to play; the remaining students show a neutral agreement. Similarly, 73.8% agree that the game was challenging but not too challenging; the remaining students have a neutral agreement.

Besides from the questions, a 74% win-rate is reported and an average remaining HP of 26%. Even though the remaining HP is low, which is one goal of the heuristic, the high win-rate shows that the game was probably too easy.

Considering these results we can argue that the game is considered balanced by a group of students. This means that the difficulty level assigned by the heuristic is adequate.

# 5 Conclusions and Future Work

As a result of this work, a dynamic difficulty adjustment strategy for HP-based video is proposed, including two heuristics that address different scenarios. One of the heuristics proposed was implemented in a video game and tested by 10^th^ grade students. Our results show that students considered the video game balanced, therefore it might provide a solution to motivate students to play a video game. In general, this strategy may be a viable solution to implement in other scenarios and video games. However, to fully establish if the strategy motivates students, longer evaluations with students are needed to corroborate that fact.

Based on our results, the immediate heuristic served its purpose: get both player to low health at the end of the fight, averaging a 26% HP remaining at the end of the fight. However, we are aware that the players' win rate is still too high (74%) implying that the FSM used was probably too easy for players.

As future work, longer evaluations are needed to validate if the proposed balancing strategy motivates students to play the game in the long-term. Moreover, the episodic heuristic should also be tested. Additionally, combining both heuristic functions is still a task to do.

# References

1. Brown, R., Guinn, C.: Developing game-playing agents that adapt to user strategies: A case study. In: Intelligent Agents (IA), 2014 IEEE Symposium on. pp. 51–56. IEEE (2014)

2. Csikszentmihalyi, M.: Beyond boredom and anxiety. Jossey-Bass (2000)

3. Silva, M.P., do Nascimento Silva, V., Chaimowicz, L.: Dynamic difficulty adjustment through an adaptive ai. In: Computer Games and Digital Entertainment (SBGames), 2015 14th Brazilian Symposium on. pp. 173–182. IEEE (2015)

4. Vanden Abeele, V., Nacke, L.E., Mekler, E.D., Johnson, D.: Design and preliminary validation of the player experience inventory. In: Proceedings of the 2016 Annual Symposium on Computer-Human Interaction in Play Companion Extended Abstracts. pp. 335–341. ACM (2016)