controlling a large army marching toward an enemy, then the game should optimize movement of soldiers; on the other hand, if the army is guarding against an attack, the game should optimize individual perception. Games often have a small number of these high-level states, and changes between them happen relatively slowly. If the runtime can recognize which state the game is in, it can switch to an optimized execution plan and improve performance.
To some degree, game developers already take advantage of this fact in their performance tuning. Currently they log runs of the game during play-testing, and later data-mine these logs for recurring patterns. If these patterns are easy to detect, developers can take advantage of them. This type of optimization, however, is very difficult for designers or for players developing user-created content. Ideally, a game-aware runtime would have some knowledge of common patterns and be able to adjust for them automatically.
Performance is not the only reason for the runtime to monitor how the game changes over time; it is also useful for debugging. Debugging a game is not as simple as stepping through a single script. Each object is scripted individually, and these scripts can interact with one another in subtle ways. An incorrect data value in one script may be the result of an error in a completely different script. In addition, many errors are the result of user input that is not always easy to reproduce. A script designer needs some way of visualizing which scripts modify which objects and how these objects change over time. This is an application of data provenance, which is an active area of development in the field of scientific computation. Like designers, the scientists targeted by data provenance tools often have little programming experience; instead, the provenance techniques model the way they naturally think about the data. As yet, no game scripting language supports data provenance.
Data provenance is even more important if the script runtime has an unusual execution model. In the previous script to place items in a container, efficient execution involved reordering portions of the script. Instead of hav-
ing the programmer debug the scripts in an execution model that is different from the one in which the bug appeared, it is best to give him or her a higher-level visualization of how that bug might have occurred.
Game-aware runtimes are more difficult to implement than language features. Language features can often be implemented piecemeal; as programming patterns are identified, new language features can be added without adversely affecting the old. Runtimes, once architected, can be very interdependent and difficult to change. For example, any changes to the order in which operations are processed will affect the debugger. Thus, while languages can have an attitude of “see what works,” runtimes need to be well understood from the beginning.
Scripting languages are an integral part of both game development and mod-
is identifying
ding, and their design has huge impact
those patterns
on both correctness and performance
of the resulting game. Game develop-
and creating
ers earn money from the titles that they
language features
publish, not the engineering problems
that they solve. Therefore, anything
to support them
that reduces technical challenges for
the developers and allows them to cre-
most effectively.
ate more content is a welcome innova-
tion. Advances in design patterns and
scripting languages will influence the
way games are programmed for years
to come.
References
1. dean, J. and ghemawat, s. mapreduce: simplified data processing on large clusters. Commun.
ACM 51, 1 (Jan. 2008): 107–113; doi.acm. org/10.1145/1327452.1327492.
2. White, W., sowell, B., gehrke, J., and demers, a. declarative processing for computer games. in Proceedings of the 2008 ACM SIGGRAPH Sandbox Symposium; doi.acm.org/10.1145/1401843.1401847.
Walker White is the director of the game design initiative, an interdisciplinary undergraduate program training students in the design and development of computer games, at cornell university, ithaca, ny.
Christoph Koch is an associate professor of computer science at cornell university, ithaca, ny.
Johannes Gehrke is an associate professor in the department of computer science at cornell university, ithaca, ny. he co-authored Database Management Systems (mcgraw-hill, 2002), currently in its third edition.
Al Demers is a principal research scientist in the department of computer science at cornell university. his current work focuses on scalability and data management for computer games and virtual worlds.
a previous version of this article appeared in the november/december 2008 issue of ACM Queue.
© 2009 acm 0001-0782/09/0300 $5.00
References:
http://doi.acm.org/10.1145/1327452.1327492
Archives