This post is a response to an email I received through this blog enquiring as to whether I could help him explain the difference between agent-based models (aka multi-agent simulations) and computer games. Also, he noted that it would be helpful to explain the relationship of these two to mathematical modeling such as with system dynamics. There are some obvious similarities and differences among the three, and different explanations may focus on different components and features, but what follows is how I conceptualize the relevant aspects of these models and locate them on a spectrum with mathematical models and computer games on the ends and agent-based models as a happy medium. This post will not be exhaustive of the differences, benefits, and limitations of each modeling type, but rather a comparison of those aspects which are most relevant to the use of ABMs for scientific uses.

The most immediately obvious difference among these techniques is one of purpose. Mathematical modeling and agent-based models are constructed and used to provide scientific explanation and prediction while computer games are constructed and used to provide entertainment. That difference in purpose translates to significant differences in the features each system embodies. These are the features that I will focus on, and they often occur in gradients.

One such gradient occurs in the level of user interaction with the model. In video games the input from the human player takes on a dominant role in the goings-on of the model, where as in mathematical models there is no user input beyond setting the initial conditions. Most agent-based models used in science share this feature with the mathematical models, but some ABMs (e.g. those used for education and exploration) allow some degree of user input as the model runs. But even in this case that interaction is of a very different nature than with video games because rarely does one take the role of a particular agent in an ABM (though it may be similar in feel to games such as SimCity). Going a little closer to video games are those experimental models where a scientist (such as an experimental economist) is using human choices to test scientific hypotheses about how humans interact in certain situations. The now famous human-human game theory experiments would be an example of this sort of hybrid model where the typical mathematical construct is not solved but rather played by humans.

One way in which modern computer games and modern agent-based models are more similar to each other than to mathematical models is with respect to their reliance on computers to simulate the environment and the behavior of the agents. Some mathematical models also use (or possibly even rely on) computers such as much of chaos theory and iterated discrete dynamical system models but the formulation of the model is not one that requires computational features or structure. Early agent-based models looked more like the simulated math models, but current ABMs more closely resemble primitive video games in appearance. Agents in both ABMs and video games typically use sets of contingent rules to produce behavior based on their state and their input. The types of rules are very different though the rules for ABMs will be based on plausible and simplified theories of human (or other agents') behavior while a video game's agents' rules will be whatever looks cool and makes the game fun to play. For example, if you took a modern video game and let the computer play all the players (i.e. set it on full auto) then one wouldn't expect it to be interesting or enlightening to watch it play out, but this is precisely what people do with agent-based models. And when you do this with agent based models the results are (or at least might be) scientifically relevant and explanatory for some phenomenon.

Also relating to that "being entertaining" aspect is the role of the GUI in shaping one's experience of the simulation. In video games the human user interface creates an important feedback loop that both informs the player of the situation his or her character is in and allows for the control of that agent. The visual, sonic, and sometimes tactile feedback is creating increasingly realistic experiences of the players' environments, no matter how fantastic. Agent-based models also sometimes become more realistic as they mature, but models benefit from maintaining a high level of abstraction if that abstraction translates into generality of application. Generality means that the things left out of the model are not critical to the modeled phenomenon and whatever else is going on is compatible with the explanation the theory driving the model provides. Generality of models recommends that one leave out everything that one can leave out and this is quite distinct from the driving force behind video game GUIs. In fact, this is reflected in the fact that when scientists run their ABMs they do it in "headless" mode with no GUI; only the resulting data output is worth looking at. The GUI for ABMs allows people to check the behavior during the creation process (although intermittent text outputs are just as commonly used), and is often used for education, presentation, and intuition pumping purposes, but realism and completeness are only desirable if the model is for something so specific that it is necessary to include all these details (such as EpiSim models of the spread of specific diseases in specific cities).

Another aspect of ABMs that distinguishes them from video games is the goal/desired output from repeating the simulation. Both ABMs and video games typically include a stochastic component of operation. This stochastic component introduces variability into the simulation and captures the outcome of events which are best predicted using probabilistically determined event frequencies. In ABMs this is the only source of variability within a fixed collection of parameters. For scientific purposes we would repeat an ABM (which is essentially an empirical test of a hypothesis) many hundreds or thousands of times in order to determine what effect that stochastic component has on behavior and what is universal about the behavior regardless of the output of the stochastic component. Often it is the distribution of different outcomes of the simulation that we are interested rather than what it takes for a certain outcome to obtain. In video games the player(s) introduce considerable variability, much more than that created through the non-player characters (NPCs) and the environment. In fact, it is a desirable feature of game play that in order to accomplish a task in the game there is a best way to do it and everything else goes the same way until the player can determine and implement that one best way of accomplishing a task. Not all games are like that, but most are. So we see that scientists repeat ABMs over and over to uncover patterns of behavior in the phenomena modeled and gamers repeat video games over if (and only if) they don't get it right the first time. That is a considerable difference derived from the differences in the purpose and formulation of the two types of simulations. Mathematical models typically leave out the stochastic variability and rely on parameter sweeps to characterize the behavior of the model in different configurations.

Mathematical models and agent-based models are primarily models of phenomena and hence are abstracted but as-accurate-as-possible representations of the modeled phenomena. The entities in computer games are not made to be as accurate as possible in their behavior, in some sense that question doesn't even make sense (e.g. what is the most accurate representation of a memory puzzle, hand-eye coordination task, or zombie attack?). Computer game elements are adaptive to the player and to each other in certain ways, but not typically in the ways that foster the emergence of higher-order phenomena (e.g. the buying and selling of goods in a single-player RPG do not generate a viable economy within the game world). Games frequently include mathematical models of certain features in their dynamics (e.g. gravity, weather, kinematics), but not for the purpose of testing those models' accuracy. And the list of differences among the simulation types could go on and on and on.

It is now worthwhile to look at some of the deep similarities more closely. I think that games have a great deal to benefit by incorporating more aspects of agent-based modeling in to them and ABMs could take on a new, broader role by utilizing human-in-the-loop simulation practices. The current rise in popularity of massively multi-player games highlights the inherent pleasure derived from the unexpected and organically derived complexity produced by the highly variable behavior of human participants. This was also true with games that allowed 2-4 players, but having a whole world created and adapted to a whole population of humans is a different thing. Most of these worlds and the tasks one performs in them are still generated for the pleasure of the players by forces besides the other players, but virtual playgrounds like the Sims and Second Life blur the boundary of game and ... something else.

Computer simulations of important social phenomena (disease spread, war, economic activity, etc.) are more and more being implemented as agent-based models. These models are often designed to explore a huge range of possible trajectories based on uncertain parameters and many different combinations of agent actions. By exploring many possible avenues we can learn which ones do and which ones don't have the desired consequences in a large number of scenarios...and which behavior rules are required to get there. It is likely also to be enlightening to policy makers and other movers and shakers to be able to test what they think ought to happen (given the features of the system they can actually control) in multiple scenarios. This becomes something akin to flight simulators used for training real pilots. That looks a lot like a game, but it isn't there to be fun; it is meant to be as realistic as possible to train people to make the appropriate decisions when the experience is a real experience. The behaviors are based on realistic models of the world in the same way that ABMs are built...but these simulation models have very natural feeling GUIs like video games now have. These types of virtual experiments could be quite useful in understanding and improving the lives of people both by helping improve the environments in which we are adapting and by changing/training the ways in which we adapt to our environments.