Enemy Character Design in Computer Games Using Generative Approach

 

Yen-Feng Wu
  Graduate School of Computational Design
National Yunlin University of Science & Technology
Douliu, Taiwan, R.O.C.
e-mail: g9134706@yuntech.edu.tw

 

Sheng-Fen Chien

Department of Architecture
National Taiwan University of Science and Technology
Taipei, Taiwan, R.O.C.

e-mail: schien@mail.ntust.edu.tw

 

 

Abstract

The goal of this research is to build a generative system for developing new enemy characters. We start by analyzing the form and action of enemy characters in popular action games. We identify key features (forms) and behaviours (actions) of enemy characters and encode these features and behaviours as genes. Based on these genes, new enemy characters are generated using genetic algorithms.  The result is demonstrated through a modified Super Mario Brothers computer game.

1. Introduction

Computer games are the most popular entertainment. Unlike other forms of entertainment, such as movies and animations, computer games are highly interactive. The interactivity of a game is usually triggered by conflicts. In many computer games, conflicts are stages between the characters in the game and the players of the game.

Greg Costikyan defines that “a game is a form of art in which participants, termed player, make decisions in order to manage resources through game tokens in the pursuit of a goal” [1]. Salen and Zimmerman define that “a game is a system in which players engage in an artificial conflict, defined by rules, that results in a quantifiable outcome” [2]. The pioneering game designer, Chris Crawford stresses that a computer game has four common factors: representation, interaction, conflict, and safety [3]. In the quality of conflict, he states:

 “Conflict arises naturally from the interaction in a game. The player is actively pursuing some goal. Obstacles prevent him from easily achieving this goal. Conflict is an intrinsic element of all games. It can be direct or indirect, violent or non-violent, but it is always present in every game.” [4]

The enemy character in a game always provides the direct conflict and interaction with the players. Therefore, this research concentrates on the enemy character design in the field of game design. 

In early computer games, due to the computer hardware limitation, the enemy characters were designed using simple sets of pixels to represent their features [5]. The visual design of enemy characters requires clear feature and colour so that they can be easily distinguished from player characters. For example (see Figure 1): In the Pac-Man, there are four naughty ghosts chasing with Pac-Man. They are red ghost Shadow (Blinky), pink ghost Speedy (Pinky), blue ghost Bashful (Inky) and orange ghost Ponky (Clyde).



Figure 1. Pac-Man game

In action or shooting games, such as Defender and Space Invaders, the enemy characters were designed with the kinds of alien or space monster form to attack the player character (see Figure 2). They usually use different movement to get close to the player character, and shoot the player character with different missile or bomb.

  

Figure 2. Alien-like enemy characters

2. Action-Driven Design Concept Model

The action-driven design applies to the genres of games with action element. In these games, the features of enemy characters often correspond to their actions in games. For example, the enemy character “turtle” in Super Mario Brothers walks on the ground. A turtle with wings can walk and fly. The relationship of form and action in enemy character is the key to the action-driven design we are proposing. Let us use the enemy characters of Super Mario Brothers to explain the method. Table 1 presents the classification of enemy forms. The form of an enemy character is composed of Base Form, Attribute Form and Props Form. Each enemy character has a Base Form but may or may not have Attribute Form and/or Props Form.


Table 1. The classification of enemy forms

 

Classification

Explanation

Illustration

Base Form

The form belongs to creature itself, e.g., the mushroom form.

Attribute Form

The form belongs to creature itself, and it has special attribute for itself, e.g., the shell of turtle, or the wing of bird.

 Props Form

The form did not belong to creature itself, and is just a prop for itself, e.g., the hammer in hand or hat on head.

Each enemy form has a corresponding action. Table 2 shows the classification of enemy actions. When an enemy character has both Props Form and Attribute Form, it is also capable of Props Action and Attribute Action. The actual behaviour of an enemy character is performed according to the priority of actions: Props Action, Attribute Action and Base Action.

Table 2. The classification of action of enemy

 

Classification

Explanation

Illustration

Base Action

The action belongs to creature itself, e.g., legs can walk, fin can swim.

Attribute Action

The action belongs to creature itself. It has special action for attribute, e.g., the shell of turtle can protect, or the wing of bird can fly.

 Props Action

The action belongs to props itself, e.g., with hammer in hand can hammer the hero, or gun in hand can shoot.

 


3. Using Evolutionary Approach to Design  Enemy Characters

3.1 Genetic codes

We apply an evolutionary approach based on Genetic Algorithms (GAs) to create new enemy characters. New enemy characters are generated from the existing characters using two evolutionary mechanisms: crossover and mutation [6]. Each enemy character is a manifestation of a chromosome string that records the characteristic of the enemy character. The chromosome string contains three genes: Base, Attribute and Props and encodes the feature of form and action to binary code. Each gene is organized in two parts form and action because enemy actions are associated with their forms. Figure 3 illustrates an example chromosome in a 14-bit binary encoding where Base gene occupies 6 bits (4-bit form, 2-bit action), Attribute gene and Props gene each occupies 4 bits (3-bit form, 1-bit action).

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Base

Attribute

Props

Figure 3. Enemy Character Chromosome Example

3.2 Genetic operators

We use two genetic operators, crossover and mutation, as the genetive engine of our system.

Crossover

Crossover is an operation to generate a new string from two parent strings. It intermixes the existing chromosome population to create new chromosome. We apply two types of crossover operators.

Single-point crossover: A dividing point is selected from one of the three genes, namely Base, Attribute and Props. Figure 4-1 illustrates a crossover at the Base gene. The new Child1 inherits Base gene from Parent2 and Attribute and Props genes from Parent1.

Two-point crossover: All three genes are broken apart. Figure 4-2 illustrates the results in that Child1 inherits Base and Props genes from Parent1 and  Attributes from Parent2.

 

Figure 4. Illustrations of crossover operations

Mutation

Mutation is an operation to change the i-th binary code in the chromosome code. For example, Figure 5 demonstrates a parent chromosome (parent1) inverts one bit in Attribute gene to generate a new chromosome (child1), which would manifest as a new  enemy character.

 
Figure 5. Illustration of Mutation operator

3.3 Fitness Function

The fitness of a chromosome is the measure of its manifested enemy character’s survival rate (or strength). Each enemy character has initail fitness value in the generative system. The evaluation of fitness depends on the interaction results with players. At the moment, the fitness funtion records the start time when the enemy character appears on the screen the end time. The end time could happen in three conditions:

a. the enemy character is defeated by a player character,
b. the enemy character walks out of screen, or
c. the enemy character defeats a player character.

We formulate the fitness value of a chromosome as its on-screen survival time devided by the average on-screen survival time of the overall population. In the case that the enemy character defeats a player character, the survival time of this player character is counted as the enemy character’s survival time. In the way, the system adjusts fitness values dynamically according to the players’ performances.

4. Generative Enemy Design Implementation

In the section, we choose a well-known action game Super Mario Brothers as the example to illustrate our evolutionary approach. We use a 15-bit chromosome code, as illustrated in Figure 6. The Basic gene contains a 4-bit form code and a 1-bit action code. The 1-bit action code is a swtich that turns the base behavior on or off. The 4-bit form code records the base type of an enemy character’s form. We classified all enemy characters into 8 types of base form in Super Mario Brothers. For example, Koopa Troopas and Bussy beetle are classified as the turtle type (the first type) therefore their Base gene is the same of “00010” or “00011”.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Base

Attribute

Props

Figure 6. Enemy Chromosome String of Super Mario Brothers

Attribute and Props genes each contains a 3-bit form code and a 2-bit action code. As we examine the behavior of all enemy characters in Super Mario Brothers, we sort them into 6 types of Attribute form and 5 types of Props form. Furthermore, some Attribure and Props forms are associated with 2 types of actions. Therefore, we decide to use this encoding scheme. The enemy character population size in Super Mario Brothers is 15. They are shown in the Appendix section. In addition, with the chromosome as the combination of three 5-bit gene, this representation makes the implementation of genetic operators much simpler.

Using the evolution-based generative mechanism presented in the previous section and the population of enemy characters in Super Mario Brother, we build a generaive enemy design system to verify our concepts. Figure 7 illustrates an example of generating new enemy characters. The selected parents are Hammer Brother and Spiny. The new generation shows the new enemy characters with different attribute form or props form. These new enemy characters has never appeared in Super Mario Brothers therefore players may have new and fresh feeling to the game.

 

Figure 7. An example of  generating new enemy characters.

With the mechanism ready to generate new enemy characters, we are in the process of connecting the generative engine to Super Mario Brothers. We have imagined several scenarios of playing the new game. Figure 8 illustrates the new Super Mario Brothers game through some imaginary screenshots.

5. Conclusions

In this paper, we present an action-driven method in enemy character design. We take the advantage of computational mechanisms through an evolutionary approach based on genetic algorithms to create new characters in games.  This enables game designers to create a class of enemies quickly. These new enemies provide players with new challenges and new experience of the game.

 

         

 

      

 

 

     

 

Origin Version                      Generative VersionFigure 8. Imaginary screenshots of new Super Mario Brothers

References

[1]        Costikyan, G., 1994, “I Have No Words & I Must Design”, Interactive Fantasy #2,
<http://www.costik.com/nowords.html>
.

[2]        Salen, K. & Zimmerman, E., 2004, Rule of Play: Game Design Fundamentals. Cambridge: The MIT Press.

[3]        Crawford, C., 1997, The Art of Computer Game Design,  <http://www.vancouver.wsu.edu/fac/peabody/game-book/Coverpage.html>.

[4]        Crawford, C., 2003, Chris Crawford on game design, Indiana: New Riders.

[5]        DeMaria, R. & Wilson, J. L., 2002, High Score!: The Illustrated History of Electronic Games. McGraw-Hill.

[6]        Champandard, A. J., 2004, AI Game Development, Indiana: New Riders.

 

Appendix

NO

Enemy Characters

Picture/Name

Basic

Attribute

Props

 Binary code

 Binary code

 Binary code

01

Goombas

None

None

00001

00000

00000

02

Green Koopa Troopas

None

00011

00101

00000

03

Red Koopa Troopas

None

00011

00110

00000

04

Flying Koopa Troopas

0001­1

00101

00101

05

 Bussy beetle

None

 

00011

01101

00000

06

Spiny

None

00011

10001

00000

07

Lakitu

00011

10101

01010

08

Hammer Brother

None

00101

00000

01101

09

Boomerang Brothers

None

 

00101

00000

10001

10

Piranha plant

None

None

00111

00000

00000

11

Cheep Cheep

None

01001

11001

00000

12

Blooper

None

None

01011

00000

00000

13

Fire snake

None

None

01101

00000

00000

14

Missile Bill

None

01111

00000

10111

15

King Bowser Koopa

None

10001

00000

11001