Fiddling Weights with Temperature

In procedural generation, the absolute simplest, most common technique is randomly picking an item from a list. More often than not, it is a weighted random choice, where each item is selected with a frequency proportional to its “weight”, a numerical value that can be tweaked by the designer.

def random_choice(items: list, weights: list[float]):
    total_weight = sum(weights)
    random_value = random.random() * total_weight
    
    # Find the item that corresponds to the random number
    for i, weight in enumerate(weights):
        random_value -= weight
        if random_value <= 0:
            return items[i]

I wanted to share a technique from the Machine Learning community that is simple enhancement to this routine that gives a lot of convenience over tweaking weights directly, called temperature.

Continue reading

Exploring Rectangle Subdivisions

Last week, I saw a talk on Vuntra City, a procedurally generated city with a fully explorable city. Developer Larissa Davidova explained that she settled on using Recursive Subdivision for the city blocks, as she wanted some level of organicness, while still only having to deal with rectangles. But she didn’t like having indefinitely long roads that cause implausible sightlines.

One way Vuntra City handles this is by subdividing a rectangle into 5 blocks, a pattern I called “whirl” in my previous article on recursive subdivision. You can see that it has no internal roads that stretch across the entire map.

But Larissa’s talk got me thinking. The whirl pattern is interesting because it cannot be made from simple cuts. What other ways of subdividing a rectangle into smaller rectangles1, are out there?

Continue reading

Books That Changed My Life

For many years, I always gifted people books for birthdays. It took a long time to realize that most people see them more as obligations than anything. I guess I was trying to recapture some of the magic they have always brought me.

The following books are not necessarily the best ones I’ve read or even the ones that have absorbed deepest into my personality. But they’ve had a distinct impact. Let’s begin.

Continue reading

My Mental Model of AI Creativity – Creativity Kiki

I went to some lectures on the future of science in games recently, and the keynote speaker was Tommy Thompson, an well-known AI expert in the game dev space.

Of course, by AI, he didn’t mean the modern sort that dominates the news. His focus is AI for games, which is algorithmic and rarely involves any ML component. Still, he spoke about the challenges the industry faces regarding Image Generators, LLMs and so on. He specifically called LLMs “stochastic parrots”, which I found disappointing. Imho it’s an incredibly misleading model of what LLMs are capable of and is usually deployed to downplay their abilities and belittle them. But it’s a common view, particularly in creative industries.

So what is a better model? It’s clear that they are not that smart in most ways we consider important, but they do have some interesting capabilities. Here’s model I use that I feel give a better intuition for what they can and cannot do.

Continue reading

Trainright

A still from Steamboat Willie

There’s been a lot of clamour about generative AI for images, like Midjourney or Stable Diffusion. It’s killing creating jobs or whole industries; it’s illegally using copyrighted data for training purposes; it’s eroding the nature of art itself. I’m sure there are many out there who would be happy to see an outright ban on AI image generators and the like.

On the other hand, it’s undeniable that this is a valuable technology. Not just for the corporations making them, but of benefit to the world. Sure, every artist unpaid is someone else’s money saved, but also as the costs of art fall, that democratises everything around art. A friend of mine made personalised Christmas card this year, a small joy of the world that simply would not have occurred before. I co-wrote a custom murder mystery with ChatGPT in barely longer time than it took to play. The lowering skills bar for indie comics and games is something I hope leads to a profusion of new original things, much as digital art and games engines have spurred it in the past.

How can we resolve these things, to have our cake and eat it? Well, society has faced this problem before and has found a solution that, though imperfect, has endured for centuries.

Continue reading