Core Mechanics

Sports games present a number of design issues that designers of other kinds of games rarely encounter. This section covers issues raised by the physics, AI, athlete skill ratings, and other aspects peculiar to sports games.

Physics for Sports Games

Football is brutal only from a distance. In the middle of it there’s a calm, a tranquility... When the systems interlock, there’s a satisfaction to the game that can’t be duplicated. There’s a harmony.

Don DeLillo, End Zone

During play, your game will be running a physics engine that determines the behavior of moving bodies in the match. The physical behavior of an inanimate object such as a golf ball is comparatively easy to implement. The physical behavior of humans, however, is much more complicated. Early sports games tended to treat a running athlete rather like a rocket: He had a velocity vector that gave the speed and direction of his movement and an acceleration vector that gave the force and direction with which he pushed. Modern sports games have much richer simulations with a great many variables, taking into account such things as the friction coefficient of the playing surface—for example, rain and snow make fields slippery and reduce traction.

Designing the physics simulation for a sports game is a highly technical problem and is beyond the scope of this book. However, beware: Because a sports game is a simulation of the real world, it is a common error to think that the physics in a sports game should be as realistic as possible. It shouldn’t be, for two reasons:

• First, the player is not actually running around on the playing field herself; she is watching a screen and controlling an athlete through a handheld controller. She has neither the immediate experience of being on the field nor the precise control over her movements that a real athlete does.

• Second, the player is not a professional athlete. There is a good reason why only a small number of people can hit a baseball pitched at 95 miles per hour. The length of time that the ball is within reach of the bat is about 0.04 seconds. It’s simply not realistic to expect that an ordinary person looking at a video screen without the benefit of depth perception could react quickly enough to “hit” a ball thrown at this speed.

For both of these reasons, you need to adjust the physics to make the game playable and fun. In a baseball game, slow the pitch to give the batter a reasonable chance of hitting the ball, and artificially adjust the position of the bat so that it intersects the path of the ball. Whether the physics perfectly copies that of the real world doesn’t matter as much as whether the game seems to be producing a reasonable simulation of the sport as it is played by professionals. Even in a highly realistic game, your objective is to provide an enjoyable experience, not a mathematical simulation of nature.

Rating the Athletes

One of the biggest tasks you take on in designing a sports game is developing a rating system for the skills and athletic abilities of all the athletes in the game. The rating system provides the raw data that the physics engine needs to accurately simulate the behavior of the athletes. As your programming team develops the physics engine and game AI, you should work with them to determine what ratings are needed. Researching the athletes’ performances and setting the ratings for them can take many months, and the lead designer will probably want to delegate it to junior designers or assistant producers.

In most team games, all athletes share one set of ratings, plus specialized ratings that apply only to athletes playing a particular position. You don’t necessarily have to tell the player what all these ratings are, nor to give the player numerical values for them. You can abstract the issue a little by using other kinds of indicators such as power bars.

Common Ratings

The kinds of ratings that might be common to all the athletes in a game include the following:

Speed. The athlete’s maximum moving (running or skating or swimming) speed under ideal conditions.

Agility. A measure of the athlete’s ability to change directions while moving.

Weight. The athlete’s weight, which affects the force he transmits in a collision and the inertia he has when struck by someone else.

Acceleration. The rate at which the athlete can reach top speed.

Jumping. The height to which the athlete can jump.

Endurance. The rate at which the athlete gets tired during the course of the game.

Injury resistance. The probability that an athlete will, or will not, be injured during play.

Specialized Ratings

Some ratings apply to a specific sport or position. This example uses the quarterback in American football:

Passing strength. The distance that the quarterback can throw the ball.

Passing accuracy. The precision with which the quarterback can throw the ball.

Dexterity. The quarterback’s general dexterity in handling the ball. This affects his chances of dropping the snap or fumbling a handoff.

Awareness. The quarterback’s ability to sense that he’s about to be tackled and to try to get out of the way.

Athlete AI Design

In action games and first-person shooters, the player’s AI-driven opponents typically exhibit a small number of behaviors each triggered by a specific event (appearance of the player on the scene, being shot at, and so on). When together in a group, the AI seldom assigns special roles to particular individuals or instructs them to help each other. It’s every monster for itself.

This kind of simple AI isn’t acceptable in a sports game. People don’t mind if a monster in a role-playing game wanders around aimlessly, but the athletes in a sports game must behave like humans, and that means deliberate, intelligent action. Particularly in team games, each athlete works with the others on the team to accomplish particular goals. The position the athlete plays dictates behavior to some extent, but within those boundaries, the athlete still must respond intelligently to a number of possible events. In a relatively simple simulation such as tennis, there might not be many of these events, but a highly complex simulation such as American football, with 22 players on the field at a time, presents hundreds of them.

Defining the State Space

The play in a sports match can be broken down into states that are defined primarily by the rules and secondarily by the tactics and strategy of the game. For example, the period of time before a tennis player serves the ball is one state, and the rules dictate where she may stand and what actions she may take (and likewise for her opponent). The moment she serves the ball, the game enters a new state. The moment the ball passes over the net, it enters another one, and so on. The best way to design a sports-game AI is to map out a game’s states as a giant flowchart. There could be far more states than you realize at first. Corner kick in soccer is not just one state but several: the period before the ball is kicked, after the kick but before the ball touches another athlete, after it has been touched by another athlete, and so on. See Figure 3 for a partial example.

Image

Figure 3 A flowchart detailing part of the corner kick situation in soccer

Consult the official rules of the sport as you construct the flowchart; they often describe states in detail, with special rules applying to each. However, the rules alone are not enough—rules describe game states for the purposes of listing legal and illegal actions, but not for purposes of tactics or strategy. Whenever something changes that requires the athletes to adopt a different tactic, the game has moved into a different state.

Setting Collective and Individual Goals

After you define the game states, you can start thinking about what the team should do in each state—where each athlete should be trying to go and what he should be trying to do to support the team’s collective goal at that moment. In some cases, these activities are defined with reference to a specific individual on the opposing team, for example, trying to prevent an opposing player from doing his job. The software must have a way of matching up athletes with their opponents, just as the real athletes do.

After you define what the team should be trying to accomplish in a particular state and have assigned each athlete a role, you then must define exactly how the athlete is to perform that role: what direction he moves, what other movements he makes, which animations should be displayed, and so on.

An athlete with nothing to do shouldn’t just stand still. Most sports games include fidgets, short animations in which the athlete shifts his weight, stretches his arms, or makes some other neutral action every few seconds. If play is under way, an athlete not closely involved—the third baseman on a fly ball to right field, for instance—should turn and watch the action.

Like war games, team sports games are good candidates for using hierarchical finite state machines to produce the artificially intelligent behavior required. Two-player sports can use simple finite state machines, one for each player. The Fundamentals of Strategy Game Design e-book discusses finite state machines in more detail.

Injuries

I wouldn’t ever set out to hurt anybody deliberately unless it was, you know, important—like a league game or something.

Dick Butkus, NFL linebacker

Injuries are a sad but common side effect of sports, and serious simulations take them into account. Because injuries occur somewhat randomly, they’re outside the player’s control and can be frustrating. Most sports games allow the players to turn off injuries if they don’t like the effect that injuries have on the game.

Although it’s possible for an athlete to injure herself simply by running or jumping, this doesn’t provide the player with any visible explanation for why the injury occurred. Therefore, a lot of sports games limit injuries to cases of some kind of collision, ordinarily between two athletes. To determine whether an injury occurs, you should include such factors as the relative speed of the two athletes, their weights, their respective susceptibilities to injury, and a random probability just to introduce some uncertainty into the situation. The heavier an athlete is, the more force she imparts in a collision, and it is the force that does the damage to the other athlete.

The stress of playing some positions, such as pitching in baseball, can injure an athlete without a collision, with injuries becoming more likely the longer the pitcher stays in the game. You can compute the probability of an injury on every pitch and raise the probability slightly with each ball thrown.

You can also decide which part of the body sustains the injury and the length of time for which it will disable the athlete. Study reports of injuries and recovery times for the sport you are simulating. If your game tracks athletes over a period of time, you should consider the cumulative effect of injury and recovery time on their careers.

Arcade Mode vs. Simulation Mode

Switching into arcade mode skews the play toward lots of action and relatively few slow-paced game states, such as strikeouts or walks. Arcade mode makes the game more exciting at the expense of realism; simulation mode makes it a more accurate simulation of the real sport at some expense in fun. In baseball, for example, an athlete does well to achieve a .333 batting average—that is, gets a hit only once for every three at bats. Some players may find that a little dull. Switching the game to arcade mode could let the player get a hit 50 percent of the time or even more. In American football, you can artificially increase the number of completed passes by improving the quarterback’s throwing accuracy and the receiver’s catching skills. If you allow the player to switch between arcade mode and simulation mode, he can adjust the behavior of the game to suit his tastes.

To implement arcade mode, you have to decide what sort of changes to the real game would make it more exciting. If you want your game to have both arcade and simulation modes, start with the serious simulation first and then create the adjustments that make it arcadelike. Serious simulations are much more difficult to tune, and it’s important to get them right first. If you start with an arcadelike design and then try to make it serious, you might never get it right.

Simulating Matches Automatically

Sports games that simulate an entire season for a whole league of teams often provide a means of simulating matches automatically without the player having to play them. Each team in American professional baseball currently plays 162 matches in a season. With 30 teams in the 2 leagues and 2 teams in each match, this totals 2430 matches—only the most rabid fan would want to play each match personally. To generate results for matches that the player doesn’t play, you need a way of simulating a match. Of course, you want the resulting scores to accurately reflect the relative strengths of the teams: A bad team should be able to beat a good team occasionally but not often.

Computer vs. Computer

The simplest way to simulate entire matches automatically is to let the computer play out the match in computer-versus-computer mode (as described in the earlier section “Competition Modes”) and record the results. A game with a good simulation model should produce scores that reflect the real abilities of the competitors.

However, if the player wants to generate results for a match that she doesn’t want to play herself, she probably wants it done quickly. You can speed up the process by turning off the graphics. Because displaying the graphics often takes up the majority of the computer’s time, an entire match can be simulated invisibly in a few seconds, and the computer can report only the result. Electronic Arts’ Earl Weaver Baseball game did this successfully. When you implement a nondisplayed mode like this, test the game to be sure that the results without graphics are the same as those with graphics.

Generating Fake Results

Instead of simulating entire matches with the graphics turned off, many games fake it—in effect, they roll dice to generate game scores. The dice are loaded somewhat so that good teams get high scores and bad teams get low ones, and whichever team rolls the highest score wins the match.

If you choose this approach, you will need to devise a suitable algorithm for generating point values; in games such as American football and rugby, in which different kinds of scores produce different numbers of points (touchdown, field goal, and so on), certain score values are much more common than others. It’s extremely rare, for example, for a team to end an American football game with a score of 2. You’ll also need to make sure that your algorithm creates reasonable scores and a reasonably random distribution of scores. No professional soccer game should ever end with a winning score over about 15, and even that will be rare; your algorithm should produce many more games with winning scores of 4 or less.

Unfortunately, the dice-rolling technique doesn’t generate any statistics other than the scores themselves. In a particularly statistics-rich sport such as baseball, if you don’t generate performance data for each individual athlete, some fans will consider your game to be a lightweight simulation rather than a serious one. It’s up to you to decide just how important that market is to you and how much effort you’re prepared to exert to meet their expectations.

Home-Field Advantage

Considerable debate has raged over the years about whether to build a home-field advantage into sports games. Although the home-field advantage is statistically significant in a number of sports, it’s better not to build it into the mechanics of the game. Players like to feel that they are playing a fair game, and if they know that the odds are artificially stacked against them whenever they play an away game, they will resent it. It’s also unclear exactly how the home-field advantage should be implemented. Fans normally observe the home-field advantage from win-loss statistics, but of course, the computer can’t simply turn a loss into a win. You could shave off a percentage of goal-scoring attempts, but even this slight intervention is likely to generate odd side effects. If a scoring attempt that clearly should have succeeded fails for no visible reason, the players are bound to notice it. If you feel you must simulate home-field advantage, the best (and least detectable) way to do it is probably to improve all the ratings slightly for all the athletes on the home team.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.239.41