FUNDAMENTALS OF GAME DESIGN, SECOND EDITION

Monte Carlo Simulation

If you have a simple deterministic mechanic that simulates some real-world effect, then it doesn't take long to see if it works correctly. For example, the gears in a car's drive train govern the relationship between the speed of a car's engine and the speed of the car's wheels. It's a fixed mathematical relationship and easy to com­pute. On the other hand, if you design a complicated mechanic with all sorts of factors, it may be difficult to predict how it will behave. You don't have time to test all possible outcomes to make sure they all make sense. Instead, you can do some­thing called Monte Carlo simulation.

In Monte Carlo simulation, you make a large number of test runs of your system using random inputs, and record the results in a file. Then you can examine the file and make sure that the outcomes reflect the behavior that you expect. Here's an example: Many sports games let the player manage a team throughout a whole sea­son, and play each match that the real team would play. The game simulates all the other matches in the league season (the ones not involving the player's team) auto­matically. If you don't want the machine to play each simulated match through moment by moment, which the player probably won't want to wait for, you will need to design a mechanic that fakes it; an algorithm that generates the win-loss results for all the other matches without really playing them. Your mechanic will probably be based on the attributes (such as the performance characteristics) of the athletes on the team. (The section "Simulating Matches Automatically" in Chapter 16, "Sports Games," discusses this issue in more detail.) But how can you be sure that your mechanic produces realistic results? You can try it by hand a few times, but that's not enough to constitute a serious test.

To perform a Monte Carlo simulation, randomly generate two teams of athletes, with a variety of random attribute settings for each athlete, then apply your mechanic to them and record which team wins. Do this repeatedly, 1000 times or so. Afterwards, analyze the data from the simulations to see if any anomalies occurred. Did a weak team ever beat a strong team? Did it happen often, or was it a fluke? If it was a fluke, happening once in 1000 times, that's OK—if sports matches were completely predictable they'd be boring. But if it happened often, you know your mechanic has a problem. If you know statistical methods, you can compute the correlation between the inputs (relative team strength) and the outputs (who won) and make sure that there's a positive correlation between strength and victory.

People use Monte Carlo simulation for all sorts of things: to predict profits when people buy products at different price points, to predict the failure rate of new products, and so on. Microsoft Excel and other spreadsheet programs contain built - in tools for performing Monte Carlo simulations. If you can define your mechanic in a spreadsheet, you can easily use these tools.

Добавить комментарий

FUNDAMENTALS OF GAME DESIGN, SECOND EDITION

Arcade Mode Versus 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 SECRET OF MONKEY ISLAND

The Secret of Monkey Island, now nearly 20 years old, remains worth studying because it spawned a highly successful franchise. Although it is ostensibly set on a Caribbean island in …

Human Intelligence Instead of Artificial Intelligence

In single-player games, the player competes against the computer, so the computer has to have enough artificial intelligence (AI) to be a good opponent; building the AI for a complex …

Как с нами связаться:

Украина:
г.Александрия
тел./факс +38 05235  77193 Бухгалтерия

+38 050 457 13 30 — Рашид - продажи новинок
e-mail: msd@msd.com.ua
Схема проезда к производственному офису:
Схема проезда к МСД

Партнеры МСД

Контакты для заказов оборудования:

Внимание! На этом сайте большинство материалов - техническая литература в помощь предпринимателю. Так же большинство производственного оборудования сегодня не актуально. Уточнить можно по почте: Эл. почта: msd@msd.com.ua

+38 050 512 1194 Александр
- телефон для консультаций и заказов спец.оборудования, дробилок, уловителей, дражираторов, гереторных насосов и инженерных решений.