1.2 Game design


Many programmers have at some point in their lives been obsessed with computer games . Programming itself is the 'big game', the meta-game, a game made the more enticing by the fact that the points you score can be real-world fame and fortune . Programming has a lot of the elements of gaming at its best. Why settle for gaming when you can program ?

Of course when you're programming, you need something to program about , and this is where computer games are useful in another way. Not only do computer games get you started with the computer, they are in and of themselves interesting things to try and program. Even a simple game program is reasonably challenging, and it's very easy to tell if a simple game works or not. And once you get started with game programming, you have the possibility of building up your program until it becomes something quite large and impressive. Another plus is that it's often possible to get your friends and family to play with your games, which is rewarding .

Computer games are especially interesting as programming projects because they draw on such a wide range of skills, including the following.

  • Computer graphics “ to get the game on the screen.

  • Physical simulation “ to make the objects move realistically .

  • Artificial intelligence “ to make your virtual enemies worthy opponents.

  • Computer art “ to provide beautiful images.

  • Computer sound “ to provide effects and background music.

  • Interface design “ to make the game interesting and intuitive to use.

  • Code optimization “ to make the runspeed high enough.

Another good thing about computer games is that the lessons that we learn from designing games can be carried over into our non-game programs. So let's make some games!

A fresh look at the dimensionality of games

Ordinarily people speak of games being either two-dimensional, three-dimensional or two-and-a-half-dimensional. The first two are fairly easy to explain: the older arcade games with flat shapes moving in a plane are two-dimensional, while the newer console and computer games where the player moves about in a virtual reality are three-dimensional. The 2.5-dimensional case refers to those games that view a three-dimensional world from a fixed direction “ popular examples of this are the Maxis games SimCity and The Sims. We don't regard these games as fully three-dimensional because we aren't able, for instance, to move our viewpoint down into the streets of SimCity and look up at the buildings as we could in a truly three-dimensional game. From a programming point of view, 2.5-dimensional games are closer to being two-dimensional than to being three-dimensional; one builds up a 2.5-dimensional game by drawing a limited number of two-dimensional layers .

But now, for the rest of this subsection, we want to use a quite different and somewhat idiosyncratic way of talking about the dimensionality of games. Temporarily set aside your usual ideas about game dimensionality and get ready to look at things in a novel way. What we will do here is to talk about three separate dimensionalities: the player motion, the world motion, and the viewer motion.

Just to make sure we're in synch here, recall that a dimension is a degree of freedom. The motion of a barnacle on a rock is zero-dimensional, it never moves. A car on a road or a bug crawling along a thin twig is moving one-dimensionally, it can go forward or backwards and that's all. A horse galloping across a prairie enjoys two-dimensional motion, and birds and fish move three-dimensionally. A person's motion upon the surface of the earth is largely two-dimensional, although at small length scales you do have three-dimensional freedom: you can jump up and down, and you can zoom your hands around.

All computer games have two key elements: the player and the world. In many games the player is in some way represented on the screen: as a cursor tool, as a moving figure, or as a hand holding a weapon. The world is the scenery and objects that you see on the screen. We can try and classify games in terms of the dimensionality of the player's motion, the dimensionality of the motions of other objects in the world and the dimensionality of the viewpoint motion.

Table 1.1. The dimensionalities of some familiar kinds of games.

Games

Dimensionality of player's motion

Dimensionality of the world motions

Dimensionality of the viewer motion

Shooting gallery type

1

Space Invaders

1

1.1

Centipede

1

1.5

Galaga

1

1.5

1

Defender

2

1.25

1

Slot Car Race

1.25

1.25

Atari Rally Race

1.75

1.1

1.75

Pong, Breakout

1

2

Asteroids

2

2

PacMan

1.25

1.25

Tetris

2

1

Mario

1.5

1.5

1

King's Quest

2

2

2

Gauntlet

2

2.5

2

SimCity, The Sims, Age of Empires

2.5

2.5

2.5

Doom, Quake, Half-Life

3

3

3

Flight simulators

3

2.5

3

Table 1.1 gives the names of some games and numbers for the three kinds of dimensionality for each. In some cases we've used a fractional dimension to suggest the idea of being in between two dimensions. If you happen to have heard of the mathematical shapes called 'fractals,' you might wonder if the fractional dimensions in this table are meant to be like fractal dimensions in the mathematical sense “ and the answer would be no. The fractional dimension numbers are used here in a somewhat loose and metaphorical fashion. Thus a motion dimension of 1.25 is used here to refer to a two-dimensional motion which is in some way constrained to be close to straight-line motion, and a motion dimension of 1.5 is used to mean a two-dimensional motion that's a bit less constrained.

Harking back to the notion of '2.5-dimensional' games mentioned at the start of this subsection, we can see that this fits in with our new usage, if we regard a 2.5-dimensional world as a three-dimensional world in which the inhabitants are constrained to move in certain orderly ways, being mostly limited to moving in a particular plane.

In looking at the table and reading the discussion, keep in mind that if there are some number values you disagree with, it's possible that you're right. The point is to get you to start thinking about computer games in a novel way, not to pronounce certain number values as being true once and for all.

We will sometimes speak of a game whose dimensionalities are, respectively, a, b, and c as having an (a, b, c) 'dimension signature'.

The most rudimentary games are the shooting gallery type in which the user controls a little gun sitting still at the bottom of the screen. A row of targets “ things like bullseyes and ducks “ moves across the middle of the screen. The user presses a key to shoot bullets up at the objects. The user's motion is zero-dimensional, for the gun never moves. And if all that the targets do is move along a steady line from right to left, we can think of the world as being essentially one-dimensional. Admittedly there is a two-dimensional element here because the gun's bullets do move vertically, unlike the horizontally moving targets. But, this is hardly a motion at all really, for the only thing the bullet's motion does is to establish a fixed time-lag between when the user presses the shoot key and when the target might explode.

Like most of the early computer games, the shooting gallery type has a zero-dimensional viewer motion, which is just another way of saying that the user has no control over the viewpoint. In the early games one simply sits above the world, looking at all of it at once.

In a variation on the shooting gallery game that was called Missile Command, the user was allowed to rotate the barrel of the gun so that it shoots in different directions. In a typical game like this, the user might be firing missiles at plane-shaped targets. We can think of the gun rotation as a degree of freedom, so for these games it would make sense to say the user's motions are one-dimensional.

In a Space Invaders style game, the user has a gun at the bottom of the screen, but now the gun can move back and forth. And instead of moving across the screen, the objects are now moving steadily downward. The player is trying to shoot the objects before they touch the bottom. In non-violent variations of this game, the user is 'catching' the falling objects rather than shooting them.

Note that if the gun can move back and forth it usually can't rotate. This is because giving a user too many degrees of freedom in the controls can make the game confusing to play.

In classic Space Invaders, the steady, unrelenting downwards-only motion of the game objects is just a shade above one-dimensional. This is because the enemies jiggle back and forth in synch with a sound the game makes. But the jiggling is quite restrained; thus one might call the motion 1.1-dimensional.

More advanced offshoots of the Space Invaders game, such as Centipede, have target objects which swoop wildly back and forth as they move down. This isn't a true two-dimensional motion, since the objects always do move downwards, so let's put 1.5 in the table. Centipede also had the fresh feature of having the dead creatures leave obstacles on the screen.

Galaga was a game of the Space Invaders family in which the enemies swooped about quite wildly. As an additional point of interest, this game had a visually scrolling background, with new targets emerging from the top of the screen and disappearing at the bottom, giving an effect that one is looking down at a player object which is continually flying upward through space. Although the user can't directly control the viewpoint motion, the visual effect is of a viewpoint that moves with one degree of freedom.

Defender was a game in which the player is limited to the left half of the screen, but is free to move a bit forward and backwards as well as up and down. The enemies come in from the right with slight variations in their motions. The background scrolls to the left.

How about a game that doesn't involve shooting? A common kind of game is Slot Car Race. In a game like this, you look down on a race-track from a fixed aerial view, seeing the whole track at once. The player and some rivals are little cars that race around the curves of the track. You control the player by turning a bit to the left and the right, by speeding up and slowing down. It would be an exaggeration to say you have two-dimensional motion, as you have to stay on the track. 1.25 dimensional motion is more like it, with the rivals having about as much freedom as the player.

There's another way to make a car-racing game, and this is to try and immerse the player in a three-dimensional world. In a very early Atari car Rally Race game, there is a player which is a car near the center of the screen, near the bottom of a triangle that represents a road. Little rectangles flick past on either side; these are fence posts along the road. You move left and right from one side of the 'road' to another to avoid obstacles that appear; this is one dimension of your motion. Your second dimension of freedom is how fast you drive forward. Although this is nominally a three-dimensional world, you can't hop up and down, so you don't get any use out of the third dimension. The world is effectively a plane that you are looking at from the side. And, as in Slot Car Race, you can't drive off the track. Even so, there's a more dimensional feeling in this game, so let's call it 1.75. That might seem too stingy, really, given that the world is, in principle a three-dimensional one. But if you look at your degrees of freedom, the number does seem pretty low.

Most of the obstacles in the Rally Race world appear and move down the screen towards you as predictably as the monsters in Space Invaders, with only a small amount of oscillation, so let's call their motions 1.1-dimensional. (Note that we're well into a debatable gray zone here; remember that the purpose of this discussion is to get the gears turning in your head, not to lay down any absolute facts.)

In the Rally Race game the viewpoint is attached to the player's car. The viewpoint shares in the dimensional motion of the player. It's worth mentioning here that in almost all games which begin to try and show three-dimensional space, player motion, the viewer and the player are attached.

The Tetris game is an interesting non-violent game which is a kind of variation on the Space Invaders style game. Here objects are falling, but rather than being a gun or a basket at the bottom of the screen, the player is essentially a controller that sits upon each block as it falls . The player is able to move the block he or she is on back and forth and in addition can rotate the block. So we can think of the player as having two degrees of freedom, with the understanding that the second degree is rotation rather than motion.

Pong and Breakout were the first kinds of games with truly two-dimensional world motions. Here something like a ball is moving around on the screen, and the user moves a paddle back and forth along the bottom or side of the screen to keep the ball from escaping there. Note that the player motions are one-dimensional and the viewer, which sees the whole world, is still zero-dimensional.

Asteroids was the first game with two-dimensional player motion. The asteroids move along two-dimensional paths, and the user's ship moves two-dimensionally as well. What makes the controls for Asteroids intriguing is that rather than directly moving the ship with left/right up/down controls, the user moves the ship via a pair of controls affecting the strength of the ship's rocket and the direction the rocket is pointing in. Unlike any previous games, Asteroids uses a little bit of physics: the ship has inertia, and tends to keep moving in the same direction until you rotate it and send a pulse of rocket energy the opposite way. The ship is also able to shoot bullets; these always travel along the same direction as the ship's rocket currently points.

PacMan was the first great maze game. Here the user and the objects move somewhat two-dimensionally, but they are constrained to move around inside a maze. So we speak of the motions as 1.25-dimensional. We use a number so close to 1 because the maze branches very little, and there aren't all that many places where the user does indeed have two degrees of freedom in the motion choice. Programming a maze game takes a little extra work because you need to put in the maze-wall objects and arrange for your moving objects to notice the walls.

Historically, the next big advance after PacMan was the Nintendo family of 'side-scrolling' games like Mario. In these games, the player's figure moves across a landscape that runs indefinitely along to the left and right. The player can jump up and down a little bit, so we think of the player's motion as, say, 1.5-dimensional. Most of the objects in the landscape move pretty much one-dimensionally, but a few of them hop up and down a bit too. What made this game unique was that here we had a moving viewpoint that mattered. Unlike the scrolling star fields of Galaga and Defender, we move through a world with interesting new features (though parts of the backgrounds do repeat).

The Pop Dambuilder game showing a 3D view of a 2D game

graphics/01icon01.jpg

We mentioned before that in games with a moving viewpoint, the motion is normally attached to the player. In a side- scroller like Mario, the viewpoint moves along through the world with the player. The next advance in games was to look down on a big world in which the viewpoint moves two-dimensionally. King's Quest and Gauntlet were examples of this. In both of these games, the viewpoint is set to always keep the player in view. That is, the viewpoint won't actually move till the player bumps into an edge of the screen; at that point the viewpoint will scroll (or jump) so as to keep the player onscreen.

King's Quest was a room-based or tile-based game; that is, the player moves in jumps from one screen to the other by passing across the edges. As mentioned above, we say a game has an (a, b, c) dimension signature if the player has a degrees of freedom, the world's motions are b-dimensional, and the viewer motions are c-dimensional. In and of itself, each screen of King's Quest has a (2,2,0) dimension signature; that is the player and world objects move two-dimensionally and the viewpoint doesn't move. The twitching of the viewpoint from room to room gives the game as a whole its (2,2,2) dimension signature.

In Gauntlet we have a more distant view of the world, we see several rooms at once, and the viewpoint scrolls when the player touches the edge rather than jumping. An additional aspect of the Gauntlet game is that here we begin to use a two-and-a-half-dimensional view of the game world. Rather than being shown as a flat pattern seen from above, the world is drawn as if seen from a fixed angle a bit to one side in space. This kind of view is also known as 'isometric'.

SimCity and Age of Empires are games that take the two-and-a-half dimensional view and run with it. In these games the user can design huge cities or even civilizations . In a sense there is no onscreen player, as the gamer is the all-pervasive 'creator' of these worlds . This said, the user can at times have the experience of an embedded player by temporarily taking control of one of the world creatures or, in SimCity, by controlling a cursor that acts as the 'Finger of God'. Although these games are isometric view, they give something almost like an effective third dimension of viewer motion by allowing the user to zoom in on close-up views.

The next wave of games were 'first-person shooters' like Doom, Quake and Half-Life. In some ways these games are like three-dimensional PacMan. The player moves through a three-dimensional maze of rooms, hallways and staircases, enjoying a motion that we might call 2.5-dimensional (although once in a while in these games you get a chance to swim underwater and you have something like pure three-dimensional motion). The motions of the objects appear truly three-dimensional; they sometimes bounce around all over the rooms.

Although the viewpoint location is attached to the player in the first-person shooters, we have additional extra freedom in the viewpoint because we have two degrees of freedom in controlling which way the player looks “ which is the direction in which the player's weapon gets aimed as well.

It's often said that first-person shooter games are excessively violent. Certainly it would be interesting to see more games like this in which you did something other than shoot everything that moves. An aspect of the first-person shooter games that seems a little sad is that the image of the player is generally nothing more than a hand holding some kind of gun. There are, however, other immersive three-dimensional games that are not primarily about shooting things.

We haven't talked about flight simulators yet. In principle the idea of a flight simulator seems very promising : you're going to fly around in three-dimensional space. But there are two big problems. First of all, the space that you fly around in often doesn't feel three-dimensional at all. In the lower-end simulators, you're always way up in the 'sky' looking down at a map. It feels like you're in a two-dimensional map world with a weak third degree of freedom that involves magnifying the map. A second problem with flight simulators is that they tend to be so closely coupled to the mechanics of how airplanes actually fly. Rather than just getting out there and enjoying pure bird-like flight, you're worrying about complicated machine-age technology like ailerons, rudders, and stall speeds. But some players enjoy mastering this. In some of the newer computer games, the flight is more natural and less mechanical: you're flying through all sorts of interesting objects, like a fish in a reef or a bird in a forest, and you're flying as naturally and as effortlessly as you fly in your dreams.

Have we reached the end of the dimensions with three? Not necessarily . In mathematics there is such a thing as a fourth dimension, a dimension perpendicular to every direction of our space. One way in which we think about the fourth dimension is via analogy based on the notion of a two-dimensional world called Flatland. The fourth dimension is to us as the third dimension would be to Flatland. But there's not room to say more about the fourth dimension here. Suffice it to say that it would be really cool to write a four-dimensional PacMan game or a four-dimensional Asteroids. To get some ideas about how to start, you can download the Hyperspace 98 program from the author's home page. The Pop Framework is in fact designed in such a way that it would be relatively easy to extend it to four-dimensional space; more on this topic can be found in the comments at the start of the vectortransformation.h header file, and any progress in this direction will be posted on the book's website.

Looking back over this section, what can we conclude about the dimensionality of the games that we should try and design? Certainly more dimensions tend to make a game more interesting. The risk in adding too many dimensions is that a game can become confusing and hard to use. Another cost of more dimensions is that you need to provide more furniture to put into your world.

When proposing a project, be sure and think about what dimensionalities you plan to use for the motions of your player, his or her opponents, and the viewpoint. In this author's courses, shooting gallery or Space Invader game projects aren't acceptable for term projects as they're too easy and too dull. (Later we'll do Space Invaders as an introductory exercise.) What's wrong with choosing a really easy project? In grading a projects course, it's reasonable for the professor to base at least part of the grade for a project on the difficulty. This is an instance of how it is important to get good feedback during requirements gathering. The very best student projects not only create a challenging game, but also implement some new classes to make the game work.

The intelligence of games

A really well-designed game like Tetris forces the player to behave intelligently. In Tetris you need to think ahead about which block to place where, keeping in mind which blocks are coming. A game like Space Invaders requires very little intelligence. You simply shoot everything you can as fast as you can.

It is exceedingly difficult to design a game which incorporates an inherently challenging puzzle. The whole trick in a game of this nature is to give the user several possible courses of action at all times, and to balance the consequences of the actions so that there is some real difficulty in deciding which strategy to use. Games are highly sensitive to very small tweaks in their play parameters, and it's a long-drawn-out process to get the values just right. But, you should try.

A simpler way to make your games intelligent is to give your game's creatures various kinds of behavior. In a shooting game like Asteroids, for instance, you can have the asteroids check the player's location and make a point of heading towards the player. Or you can let the asteroids access the locations of the bullets you shoot, and allow them to try and move out of the bullets' way. (The asteroids in the Pop Spacewar game do both.)

We're not talking about a huge amount of intelligence here, we're simply talking about giving your game creatures some rudimentary abilities to gather and use information about the player's activities. Of course you can't make the enemies impossible to beat, as then there's no game.

A good design trick might be to let the enemies do annoying things like chasing the player and avoiding the bullets, but to have an enemy's abilities differ in a random fashion from one to the other. You might even have some 'dumb and clumsy' enemies who do exactly the wrong thing; these guys might head towards bullets, for instance. This way the player is unable to be sure what will happen when a new enemy is attacked .

Requirements for playable games

It goes almost without saying that a game should be attractive to look at, that it shouldn't run too fast or too slow. A game should also be relatively platform-independent, that is, it should be able to behave well at different screen resolutions and processor speeds.

Here are some less obvious principles that we might also keep in mind.

  • The game needs a good interface .

  • The user should get instant visual feedback from game actions, with sound feedback for major events.

  • The user should have a score or some other way of keeping track of how well he or she is doing overall.

  • There should be clear goals for the game and a clear termination point.

  • There have to be advances and setbacks .

  • Doing well should involve strategy as well as manual dexterity and quick reactions .

  • You may want to give the user the possibility of using different tools .

  • Things should happen at a human pace , that is, not too slow or not too fast. In particular, things shouldn't change instantaneously.

The issue of good interface can't be stressed enough. Most of all, the interface must be simple. As a developer, you tend to want to put in lots of controls. The Pop Framework games, in particular, are loaded with tons of menu selections. These selections are really just present to help you look at some of the different ways that the games might be configured. When you actually complete and distribute a game, almost all of the menu selections should go away. In the words of the game developer Will Wright (designer of SimCity, SimAnt and The Sims), 'A user interface isn't done until there's nothing left to remove.'

The most important part of the user interface relates to the actual game controls rather than to the more or less rarely used menu selections. People can only handle a few controls. Generally you shouldn't expect to use more than these: mouse moves, mouse clicks, arrow keys and the space bar. And maybe not even all of those.

Regarding sound, it's worth mentioning that sound can be used to set an emotional tone, to signal critical events, and to speak clues and information. In a pure Windows program, we're limited to playing sounds that are stored in the *.wav file format, as described in Chapter 30: Sound. It is, however, possible to make a fairly simple extension of the Pop Framework to use the more powerful sound capabilities of the DirectX library.

Any significant game event should be accompanied by visual or audio feedback . At the barest minimum, you maintain some health and score numbers in the status bar where the user can see them. But really the feedback should occur directly within the game world. If you damage a critter, the critter should blink, or send out fragments , and there should be a sound as well. When you gain some health or score points there ought to be a sound, or perhaps a brief change in your player icon.

The score is an all-important feedback to the user about their overall performance. Once you have a specific score number to work with, you can tell if you're getting 'better' at a game, and you can compete at the game with your peers. The point of a game is to make the users feel good, so you don't want to be stingy with your score numbers, though you don't necessarily have to go overboard and start dishing out scores in the billions. Another point to note is that the more aspects of the game that affect the score, the better. Try and find a way to award scores for each of the interesting kinds of things that a skilled player can do.

Another issue relating to the interface is raised by Bruce Shelley (designer of Age of Empires). You should evolve your game by playing it. Shelley suggests that you play, test, and adjust your game daily while it's being developed, and that you use your own instinct as a gamer for guidance. When we discuss an 'Inventor' software lifecycle model for developing our game projects, we'll factor in the notion that in the early part of the project you will be repeatedly testing and revising your game.

Regarding goals , a fully engaging game will have a hierarchy of goals. There will be cycles of success or failure applicable to different levels of time: say the ten second level, the one minute level and, in advanced games, the one hour or even one day or one week level. In order to make a game really successful, you need to have users be interested in it for a fairly long period of time; an 'infectious' period longer than a week is necessary if you hope for your users to recruit new users.

Let's say a bit about advances and setbacks . One of the things that makes an activity a game is that there has to be some sort of conflict. There need to be advances and there need to be setbacks. The classic board game 'Chutes and Ladders' is a really simple example of this. Some actions move you forward, others drag you back. Playing roulette or craps has the same kind of rhythm, you alternate between gaining and losing. In Asteroids you blow up an asteroid , but then something hits you and you lose one of your lives. We need to make it possible for the user to do 'bad' things as well as 'good' things. The game should be geared so that the player should be able to do well. He or she should sweat, but in the end, the player should win.

Regarding strategy , a game is more involving if the changes depend on things you do. In an arcade 'twitch game', the issue is simply to react fast enough so as to do the right things rather than the wrong things. In a turn -based strategy game like chess, the issue is to figure out the right thing to do. The best kinds of games involve some physical skill and some thought. If a user has a choice, there should be something good about both possibilities, rather than something bad about both possibilities. A decision shouldn't be trivial in the sense of there being only one right answer, nor should it be random in the sense of it not really making a difference which option you choose.

Will Wright remarks that it makes the decisions in a game fun if you allow the player an occasional chance to be subversive, to go against what might seem like the official and correct way to play the game. He gives the example of allowing players in SimCity to remove buildings with their virtual bulldozers.

Regarding the pace and strategy of a game, Bruce Shelley remarks that in a game, the player should be the one having the fun, not the programmer or the computer! The player should feel like the hero.

One type of strategy decision is to let the user choose different kind of tools for his or her onscreen player. The simplest example is in a shooting game, where the user selects which kind of gun to blaze away with. In adventure games, the player may pick up or acquire all sorts of health packs and weapons that can then be strategically deployed.

The issue of having things happen at a human pace ties in with the notion of feedback and playability. The player needs to see things happen at a reasonable, comprehensible rate.

All this said, none of the simple games we work on in this introductory book are likely to rise to these high levels of design finesse. But it's good to be aware of what we'd really like achieve.



Software Engineering and Computer Games
Software Engineering and Computer Games
ISBN: B00406LVDU
EAN: N/A
Year: 2002
Pages: 272

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net