This paper presents the design, development, and test results of a tool for adjusting properties of emergent environment maps automatically according to a given scenario. Adjusting properties for a scenario allows a specific scene to take place while still enables players to meddle with emergent maps. The tool uses genetic algorithm and steepest ascent hill-climbing to learn and adjust map properties.Using the proposed tool, the need for time-consuming and labor-intensive parameter adjustments when setting up scenarios in emergent environment maps is greatly reduced. The tool works by converting the paths of events created by users (i.e., the spreading of fire and the flow of water) for a map to the properties of the map that plays out the scenario set by the given paths of events. Vital event points are preserved while event points outside the given scenario are minimized. Test results show that the tool preserves more than 70 percent of vital event points and reduces event points outside given scenarios to less than 3 percent.
For computer games that rely on players interacting with the game maps, emergent and realistic
environments become crucial to their degree of realism. Emergent environments
can be created on a map by dividing the map into cells, augmenting the cells
with various physical properties, and building rules for influencing properties
between each cell [
Emergent maps have
been widely used in ecological modeling [
We present in this paper a hybrid of genetic algorithm and steepest ascent hill-climbing for adjusting properties of every cell on a cellular automata map in order to produce a given scenario. With a tool based on our technique, game developers are able to focus on designing their scenario and spend much less time setting cell properties. Controllable games scenarios lead to the following features, which are usually unavailable in emergent games.
(i) Editable scenario—scenario are very important for games. Crucial moments in a game story can be revealed using well-set scenarios. Furthermore, a well-set scenario can provide challenge for players. Normally, a scenario is played out using scripts, sacrificing any possible interactions from players. Our editable scenario is different. Developers can specify how a scene is played out just like writing scripts to dictate what happens during the game, but the environment remains emergent throughout the entire play.
(ii) In-game cut scene—although cut scenes produced as movies can be used, in-game cut scenes can tell stories while players are still in the middle of scenarios, without disrupting game flow.
Regarding game environment, Sweetser and Wiles [
A probabilistic model can also be used to simulate fire in broad scale
over long time periods [
Hill-climbing can be used for tuning system parameters. Merz et al. [
Neural networks can also be used for parameter tuning. Legenstein et
al. [
Breukelaar and Bäck [
We base our cellular automata maps and rules on EmerGEnT system [
Waypoint.
Each individual in
our population contains 2 strands of chromosomes, chromosomes that store
properties related to fire (see Figure
Chromosome for fire event.
Chromosome for water event.
Our genetic
algorithm has population of 1000 chromosomes and evolves for 100 generations. The
initial population is generated randomly, with some limited range defined for
each value in order to speedup convergence. A new generation is selected from
the following.
The highest fitness chromosome. The first 1% elitist chromosomes. These will be subjected to mutation. The crossover of chromosomes chosen by (
Our genetic algorithm uses elite strategy because it tries to select elite chromosomes
first. The first 1% of the highest fitness chromosomes is selected for certain
and the rest are in the top half:
Mutation rate of 10, 20, and 30% were tested on the 3 sample maps above. It was found that the mutation rate of 20% gave the best result on average. Therefore, we choose the mutation rate of 20% for our genetic algorithm. The mutation range is constrained to be within 50 units away from the old value in order to prevent very odd chromosomes with low fitness from being produced.
The fitness value of
each chromosome is calculated from the average of the fitness of each time unit
that events occur, with weight defined by (
The fitness of each
time frame before weighing (
The value of
(i) If a cell outside specified paths produces events—lose 1 point if an adjacent cell is inside any event path. If the cell does not have any adjacent path, 5 points are deducted instead. This discourages events outside the specified path.
(ii) If a cell does not produce an event when the event is set to occur—gain points equal to two times the cell temperature divided by maximum temperature if the event is a spreading of fire. The maximum score obtainable from this portion of the function is 2. Water events get no score here. The reason the fire situation gets some score even though the cell does not produce the event is because high temperature gives the cell a probability of burning in later time frames, which can result in similar fire events later on.
(iii) If a cell produces an event at its
specified time—gain 8 points. Get additional
points according to (
(iv) If a cell produces a specified event before its intended starting time, but not more than 1 time unit—gain 4 points. This is to allow a slightly different scenario to still gain points.
(v) If a cell still produces a given event after its intended end time, but not more than 4 time unit—in case of fire, gain 5 points minus the difference between current time and end time. If the difference in time is just 1, the score will be 4, similar to the score when an event takes place before its intended starting time. But we give points for other nearby time frames in order to allow for fire trails. From our experiments, fire trails are very important for an overall fitness of fire events. There is no score for water remaining in a cell, however, since our system follows Sweetser's model that lets water stay in a cell indefinitely.
We use steepest ascent hill-climbing to the best chromosome,
with the same fitness function as our genetic algorithm, in order to improve map's
properties. Table
Result of hill-climbing test.
Setting | 20th–100th | 60th–100th | 100th | Not use |
---|---|---|---|---|
Average Map 1 | 0.516818 | 0.542901 | 0.527788 | 0.476567 |
Average Map 2 | 0.448464 | 0.457916 | 0.447966 | 0.406109 |
Average Map 3 | 0.669976 | 0.66909 | 0.669541 | 0.669655 |
Average All | 0.545086 | 0.556636 | 0.548431 | 0.517444 |
In the first setting, we start applying it at the 20th
generation. In the second setting, we start applying it at the 60th generation.
In the third setting, we apply the algorithm only to the last generation (100th
generation). In the fourth setting, we do not use steepest ascent hill-climbing
algorithm. Each setting is tested on three different maps of
int tuneValueFire = 27; real bestFitness; for each cell
The result shows that,
on average, tests that steepest ascent hill-climbing are applied to have
noticeably better fitness values than the tests without steepest ascent hill-climbing.
From Table
Our tool for adjusting properties of emergent environment maps is in the form of a map editor. We name the editor emergent editor. Its features can be divided into 4 parts.
(i) Path editor (Figure
Path editor.
(ii) Automatic properties adjustment (Figure
Automatic properties adjustment.
(iii) Event player (Figure
Event player.
(iv) Property editor (Figure
Property editor.
In this section, we first discuss results from experiments using genetic algorithm enhanced by steepest ascent hill-climbing (which gives better results than using genetic algorithm alone). Then we discuss whether using steepest ascent hill-climbing really gives significantly better results statistically. Finally, an experiment showing how our parameter-tuning tool can help map designers save time is presented.
Testing is initiated by creating paths of events randomly on
a map of
Figure
Test result.
Figure
Test scenario.
There are 11 tests that our tool gives less than half of events correctly at waypoints. When we look into their causes, we discover that their scenarios are impossible to take place. Fire was set to burn longer than the fuel in the map could support. Water was set to flow too quick or too far from its source. In our system, the further away from its source, the slower the water can flow. This is because there are more cells to absorb water.
In order to find out whether steepest ascent hill-climbing
significantly enhances the accuracy, we run the experiment again, with and
without steepest ascent hill-climbing, and compare their results using a paired
The paired
From the
In order to test whether the tool that uses our parameter-tuning
technique actually benefits scenario designers, we perform an experiment by
having 6 testers manually tune the maps from Section
Tuning accuracy results from testers and the tool.
Tester ID | Waypoint preserved | Outside path |
---|---|---|
(%) | (%) | |
1 | 55.68 | 1.23 |
2 | 61.11 | 0.00 |
3 | 62.47 | 0.00 |
4 | 42.22 | 45.47 |
5 | 51.11 | 0.00 |
6 | 35.56 | 0.00 |
Average tester | 51.36 | 7.78 |
result | ||
Our tool result | 76.05 | 10.06 |
From Table
From our experiment, we conclude that genetic algorithm, with help from steepest ascent hill-climbing technique, can be used effectively for adjusting parameters in emergent maps which leads to simple-to-control scenarios without the need to manually edit any property.
Some problems, such as fire burning out before the expected ending time and water running too slowly or too short in distance, still need to be solved. This can be solved by having the algorithm also adjust the initial temperature of fire and the amount of water at the first waypoint. There are also other possible improvements. It may be useful to allow users to control scenarios with other means besides creating paths of events. Increasing the speed of the tool will allow a better use with bigger maps and more complex environments. Other kinds of emergent environments, such as environments used for actual ecological modeling, are good candidates for expanding the value of our tool.
This research is sponsored by Faculty of Engineering, Chulalongkorn University, Bangkok, Thailand.