Gamebook store

Showing posts with label physics. Show all posts
Showing posts with label physics. Show all posts

Friday, 21 November 2025

Simulation vs abstraction in game design


This is an excerpt from Game Architecture & Design, an industry textbook I co-authored with Andrew Rollings. (I wrote the game design bits, Andrew dealt with code, tech and development practices.) The book was originally published in 1999 and a revised edition came out in 2004. In the intervening two decades, a lot has changed, but it's also interesting to see what hasn't...


If I throw a ball and take many high-speed photographs of its flight, I'll see that the trajectory the ball took is a parabola. But the ball didn't follow that path because gravity told it: "Move in a parabola." A parabola is just a symbolic concept in the analytical domain of mathematics, and the universe doesn't know anything about mathematics or analysis or symbols; these are human concepts. In reality, there are just a bunch of physical processes, each of which deals only with the processes and circumstances just before and just after it. So, the ball is at one position, and gravity tells the ball's velocity to change, and the ball's velocity tells its position to change. The balance between kinetic and potential energy over the time the ball is in the air gives you what we call a parabola.

This is the opposite approach to that taken in most software applications. There, processing power is at a premium, so the sooner you can go to symbolic modelling rather than step-by-step simulation, the better. The tradeoff is that software can crash when your symbolic "shortcut" misses something that the one-step-at-a-time approach would have taken in its stride.

Researchers in Artificial Life have identified an analogous problem:

"The classical AI approach has been criticized because the symbols and symbol structures on which planning and decision making are based are not grounded in the real world. The problem is that unequivocally decoding sensory data into a symbol and turning a command without error into its intended action may be unsolvable."

- Luc Steels, "The Artificial Life Roots of Artificial Intelligence" in Artificial Life (MIT Press, 1997)

One big advantage of the way that reality does things is that the universe, being non-symbolic, cannot crash. As an example of the principle at work in a game, suppose I am putting a monster into my new Frankenstein adventure and the idea is that it will jump out of its vat when the player enters the laboratory. Instead of putting in a lot of complicated AI to do with detecting humans and having the goal of wanting to kill them, I just choose the short cut of placing a trigger tile inside the laboratory door. When the player steps on the trigger, the monster will appear and attack.

Okay so far, but what if the player manages to get onto the tower roof, jumps down, and, by some fluke, manages to land safely on the balcony of the laboratory? Now they can explore the lab, get all the power-ups, and read the journal about the monster (an entry that is supposed to be poignant if they've just fought and killed it, but that is meaningless otherwise). Only when the player goes to leave via the door does the monster climb out of its vat and growl, "You shall not steal my master's secrets!"

In the past, the nonsymbolic, step-by-step approach was not practical. The the processing capability wasn't available to deal with that and graphics too. But now much of the graphics work is done by the video card, and computers are doubling in power every eighteen months or so. At last, it is starting to be possible to create "uncrashable" games by avoiding the need to design using symbolic shortcuts.

Comparing Nonsymbolic And Symbolic Design

In the original Warcraft, peasants collected gold by entering a gold mine and bringing sacks back to your town hall. At the start of the game it was always worth spawning peasants because, the more peasants you had, the greater your revenue stream. However, there came a point when the peasants started to get in each other's way. Adding more peasants would then lead to “traffic jams” as the peasants encountered each other on the streets of the town and would have to back up to let others get past. The situation was alleviated by leaving wide streets. Additionally, it was not a good idea to place your town hall too close to the gold mine – giving a little more space also helped avoid traffic congestion.

Now, an economist could derive an equation to describe the flow of gold to the town hall. The factors would be the number of peasants, the placement density of the town buildings, and the distance from the town hall to the mine. We can imagine that it would be a pretty complex equation. The point is that the designers of Warcraft never needed any such equation.* They simply programmed in the basic rules and behaviours and the economic simulation emerged directly from those.

Contrast this with a game like Caesar II, which used underlying equations to create a simulation of an ancient Roman city. This approach is less satisfying because the player is not directly viewing the reasons for success and failure. Instead, when playing a game like Caesar II (or any simulation of its type) you are trying to build an abstract match to the game’s underlying equations in your head. The simulated economy and the gameplay are less visible, lessening the sense of immersion.

And you know what? The same goes for stories. If you construct them from symbolic forms (arcs, paradigms, act breaks) you'll end up with less robust and varied stories than if you allow each micro-event to trigger the next and see where it goes. Which is why in roleplaying terms I'm a simulationist rather than a narrativist. Hey, if it's good enough for reality then it's good enough for me.


* This gives me an excuse to digress onto the topic of AI. Foundation models (or indeed any deep neural net) are sometimes referred to as algorithms. I find that term misleading. In principle you could express all the weights of a billion-node net in the form of "an algorithm" but that's not really an accurate way of talking about what the AI is doing in, say, ChatGPT, which is akin to (though much more complex than) the peasants collecting gold in Warcraft. That too is governed by multiple algorithms (for route-finding, collision detection, etc) but it would be more accurate to talk of it as a model. An algorithm could be derived to express the rate of gold production in terms of all those variables, but the Warcraft system doesn't have that algorithm built in, and nor do AI systems. There is an example here, where the article refers to "a separate algorithm" where they really mean " a separate model".

Principle of Least Action image by Maschen CC0

Tuesday, 21 December 2021

Seasonal scientific silliness


It hasn't been easy coming up with a seasonal present for the blog this year. My gaming group had no Christmas adventure run by the polymathic Tim Harford, and I've been pretty busy for most of 2021 writing and editing the Vulcanverse books. So here's one I made about thirty years earlier -- a lighthearted little boardgame called Genius. You can get the rules here and the board here. Just don't expect Settlers of Catan.

Should you be thinking of running a Yule special, there are some sound tips on how to do that on the How Heavy This Axe blog. Amongst other suggestions, I agree that ideally it should be part of an ongoing campaign (I can never get into characters designed to throw away) even if, as in our case, that campaign only occurs once or twice a year.

If you've enjoyed anything on the blog and you'd like to get me and Jamie a Yule gift, reviewing one of our books online is always a welcome surprise. (Obviously, more welcome if you actually liked the book, but don't let me influence you.)

Have a happy solstice, Yule, Christmas, or whatever other winter festival you choose to celebrate. And after the uncanned nuttiness of the last few years, may 2022 bring a season of reason.

Thursday, 28 January 2021

When black holes collide


I thought I'd give the people who show up from time to time to complain about my occasional political posts something new to grumble about, so today we're talking physics. (Not so strange given how I view roleplaying, which is that it's about everything.) And don't panic. I'm going to do all this in terms a child could understand, honest.

I had a question about black holes that used to puzzle me as a teenager:
Say you’ve got a black hole of 4 million solar masses, so roughly 50 AU across. (I’m taking a really big one so that its tidal forces don’t turn everything that falls in into spaghetti.) An astronaut wearing a wristwatch falls towards it. What do we see? My understanding is that we’d see the astronaut slow down as he or she approached the event horizon, finally appearing to come to rest on the event horizon, very red-shifted and the watch display apparently having stopped. (From the astronaut’s point of view he or she accelerates towards the event horizon, the entire universe around them is blue shifted, and their watch continues to tell the time accurately right up to the moment they go through the event horizon – and maybe after as well? But that’s a whole other question.)

OK, now what if instead of an astronaut we drop another supermassive black hole into the first one? As the event horizons touch, do they freeze in place there like two balls glued together?
  1. If not, then in watching the rate of merging of the horizons we’d be getting information out about how fast the two singularities are moving together. From our perspective we’d suppose them to move together infinitely slowly, but in any case no such information can escape the black hole.
  2. But if they do just stay frozen like two balls touching at a point, then the universe should be festooned with very oddly-shaped black holes, apparently made up of lots of aggregated black spheres stuck one onto another like a 3D Mandelbrot set.
I don’t think that’s what the maths says. All black holes are supposed to be featureless and (nearly) spherical. So do they go from the two-balls-touching state to the one-big-ball state in a quantum leap – to coin a phrase?
For half a century I kept asking that question but never got a satisfactory answer. One astrophysicist did tell me that I was making the mistake of using second-order geometry when I needed to consider fourth-order geometry, but I live in this universe not the maths one. I wanted an explanation I could chew.

And eventually (there might be a life lesson in this) I figured out the answer for myself. I could have done that decades ago, too, if I'd just stopped to think that I'd packed a huge assumption into the original question when I envisaged them as both remaining spherical up to the point of contact. So here's that answer -- and look, Ma, no maths!

Imagine two supermassive black holes of equal size in otherwise locally empty space. At a wide separation they are spherical (if they're not rotating). The size is defined by the Schwarzschild radius, the point at which a particle cannot escape the gravity well of the black hole.

As the holes get closer together, consider two particles, one on a line between the two black holes and just within hole #1’s Schwarzschild radius, the other on the same line but the far side of hole #1 and just outside its original Schwarzschild radius.

As the gravity of hole #2 begins to have a significant effect, the particle between the two gets a gravitational boost that would allow it to escape the original radius. Conversely, the particle on the far side now has to escape not only hole #1’s gravity but the additional pull of hole #2.

So the effect as the holes approach each other is that the event horizons bulge on the far side and flatten on the near side. The extent of the event horizon becomes less on the near side and greater on the far side so that they resemble two distorted lenticular blobs that will (as they get closer and closer) asymptotically adopt the shape of hemispheres that will then merge into one new larger sphere.

If the physics of spacetime curvature allowed that process to be entirely seamless then there would be no release of energy, but of course the two merging holes don’t precisely resemble sections of a greater sphere even at the moment of contact – at that point, there’s an anomalous dimple in the curve around the great circle bisecting the new event horizon. Hence the associated burp of around 5% of the mass, and the new horizon of the combined hole will only extend as far as the inner part of that dimple.

I’m just guessing that you could compute the proportion of energy released purely from the geometry, mind you – I retain more faith in maths than I do mathematical ability, these days. And of course, an observer at infinity would say there was only one black hole there in the first place. But that's a detail.

Friday, 15 May 2015

Designing from the bottom up


More tips on game design today culled from my and Andrew Rollings's book Game Architecture and Design. (Sure, it was published a whole fifteen years ago and game development has moved on - but hey, some people still get advice from the Bible and the Koran.)

If you throw a ball and take many high-speed photographs of its flight, you'll see that the trajectory the ball took is a parabola. But the ball didn't follow that path because gravity told it to move in a parabola. A parabola is just a symbolic concept in the analytical domain of mathematics, and the universe doesn't know anything about mathematics or analysis or symbols. These are human concepts. In reality, there are just a bunch of physical processes, each of which deals only with the processes and circumstances just before and just after it. So, the ball is at one position, and gravity tells the ball's velocity to change, and the ball's velocity tells its position to change.

This is the opposite approach to that taken in most software applications. There, processing power is at a premium, so the sooner you can go to symbolic constructs, the better. The tradeoff is that software can crash when your symbolic "shortcut" misses something that the one-step-at-a-time approach would have taken in its stride.

Researchers in artificial life have identified an analogous problem:
"The classical AI approach has been criticized because the symbols and symbol structures on which planning and decision making are based are not grounded in the real world. The problem is that unequivocally decoding sensory data into a symbol and turning a command without error into its intended action may be unsolvable."
—Luc Steels, "The Artificial Life Roots of Artificial Intelligence" in Artificial Life (MIT Press, 1997)
Here is an example: suppose you are putting a monster into your new Frankenstein adventure game, and the idea is that it will jump out of its vat when the player enters the laboratory. Instead of putting in a lot of complicated AI to do with detecting humans and having the goal of wanting to kill them, you just choose the shortcut of placing a trigger tile inside laboratory door. When the player steps on the trigger, the monster will appear and attack.

Okay so far, but what if the player manages to get onto the tower roof, jumps down, and, by some fluke, manages to land safely on the balcony of the laboratory? Now he can explore the lab, get all the power-ups, and read the journal about the monster (an entry that is supposed to be poignant if he's just fought and killed it, but is meaningless otherwise). Only when the player goes to leave via the door does the monster climb out of its vat and growl, "You shall not steal my master's secrets!"

When cutscenes were pre-rendered, ones of the purposes of tying events to a trigger point like that is that you could be sure of where the player’s character would be standing (and the state of the laboratory, in this example) when the cutscene began. Nowadays, it is more likely that the cutscene will be generated in the game engine. The cutscene thus becomes an example of “machinema” which can be slightly different every time, depending on the game state at the time it is triggered.

The use of the trigger point illustrates symbolic design. The designer assumes there is only one way for players to enter, and that’s via the door. The alternative nonsymbolic, or equation-free, approach would recognize that the true trigger event is the monster’s awareness of intruders in the laboratory. Whatever way the player enters the lab — even if by teleportation — the game still responds appropriately.

Discussing Deux Ex at the GDCE conference in London in 2002, designer Harvey Smith of Ion Storm cited how nonsymbolic design is changing games. In testing a maze level (the walls of which were set high enough that the player couldn’t jump them) the developers discovered an ingenious way to escape the maze. A player could fix a limpet mine to the wall and use this as a stepping stone to jump out of the maze. Harvey Smith pointed out that old-style designers might have regarded this as a bug, but in fact it was an extra opportunity that enriched the gameplay.

“We need to reward the goal,” he concluded, “and not the method the player uses to achieve the goal.”

In the past, the nonsymbolic, step-by-step approach was not practical. The processing capability wasn't available to deal with that and graphics too. Hence design used a symbolic approach and the idea of one correct solution to every problem became ingrained. But now much of the graphics work is done by the video card, and computers are doubling in power every 18 months or so. At last, it is starting to be possible to create "uncrashable" games by avoiding the need to design using symbolic shortcuts.


Comparing Nonsymbolic And Symbolic Design

In the original Warcraft, peasants collected gold by entering a gold mine and bringing sacks back to your town hall. At the start of the game it was always worth spawning peasants because the more peasants you had, the greater your revenue stream. However, there came a point when the peasants started to get in each others' way. Adding more peasants would then lead to traffic jams as the peasants encountered each other on the streets of the town and would have to back up to let others get past. The situation was alleviated if you planned your town with wide streets. Additionally, it was not a good idea to place your town hall too close to the gold mine — giving a little more space also helped avoid traffic congestion.

Now, an economist could derive an equation to describe the flow of gold to the town hall. The factors would be the number of peasants, the placement density of the town buildings and the distance from the town hall to the mine. We can imagine that it would be a pretty complex equation. The point is that the designers of Warcraft never needed any such equation. They simply programmed in the basic rules and behaviors and the economic simulation emerged directly from those.

Contrast this with a game like Caesar 2, which used underlying equations to create a simulation of an ancient Roman city. This approach is less satisfying because the player is not directly viewing the reasons for success and failure. Instead, when playing a game like Caesar 2 (or any simulation of its type) you are trying to build an abstract match to the game's underlying equations in your head. The simulated economy and the gameplay are less visible, lessening the sense of immersion.

Monday, 20 October 2014

Learning by playing games


Reading a text book is a terrible way to learn about a subject. You’re looking at a linear block of facts and trying to reconstruct in your own mind the complex set of connections that, in the case of the original author, comprises real understanding.

Nobody learns only from textbooks, okay, but traditional teaching methods are not a big improvement. At college I went to lectures, made notes, was asked to write essays on magnetism and neutrinos and discuss them. I learnt very little from that part of the course, which as far as I could see was really English, not Physics.

Solving problems, that was how I learned. “What is the field gradient above an infinite charged plain?” Do all the calculus and then kick yourself when you realize the field is constant (the clue is in “infinite”) but, having found that out for yourself, you won’t forget it.

Leo Hartas and I took this idea to Dorling Kindersley ten years back with a proposal we called the Inspiration Engine. These would be a series of books tied in with games. Take a staple subject for popular kids’ nonfiction: the solar system. We outlined a tactics and management game in which the player was setting up colonies on other planets. In building habitats and craft you’d be finding out about the gravity, atmospheric density, composition, etc, of different planets. The accompanying book would act as a manual for the hands-on experience of the game. A goal (winning the game) drives the human mind like nothing else. This wasn’t just reading about the solar system, it was getting out there and (virtually) exploring it.

Dorling Kindersley turned it down. We got in front of the board and said we’d start by showing them some games on the Playstation. “I’m not watching you all play games,” snorted the DK chairman. “You can just call me when you’re ready to talk about books.” Naturally his board members all just shrank in their seats at that. Afterwards, one came up and said, “I think you can see that half of us are with you on this project. If you want to continue championing it, we’ll back you up.” I was very glad to get offered a job by Demis Hassabis a month later so I didn’t have to keep banging my head against the brick wall of nonfiction publishing.

You can’t keep a good concept down. This week comes news that Ian Livingstone has applied to start a school using interactivity and problem-solving as its primary teaching methods. It’s not just a gimmick. Students taught in that way will learn differently and more deeply than they would by traditional methods. As Thoreau said, "Knowledge is real knowledge only when it is acquired by the efforts of your intellect, not by memory."

Let me give you an example. I’ve never had much of a flair for electronics, but my practical partner at college was one of those fellows who were playing with crystal radio sets before they could talk. We’d be building a circuit and he’d say, “Looks like we need a 2 ohm resistor there.” I’d work it all out using the equations, and a couple of minutes later I’d find the theoretical value was 2.12 ohms. But my partner had got there right away. When it came to electrical circuits, I had only knowledge; he had real understanding.

Computer simulations give us the means now to allow students to develop hands-on understanding of subjects. The biggest threat will be if the old ways of assessing progress are applied to this new way of learning. It’s like asking a karateka to perform a kata when the real test is: can he break a brick or lay the other guy out flat? I’m reminded of Peter Ustinov, asked by his schoolmaster to name a great composer. “Beethoven,” said the young Ustinov. “No,” replied the master, “the correct answer is Mozart.”

And by the way it doesn't have to be a computer simulation. Boardgames are pretty effective teaching simulations too. Playing a game of the Cuban revolution in Command magazine - or maybe it was Strategy & Tactics - I had the problem of government forces facing a guerrilla war. Since I didn't know where the next bomb would go off, I had to massively increase military patrols. But since in nine cases out of ten my troops had nothing to do but inconvenience locals by asking for their papers, that only had the effect of driving the populace over to Castro's side. If I pulled the troops back to barracks, on the other hand, that gave me no chance of interdicting the rebels when they struck. A book could state that fact, but it wouldn't give you a fee for how it actually plays out in reality, just as any ancient history professor can tell you that iron weapons are superior to bronze, but it takes a simulations wargamer to say by how much.

I’m sure plenty of education’s old guard will have their knives out for Mr Livingstone’s proposals, in just the same way as that DK chairman was disgruntled at the very idea of including games in a discussion about learning. But it’s a new world coming, and the men and women who go out there to explore the solar system for real won’t have got their expertise out of a picture book. They’ll have acquired it by playing games

Image of Pandora shepherding Saturn's rings courtesy of NASA.