Prospect theory and utility functions #

(Note: I'm going to try writing more unpolished things on this blog and leave the polished articles to

The utility functions I learned in economics are history-agnostic. They look at the current state of the world and calculate a “utility”. For example, you might say the utility of money is the logarithm of the amount of money you have.

Prospect Theory says that this view of the world does not match how people actually behave. Instead, the history of how you got to a certain point matters in how you value it. There's an asymmetry around a “reference point”:

(credit: Wikipedia, Prospect Theory page)

Consider these scenarios:

  • You get $200 and have a 90% chance of losing $100 of it.
  • You get $100 and have a 10% chance of gaining an additional $100.

These are mathematically equivalent. Both have a 90% chance of giving $100 and 10% chance of giving $200. However, they are not equivalent to humans. That's because humans consider not only the final result but how it was reached. Having $200 and then losing $100 feels different from having just the $100 in the first place. Even though the outcomes are the same, the reference point is different, so it feels different. Prospect theory takes this into account somewhat.

In game AI, I've only used regular utility functions. However, it seems reasonable to try using prospect theory in some way. Even prospect theory isn't complete; there are more human behaviors in decision making and valuation that it doesn't account for. Maybe FTT or something else. But sometimes you want to balance simplicity and comprehensiveness. In any case, it's something I'll want to ponder the next time I'm writing AI evaluation functions for NPCs.

Labels: , ,

Map homunculus #


picnic basketthe woodsgrandma


picnic basketthe woodsgrandma


picnic basketthe woodsgrandma



picnic basketthe woodsgrandma

Let’s look at where the events occur on this distorted timeline:

picnic basketthe woodsgrandma

They’re much more evenly distributed.


Diagram showing the function mapping reader/player time to story time

We want to do this in many types of games.



Let’s look at some games that stretch and shrink game maps.

Ultima IV-VII


Ultima 4

Ultima 6

Ultima 7







Skyrim and World of Warcraft



Civilization and Age of Empires



Transport Tycoon


To ponder



Labels: ,

Writing more by writing less #

I have a long list of things I want to write about, but the list is getting longer instead of shorter. I've been thinking lately about my writing process: writing down ideas, fleshing them out, learning a topic, writing a blog post, and making diagrams.

It's fun to write code for diagrams but it takes a long time. Bret Victor's talks make me painfully aware of how limited my tools are. Munificent Bob says he draws his illustrations by hand to save time. LostGarden has beautiful diagrams but it takes me a long time to use those tools. I've pondered a Wacom Cintiq or a Surface or a Galaxy Note or even a regular drawing tablet but I think paper and pen is simplest.

  • Big pages: 1-4 months, learning + writing + interactive diagrams. These include Curved Roads, 2d Visibility, and Polygon Map Generation. The Noise Functions page was mostly learning, but I had very few interactive diagrams, so it went quicker. The Hexagons Guide was some learning and some things I already knew, and the interactivity is low, so it went quicker.
  • Medium pages: 1-4 weeks, for topics I know, writing + interactive diagrams. Tower Defense Pathfinding and Probability for Damage Rolls would fit in this category. I knew the topics well, so much of the time was figuring out how I wanted to explain it, and implementing the diagrams.
  • Small pages: 1-4 days, writing + non-interactive diagrams.

I'm pondering doing more of the small pages. I can upgrade them later if needed.