Unforeseen Intersections: Half-Life As World Allegory

Begin a new game of Heroes of Might and Magic 3 (the best game in the series thus far). Play for a few turns, at least to the point that you have revealed the territory of your AI foes and may observe their movements unhindered by the fog of war. Save the game, end your turn, and note the movements of the AI. Then reload your game, end your turn, and observe once more. The AI will move along precisely the same paths and engage in precisely the same battles that it did previously. It's as though you've rewound a movie and watched the same scene a second time.

Compare this to certain scenes in Half-Life, in which the player may passively observe AI skirmishes between marines and alien forces. The marines may win on one play through, but reload the last save in order to watch the battle again and you will oftentimes find the results to be reversed. No two firefights are exactly alike, even when the same fight is reloaded again and again. The starting positions of the AI entities are the same; the level geometry is no different; the rules governing AI behavior do not change between reloads. So what is it that Half-Life has, and which Heroes 3 lacks?

Put simply, the rules that govern the behavior of Half-Life's AI are probabilistic, whereas those at work in Heroes 3 are deterministic. The distinction is simple, but its implications may help guide us toward a better kind of game -- and maybe even a better kind of worldview altogether.

Physical, or scientific, determinism (hereafter: determinism) is the doctrine which holds that, given knowledge of the position and momentum of every particle in a system at time X, as well as knowledge of the laws that govern the system, a sufficiently powerful mind may calculate the entire past and future behavior of the system as a whole. Determinism reached its popular apex in the eighteenth and nineteenth centuries, after Newton revolutionized the intellectual world with his physics and calculus. But ever since the Einsteinian revolution of the early twentieth century and the subsequent introduction of quantum mechanics, determinism has lost traction in the minds of physicists and philosophers, while yet maintaining some grasp upon the population at large. The movement has its proper roots in the philosophy of the ancient Greek atomist Democritus -- though even earlier mythological entities, such as the Homeric Fates, may serve as evidence that the problem of determinism has weighed heavily upon the Western mind since before the Dark Ages of ca. 1200-800 B.C.

If the determinists are right, and if every single fact in the universe is determined by physical law, then the future is every bit as fixed as the past, and the notion of free will must necessarily evaporate before our desperate eyes. (Although some philosophers believe that determinism is fully compatible with human free will; they are called compatibilists -- or, on occasion, crazy.) That which we call the present can have been produced by only one past, and shall yet produce only one future. Naturally, many philosophers over the years have found this apparent conflict between determinism and human agency most unsettling.

I cannot describe within a reasonable amount of space all of the many attempts that have been made to solve the problem of determinism throughout the ages; nor could I easily do justice to the many subtleties of the arguments, even if I were undaunted by their sheer number. Recently upon reading Charles Sanders Peirce's essay "The Doctrine of Necessity Examined" (P474: The Monist 2 (April 1892):321-27; also CP 6.35-65), however, I was struck by the following paragraph against determinism:

Peirce wrote:

2) By thus admitting pure spontaneity or life as a character of the universe, acting always and everywhere though restrained within narrow bounds by law, producing infinitesimal departures from law continually, and great ones with infinite infrequency, I account for all the variety and diversity in the universe, in the only sense in which the really sui generis and new can be said to be accounted for. The ordinary view has to admit the inexhaustible multitudinous variety of the world, has to admit that its mechanical law cannot account for this in the least, that variety can spring only from spontaneity, and yet denies without any evidence or reason the existence of this spontaneity, or else shoves it back to the beginning of time and supposes it dead ever since. The superior logic of my view appears to me not easily controverted.

I have learned the hard way time and again that Peirce was a really, really smart guy. So whenever I come upon a passage for which I have no frickin' idea what the man's going on about, I try to give him the benefit of the doubt, under the assumption that he's probably worked things out in a manner that has eluded me, and I am simply blind to his superior grasp of reason. Usually, after due time and much effort, I am able to discern the gist of his arguments; but sometimes this is not the case, and I must resign myself to a difference of opinion with my main man Charlie.

When I read the above passage, I initially felt certain that this would be one of those sad times of philosophical disjoint between myself and Peirce. For I could not fathom why Peirce thought that an indeterministic universe would necessarily allow for more variety in the world. Peirce seemed to be saying that a deterministic universe would be one without beauty -- or at least, without a certain important kind of beauty, i.e., that owing to nature's variety and spontaneity. But beautiful variety seemed to me to be accepted as inherent to both the deterministic and indeterministic views of the world; for determinism and indeterminism do not address different worlds as effect, but rather only the supposed contrary causes for the single world that all parties acknowledge we inhabit. It seemed that Peirce was not giving the determinist quite enough credit here.

Then I wondered: is it possible that the determinist and indeterminist do not merely disagree over the supposed cause of the world as we know it, as I initially had thought, but that they also disagree upon the very essence of that world itself? Perhaps they are articulating not merely conflicting world-rules, but also conflicting worlds themselves.

And that's when the analogy to games struck me like a bolt from the blue. For that is exactly the advantage that Half-Life has over Heroes 3: out of spontaneity, variety; out of variety, a kind of beauty. For is it not beautiful (in a sense of the word) to know that each outcome of battle is in some way randomly decided? Who will deny the surge of adrenaline that accompanies the full realization that anything might conceivably happen? Who is not intrigued by the fact that events are not pre-scripted according to some arcane algorithm, but are on the contrary loose and spontaneous? Who would not rather play a game wherein -- all other aspects being equal -- there is an aspect of indeterminacy to the AI?

I now see that Peirce's world is a world in which we may by default justify the delight we feel in studying the history of events, or in predicting their future course. I think that's pretty neat.

What's also neat is the fact that my experience as a computer gamer helped me to interpret this crucial bit of philosophy. Though it was released as long ago as 1998, Half-Life continues to shape me in ways that I cannot anticipate.



Lobo wrote:

Another interesting post. I hope you're planning to become a regular here!

Thanks! You keep written articles like that and I will be!

Lobo wrote:

Here's a question: if such minor factors as the state of the system clock or running background processes can have an effect on a game like Half-Life, thereby changing the way the game behaves, then why do they seem to have no effect at all on a game like Heroes 3? Isn't this an indication that Heroes 3 is more deterministic by design than Half-Life?

There's a problem that many single-player games have to deal with - sudden load on the system resources, either by an intense scenario in the game itself, or background processes, task switching, etc.

Every game consists of two separate parts that run in a consequent loop - the "THINKER" and the "PAINTER". The "THINKER" is responsible for doing everything except drawing the world. The "PAINTER" draws the world after its been changed by the "THINKER".

There are several approaches to dealing with varying framerates:

1) the time limit allowed for preparing one frame by the THINKER+PAINTER is set. Lets say they are given 40 milliseconds to complete the task, which allows for 25 frames per second.
If this is an entirely brainless action game, chances are, THINKER is designed to ALWAYS complete his work under 40ms.
PAINTER is then timed, and punished in the consequent frame(s).
Here's an example scenario, with two 40ms frames, which together obviously should end at 80ms:

FRAME 1: THINKER took 10 ms, PAINTER took 50ms instead of <30ms
FRAME 2: THINKER takes 10ms, PAINTER is skipped, we're at sum total of 70ms. Now we just wait another 10ms before we go to the next frame.

Observable result: the game lags, but every object in the game runs at the same speed in the game world.
Example of a game that uses this approach: Doom1/2, Diablo 2

2) Lax approach: don't do anything. If the THINKER+PAINTER team exceeds 40ms, just move on to the next frame. This approach is the most obviously susceptible to having different outcomes come out of system slowdowns- which is why its never used in games where realtime gameplay elements can affect the outcome of the game.
Example: Fallout 1/2. I am not sure if they use this approach but it seems that way. And if they don't, theyre still perfectly suited for it.

3) The fluid approach - suitable for some games and not others.
THINKER is made aware of TIME. THINKER is run as often as it can, followed by PAINTER of course. There's no fuss about keeping up a framerate. In fact there's no such CONCEPT as a desired framerate.
Inside THINKER, each object's speed is tied to milliseconds. Each time when the THINKER needs to recalculate positions of objects in the game, it looks - how many milliseconds passed since the last cycle ? Then it moves everything the distance it would've gone.

There are problems with this approach of course, such as - if there was a small obstacle in the object's path, it may jump over the obstacle instead of getting stopped. Thats because its "next" position was clear and the game _IDEALLY_ thinks that it the object should take small steps, and thus, it would be able to detect most collisions.

But during lag, it will be a large step. And if the THINKER starts to split it into small steps to check for collisions all the way, then this approach becomes no different from approach number 1).

Example: Space/sea simulators - few if any obstacles, low load on the PAINTER, and often high load on the THINKER, depending on the amount of ships and components of each ship being simulated. Some games I can think of as potentially using this approach would be Descent: Freespace and Battlezone with its barren lands.

Nowadays this approach is used with many FPS games as well. This is why there's a concept of the dedicated server - it is just the bare THINKER running at its maximum possible capacity. When the server gets overloaded, everyone starts jumping around because everyone's coordinates are updated at a far lower framerate.

4) Another fluid approach: make the THINKER dynamically split the time consuming routines like A.I. pathfinding over many frames in order to even out the load. Depending on system load at the moment, the enemies may react just a tiny tad slower or dumber. It is never obvious. Even one frame of this would be enough to cause the falling dominoes effect and result in a different outcome.

In overall, todays games are complex beasts, running on complex processors and hardware inside complex operating systems. With complexity, the unpredictable element rises.

Example: most suitable for single-player games with a lot of objects that need to find their way around obstacles, but where the outcome of the game is not dependent on positions of such objects. I.E. a role-playing game which has hundreds of citizens walking idly around towns.

This is also suitable for handling special effects, such as particle systems and the like. Who's gonna notice that you didn't move a random 20% of the particles inside a dust cloud for a few frames in a row to save CPU time ? No one, and no one will care.

Whoops, already thanked lobo.

Interesting points about the Thinker and the Painter. Does the Thinker make different AI decisions if the Painter falls behind? It all depends on the code, I guess, although in most modern games I don't see that it does.