Impact of Algorithmic Composition on Player Immersion in Computer Games: A Case Study Using Markov Chains

The feeling of immersion is an important aspect of gaming experiences. It can be greatly impacted by background music. In this work, we investigate the use of algorithmically-generated background music as a mean to generate immersion in gaming experiences. For such, we developed two versions of the same game. One of them uses music written by a composer. The other uses real-time generated melodies based on a Markov chain. We evaluated the immersion level related to each of these versions using user questionnaires and performance measures. The results did show only a small immersion difference between the versions. This indicates that algorithmic music can be a suitable option for game content generation.


Introduction
Algorithmic music generation can be a method for fast content creation while preserving great variability.In this paper, we evaluate the impact of algorithmic music on the feeling of immersion in digital games and compare it with that related to human-composed music.
Immersion in digital games has been defined in many different ways.Brown and Cairns [1] defined immersion as one's degree of involvement with a game.Ermi and Mäyrä [2] state that immersion could be defined as a sensation in which one's perception is completely taken over, being fully enveloped by an alternative reality.Brockmyer et al. [3] also refers to immersion as the potential to induce feelings of being part of the game environment, and that most video game players report experiencing some degree of immersion.
Immersion is a phenomenon that can be linked to diverse objective measurements [4].For this reason, we took into consideration various proposed methods to measure the player's awareness of their own immersion level.The experiment described in this work was based on the one described in Jennet's [5] and Zhang and Fu's [6] works.
In this experiment, the participants performed five activities: 1) solving a tangram puzzle, 2) playing the experimental game; 3) answering a questionnaire regarding immersion; 4) playing the game again, and 5) solving the same tangram puzzle as in step 1.Thus, the only difference between the control and test groups was the type of music playing during the game sessions (steps 2 and 4).Immersion levels were evaluated in both groups.
The results showed that the group of users playing the game with traditionally composed music had a slight higher immersion level than the group with procedurally generated music.However, the results didn't show a statistically significant difference in average immersion levels between the control and test group.This can mean that procedurally generated music, albeit a little less effectively, can be a viable alternative for game music production.This work is organized as follows.Section 2 discusses related work.The experiments performed in this work, as well as their results, are described in Section 3. A deeper discussion is conducted in Section 4 and, finally, Section 5 concludes the paper.

Related Works
A great number of works related to immersion in digital games and algorithmic generated music has been conducted in the last years.Jennet et al. [5] argues that players tend to have more difficult on switching from an immersive activity to a non-immersive one.Thus, after playing the game their performance on solving the tangram puzzle should be worse.To test this hypothesis the participants were asked to solve a tangram puzzle before and after a game session.Also, after the game session the players answered an immersion questionnaire.On the control group, instead of playing a game, the participants performed a computer task that involved clicking on squares appearing on the computer screen.The author's results indicates that, on average, the participants in the test group took more time to complete the tangram after playing the game, hence indicating that they had a higher immersion level.
Zhang and Fu [6] proposed an experiment to test if players would experience different levels of immersion playing a game with or without background music.Their experiment was based on Jennet's, comprising solving puzzles, playing the game for a pre-defined length and answering a questionnaire.The results showed that players in the group with background music reported experiencing a higher feeling of immersion.
Video games can be experiences with a very dynamical audiovisual environment.Thus, techniques for generating musical content procedurally could be exploited to deliver a more diversified material, or even one that bears a more meaningful relationship with the player's experience.
The GenJam model proposed by Biles [7] was inspired on the typical behavior of an improviser musician in the Jazz style.It uses genetic algorithms to generate phrases and melodies in real time, using a sequence of symbols representing musical notes in the form of discrete events.Combined, they form hierarchically related melody pieces, that is, measures, formed by musical notes, and phrases, formed by measures.In this model, the fitness of each individual (measure of phrase) is estimated by the behavior of the musician that interacts with the system.Also, statistical models generated interesting results, as it is the case of the OMax project [8].
It uses a multi-level Markov chain to simulate improvisation.Thus, after receiving MIDI events from a musician, it generates musical pieces with similar characteristics.Livingstone and Brown [9] propose in his experiment an environment with adaptive musics in digital games, altering musical elements in real time to communicate the desired emotions.To achieve this, it employs a set of rules relating emotions to these musical elements.According to the author, it successfully communicates emotions such 'Happy', 'Sad' and 'Dreamy'.
Besides that, models proposed for computerassisted composition, such as Mcvicar, Fukuyama and Goto [10], have showed promising results.This algorithm proposed by the authors analyzes rhythmic and melodic characteristics from transcriptions of musics played by guitarists from different styles.Then, these characteristics are employed to generate new musical pieces.Despite being different than the originals, these new musical elements have a great style similarity, being able to be used in a convincing way.Such work provides valuable insight towards the creation of procedural content in an interactive gaming environment.

Experiment
The game used in this work, as shown in Figure 1-a, is an infinite runner -that is, a game in which the character runs in an infinite track and must avoid obstacles and collect bonuses that helps their survival.In our game, the character loses one life point for each collision with a vehicle, and in turn recovers one life point by collecting a heart bonus (Figure 1-b).An hourglass bonus slows down vehicles to make it easier to avoid them (Figure 1-c).
Figure 2 shows the use of the two different background music types.For the Control Group, the pre-composed music in MIDI format was simply played by the game engine in an infinite loop.To generate the music for the Test Group, the same MIDI file used in the control group was split into two musical note lists representing its two melodies, and each list was further split into a list of note frequencies and a list of note durations.After that, we generated four Markov Chain models for the original music, one for each of the frequency or note lists.After this, each pair of models was used to generate a frequency and duration, joined into a musical note.
The two new notes would then be played, and the note generation process would be repeated as needed.Figure 3 shows an example of a Markov Chain modeling these events.The pre-composed music was a two-instrument arrangement of the 'Green Hill Zone' stage music, from the game 'Sonic the Hedgehog'.Figure 4-a shows an excerpt from the original music used for the control group.

Participants
The sequence of steps proposed on this experiment was based on previous work by Jennet et al. [5] and Zhang and Fu [6].In our experiments, we invited 38 participants students from FATEC Americana and divided them in two groups of 19.This research was approved by the Ethics Committee at the UNICAMP.All the participants were Technology of Game Development course students, with diverse age and gender.

Structure and Procedure
During the experiment, each participant was instructed to run the program to start the following procedures: 1) solving a tangram puzzle, 2) playing the game; 3) answering a questionnaire regarding immersion; 4) playing the game again, and 5) solving the same tangram puzzle as in step 1.The time limit for solving the tangram puzzle was defined as five minutes, due to time constrains related to the experiment location.
After 10 minutes of playing the game, the session was interrupted for answering the questionnaire.It contains 31 questions relating to immersion, with answers ranging from 1 (none) to 5 (very much).
After answering the whole questionnaire, the participant returns to the game session for another 10 minutes.Finally, after this session the player must solve the same tangram puzzle as in the first step.Figure 5 summarizes the experiment steps.
Performance data was also collected throughout the whole player's participation.This data comprises best and worst score in both game sessions, the time interval required to solve the first and second puzzles, and the performance improvement in solving the puzzle.

Results
We analyzed the interaction between elements that indicate a higher level of immersion with the different types of music to which the participants were exposed during game sessions using data collected on task execution and answers from the questionnaire.Figure 6 presents the means and standard deviations of each of the evaluated aspects in the control and test groups, and Figure 7 shows the mean and standard deviations related to each question of the immersion questionnaire.
As shown in Figure 6, the participants in the control group (with pre-composed music) presented a greater mean score in their responses in the immersion questionnaire.However, the group with algorithmically generated music had a smaller gain in performance on solving the puzzle for the second time.This can indicate a greater cognitive effort while playing on the intermediate step, making it more difficult to fixate or transfer the knowledge acquired on the first attempt to solve the tangram puzzle.

Discussion
The idea that music generated by an algorithm could be linked to a higher cognitive effort is reinforced by the most favorable answers in the group with algorithmically generated music to questions such as 'Have you felt you were giving your best?'.It also suggests that this feeling is not exactly the same as the one accentuated by the pre-composed music.The latter would be more related to a feeling of emotional involvement, or of an experience with a stronger aesthetic component.This may be verified with This result contradicts the findings of the ex-periments made by [5] and [6], in which a higher score in the immersion questionnaire was related to a larger increase in performance when solving the puzzle.This suggests that the presence of music generated by algorithms would be tied to a higher cognitive effort while gaming, but not necessarily to the totality of the more broad phenomenon described as immersion.
It is also worth noting that the overall immersion score mean was not high.That fact could be attributed to the total length of the experiment (from 30 to 50 minutes).This could lead to users feeling fatigued, and thus affecting their responses.Also other factors during the experiment execution could have impacted the results, such as noises and other distractions from other participants.

Conclusion
In this work, we conducted an experiment to evaluate the impact of using algorithmicallygenerated background music in player immersion in digital games.For such, we performed a user study in which half of the subjects played a game with human-composed music and the other half played a similar game, with computergenerated music.Results show that algorithmic music reinforces cognitive aspects of immersion, whereas human-composed music is linked to higher aesthetic and emotional aspects of immersion.This suggests that algorithmically composed music can be a viable alternative to looping music for game content generation.
Furthermore, this work raises questions about the impact of algorithmically generated music in game immersion.We speculated that different genres of games could be affected differently.Also, different compositional techniques could be employed to observe the effects from procedurally generated music with an emphasis on the harmonic structure, or even the instrument or timbre choices.Investigation on these topics will be conducted in future work.

Figure 1 :
Figure 1: Experimental Game ScreenShot.The character is inside the highlighted circle (a).The character has to avoid the vehicles and collect the bonus hearts (b) and hourglasses (c).

Figure 4 -
b to Figure 4-e show four example segments generated with the Markov Chain for the control group.

Figure 2 :
Figure 2: Process used to generate background music for the control group (MIDI loop) and the test group (procedurally generated music).

Figure 3 :
Figure 3: Example Markov Chain that can be used to automatically generate content.

Figure 4 :
Figure 4: Control melody excerpt (a) and four example melodies generated for the experiment group (b-e).

Figure 5 :
Figure 5: Flowchart describing the experiment.It begins with a tangram puzzle, proceeds to game playing, then to a immersion questionnaire.After that, playing is repeated and the tangram puzzle is solved again.

Figure 6 :
Figure 6: Mean and standard deviation by parameter and by test or control group

Figure 7 :
Figure 7: Mean and standard deviation for answers to each question in the immersion questionnaire.