It's free to join Gamasutra!|Have a question? Want to know who runs this site? Here you go.|Targeting the game development market with your product or service? Get info on advertising here.||For altering your contact information or changing email subscription preferences.
Registered members can log in here.Back to the home page.

Search articles, jobs, buyers guide, and more.

By Guy W. Lecky-Thompson
Gamasutra
September 17, 1999

Letters to the Editor:
Write a letter
View all letters


Features

 

Contents

Introduction

Predictably Random Numbers

Name Generation Techniques

Generating Random Terrain

Plot Sequencing

Code Listings

Listing 1

Listing 2

Listing 3

Listing 4

Listing 5

Plot Sequencing

Pulling all of these techniques together into a game requires the use of Plot Sequencing. This applies not only to the continuing story line (Event Sequencing), but equally to the placement of Game Elements. That is to say, the flow of the game is determined based on the location of Game Elements within the Universe. Since this placement has been determined algorithmically, the Event Sequencing must also be based on algorithms.

Earlier we illustrated how the pseudorandom number generator can be used to determine the placement of individual Game Elements (the example itself used stars). Now we must turn our attention to the characteristics of each star - the shape of the Game Elements will determine a large part of the addiction to the game in the mind of the player. It is the interaction of the Game Elements that make the player return for a second try.

Once we have determined the type of feature each Game Element should have, it is time to start choosing the actual values that each Element will have. In our example, we can say that each star may be host to a number of planets. Furthermore, each planet can have a number of moons. Of course, some stars will not have planets, and some planets will not have moons. Arbitrarily, we choose that 25 percent of the stars should have planets orbiting them, and that of those 10 percent should have moons.

To put this into effect, for each star there is a 25 percent chance that planets will be found in orbit around it, and that for each planet there is a 10 percent chance that it will, in turn play host to a moon.

Here again, we shall use the pseudorandom number generator, returning a value between 1 and 100, seeded on the serial number of the Game Element. As previously noted, each star can be assigned a serial number based on it’s position within the Universe. Using the same technique, each planet that orbits a given star can also be given a serial number based on its position relative to the star itself. Thus, we can seed the generator and decide upon the placement of moons.

One should not be dissuaded from using the same serial number for different Game Elements, since the characteristic that is defined by the result of the pseudorandom number generator will be different, and therefore distinct. Indeed, for extremely large Universes, it may be unrealistic to assign a unique number to each end every Element. One must assume that, in programming the game itself, the difference between Star-997854 and Planet-997854 is clearly definable.

At the beginning of the article, I used, as an example of a large Universe model, Elite by David Braben and Ian Bell. In this game, each star has other characteristics such as the type of population (from Human to Frogs), the political status of the system (Anarchic through Democratic), and commodity prices based on the industry type (Agricultural, Industrial, and so on). Each of these can be modeled using algorithms based on the pseudorandom number generator. It is the mixture of these Element Characteristics that give shape to the game.

Once these characteristics have been defined, it becomes possible to coordinate events in the Game Universe (the plot) based upon corresponding values of various characteristics with relation to the game player. This Universe Coherence lends an aspect to the game which is predictable and yet has it’s basis in the chaotic relationships defined by the application of pseudorandom algorithms.

For example, if the player travels to a system whose political bearing is anarchic, with a cargo of weapons, one can say that he is likely to be attacked by pirates. However, the same player travelling to a democratic system may in turn be subject to the attention of local police who wish to relieve him of his illegal arms cache. Exactly when the subject will be attacked, and by whom, is determined by the pseudorandom number generator. In order to further coordinate events, we may also choose Reference Points within the Universe. A Reference Point is simply a value that, when reached, triggers another sequence of events.

Imagine, for a moment, attempting to store all this information. It would require either large amounts of memory, or frequent hard drive or CD-Rom accesses. Either way, the penalties are stricter than the time it takes to determine the course of events using an algorithmic model. And it is not only the realms of outer space that are subject to this type of game development style. Almost all first person role playing games may also use this technique. We may wish to say that a particular door has a key that is stored on an island somewhere, exactly where, we may not care, and we can determine where it is located, how the player learns of its location and when it is applicable as the game unfolds, provided that we have defined a rich set of rules that specify, algorithmically, the nature of the game itself.

I mentioned earlier that the pseudorandom technique can be used to achieve Micro-Infinite Resolution. The preceding example is one illustration of this. Another way in which this could be demonstrated would be if we decided to put villages, or towns, on the squares. Then we could put a random network of streets within the towns, and buildings next to the streets. These building would have windows and doors, opening to rooms with furniture. Some of the furniture might have cupboards containing maps, keys, gold or weapons. As long as we keep zooming in and calculating the location of these objects based on their relative positions, there is no limit to the quantity of objects that we can locate in real time.

The techniques provided here only skim the surface of this approach; indeed, the ways in which it can be applied are limited only by the imagination of the game designer.

Guy is a recent graduate from the University of Derby, UK, where he received a First Class Honors degree in Computer Studies, specializing in the Design of Intelligent Agents ( thesis title ). Recently, he has taken an interest in the real time generation of game universes, studying techniques used in early memory-limited home computers. He works as a programmer for a financial institution management company in Brussels, Belgium.


 

[Back to] Introduction


join | contact us | advertise | write | my profile
news | features | companies | jobs | resumes | education | product guide | projects | store



Copyright © 2003 CMP Media LLC

privacy policy
| terms of service