'AI and Games' is a crowdfunded YouTube series that explores research and applications of artificial intelligence in video games. You can support this work by visiting my Patreon page.
How Do You Design Culture?
Society has taken many forms throughout millennia of human existence. Cultural norms that are established come from iteration, consensus, and communication. It defines our traditions, our customs, and values. Culture can influence our forms of technologies, our modes of communication, our artistic expression. Our cultures are defined by our religious beliefs, our philosophical stances, our political ideologies and so much more.
Could you design culture by hand? How would you go about building it? And if you could, how would you then task a computer with designing unique cultures for you to explore all within the confines of a video game?
Today we explore the inner workings of Ultima Ratio Regum: a roguelike that has been the personal quest of one individual for almost 10 years. To build a game that can procedurally generate the most culturally detailed worlds possible. Comprised of societies with their own political and religious ideologies, their own dialects and material expressions. All in a vast open world for players to explore and interact with.
In late 2020 we sat down with the games creator, Dr Mark Johnson, as he reached a significant milestone with the release of version 0.8 of Ultima Ratio Regum. We discuss the complexities of the game he has designed, how someone with no knowledge of game development sought to create this unique experience and the highs and lows of dedicating ten years of his life, towards achieving his goals.
What is URR?
Ultima Ratio Regum is a roguelike that aspires to do something rather distinctive, to procedurally generate game worlds that are not just bespoke to that playthrough, but the backstory behind it, be it the notable figures, conflicts and their religious, political and other cultural practices are the backbone of the experience. Players are tasked with solving a mystery: a conspiracy hidden throughout history that requires players to find clues throughout the game worlds by visiting different cultures and exploring them, either by chatting with people in the cities or by exploring their religious altars or scouring the sarcophagi of their royal and military histories.
The game is an open-world comprised of a map of 250×250 tiles, each of these tiles itself breaks into 200×200 tile spaces to move around in. Resulting in a game world comprised of over 2.5 million tiles that is procedurally generated one time for each new playthrough of the game. Each world map is comprised of multiple nations, each nation is comprised of settlements. You can enter a city and see the districts built within it. Each district is separated into specific building types, you can then zoom in further and go into buildings, read books in libraries, admire pottery, visit the graves of the dead and talk with the locals to learn more about the world. And that’s just one city, with the game on average generating 18 cities per world map, each with its own civilisations, religions, cultural artefacts, and dialects.
But while the scale is already quite breathtaking, the most impressive facet of Ultima Ratio Regum is how procedural content generation is used to build each of these civilisations in smart interconnected ways. This approach, referred to as ‘qualitative procedural generation’ is built to support the idea that objects – even in video games – should not be created in isolation, but are instead related to one another.
“Fundamental to URR’s world-building processes and the creation of meaning within them, is the idea of “chains of meaning”. Nothing (or at least, very little) is intended to appear in the world that is only related to itself, or only related to one other element.”[Mark Johnson, Procedural Generation in Games Design, Chapter 27]
What does this mean? Well, if you consider the flora and fauna systems that generate plants and wildlife in the open world, if a particular animal or plant is generated within a region, it can influence the possibility that others might appear alongside them. Conversely, it can also prevent specific species from appearing in that region, given that would contradict the biomes that are being generated.
This then goes one step further, if you visit the local town nearby, a healer may refer to a plant in that region as a remedy for specific ailments. It could influence their religion, with their beliefs or symbolism making reference to the topgraphy of the region. It could even influence language, as their dialects use bespoke phrases that not only refer to the world around them but are bespoke to that culture. It’s a game that is as grandiose as it is intimate, and it all stems from a procedural generation system with layers upon layers of complexity.
While Mark has spoken about the game on many occasions, be it at academic conferences, roguelike events, in textbooks and conference publications, there is also the very human element of trying to build a game of such scale and complexity and the challenges that present. URR started development late in the summer of 2011, the same year that Johnson started his Ph.D. at the University of York in the UK. However, unlike many of the other enthusiastic games academics cum developers, Johnson’s background isn’t in computer science, but rather, sociology. Johnson graduated with a Ph.D. in Science and Technology Studies in 2015 and has subsequently built a career as a games researcher, with a notable interest in the challenges and complexities faced by the ever-growing cultures and economies that surround esports and livestreaming. At the time of writing, Mark is a lecturer in digital cultures at the University of Sydney, in Australia.
And so here we are almost 10 years after the game began development and Ultima Ratio Regum v0.8 was released back in December of 2020, with some minor bug fix updates since. This update was a huge undertaking, with the game now including non-player characters in settlements, procedural face generation that gives variation based on cultural beliefs as well as genetic variations. A conversation system complete with bespoke dialects and mannerisms. Procedural clothing where the outfits of citizens will also fluctuate depending on their culture or religious affiliations. And much much more. It’s a hell of a patch, but it’s one that has taken much of the past 5 years to build. And so a couple of weeks beforehand, I sat down with Mark to talk not just about this patch, but the early beginnings of the game, its inner workings and all of the challenges – be they technical or personal – he has overcome along the way.
Mark Johnson: “I mean I would love to claim that I had this kind of massive procedural cathedral planned from day one but that would not be true. I believe what happened was I came across this tutorial for how to make a roguelike in Python and for some reason I thought ‘yeah, that sounds like fun’. And that was basically the entire thought process. I just thought ‘yeah sure why not?’. I had never programmed anything before this but I had modded a lot of games and so I had some sense of what I was doing on some level. I quickly kind of really enjoyed the sensation of being able to change things very easily and to quickly spin off into something very very different from the tutorial. I think at first I programmed in a system for having monsters judge how scared they are based on how many hostile monsters are near them, and that created this really intriguing kind of equilibrium where creatures would have kind of standoffs and would kind of approach and then back off and these sorts of things. That took me let’s say two hours to make and yet it created a kind of dynamic system which I’d never really seen in a roguelike. And so I think that kind of thing: that quite quickly and quite early I thought it’s actually not that hard to kind of create new stuff or to try new things.
And then I suppose after that there was about a six-month period where I guess I was making something extremely ‘Dwarf Fortress’-esque and quite soon I realised well a) we don’t need another Dwarf Fortress because we already have one and b) I realized that the roguelike world has a lot of sort of clone projects and I didn’t feel like the roguelike world needed another clone project. So then I sort of started to think about whether i could do something weird and different and that coincided with me beginning to get a little bit better with python and beginning to explore this kind of procedural graphics idea with ASCII art. And the first time I showed off some kind of PCG ASCII graphics the internet really liked it a lot. And that made me think ‘okay this is the thing my game will be’ because no one’s really done this. This is something which I find very rewarding to make and this is something other people seem to like and so that seemed to be a really good pairing to kind of build the game around. And then over time, the PCG graphics expanded into kind of other sorts of PCG stuff which most roguelikes don’t do like speech or religions and this type of stuff.”
And so from the very beginning, this notion of complex worlds with bespoke aesthetics and cultural artefacts began to take shape, but one of the things that has always stood out about URR is that Mark has always said in talks and publications that the game was intended as a 10-year project. But it’s not often you hear a game be described as such, or for someone to commit to such a prolonged development cycle. Saying to yourself in advance this is a 10-year game and you’re intent on making good on that ambition, sounds awfully pragmatic.
Mark Johnson: “I felt that was a realistic scope and, to be honest, if I hadn’t had some serious health issues it probably would have been actually. Because even with a lot of what I think we euphemistically called ‘challenges’. Even with a lot of challenges I’ve still got 80% of what I wanted done within the 10-year period.
But yeah I wasn’t really interested in making something smaller because, like I said, I’ve always been kind of attracted to the big, grand, mad piece of art I guess. Though once I discovered this kind of procedural graphics stuff and then to less extent the other kind of culture PCG stuff I felt like I really wanted to take that as far as I could take it basically. And I felt that wasn’t something which would be like a one-year dev cycle and then you release a game which has a few PCG swords or something. If I wanted to do it I had to really go for it and really PCG every graphic in the game, and how everyone talks and how everyone looks, and all this type of stuff.
I’ve often been criticized by online people who are less generously inclined as kind of always extending what the game should be. But the genuine truth is after about two years in the ambition didn’t really change much. From there it was just a matter of getting it done. But I think in hindsight the ‘how long is a piece of string’ issue definitely was there at the back of my head. Especially when you have like a really compelling, but pointless PCG system which you could work on. Or something really uncompelling but something really crucial. I definitely found it hard to choose option two when those choices arose.”
How Does URR Work?
Now from everything described thus far, Ultima Ratio Regum sounds horribly complex, but once you dig into the details, you discover that a lot of it is fundamentally quite simple and – perhaps even contrary to the creator’s own beliefs, the subject of some effective design decisions. As Johnson himself admits, he’s not a professional programmer. But while his technical skills have grown, the background knowledge required to build these culture simulators was much more fleshed out and established.
Mark Johnson: “Yeah I mean I don’t come from a techy background at all. There was a point where someone tried to teach me to program in BASIC on the ZX Spectrum when I was about five and I found it intensely frustrating – because I was five! I mean I think a lot of this also just stems from the fact that although I have made mods and so on this is the first game I’ve ever programmed. I learned python while making it. I knew less than nothing about how to write good code and I still don’t!
I come from a much more kind of political science-y, sociology-y, philosophy-y kind of background. My undergrad is in politics and sociology and my Ph.D. is in sociology. So yeah I had read a lot of this stuff for my own interest already. I had read like a lot of anthropology of religion, I’d read a lot of political science. All this type of stuff. As what URR was going to be coalesced I thought that was again kind of something quite new and fresh and different which I felt I could bring. Although PCG game makers and roguelike makers are an unusually PhD-heavy bunch of people, it tends to be of course Comp Sci or Mathematics PhDs. And so as someone from a very different background, again I felt that was something intriguing and different and new. So a lot of that I already had. There were definitely a few points where I would go and kind of lookup like really obscure bits of political social theory but for the most part, it was very much that stuff rather than any kind of tech knowledge which I started the project with.”
All of the generators in Ultima Ratio Regum follow a method typically referred to as a template-driven or constructive procedural generation. This means that a generator has a set of rules and even predefined pre-built chunks or samples from which to build from. Rather than having each item pre-built and ready to go, there are thousands of painstakingly handcrafted sets of features that can be used for specific generative systems and the pseudo-random number generator helps ensure variety. To take a popular example, the room tiles in Mossmouth’s Spelunky are all pre-built, but a lot of subsequent actions are applied to each room tile to change them up and make them feel more unique on each playthrough. This emphasis on variety still enables for enough diversity provided that the range of templates you work from is sufficiently broad.
So let’s take a look at a specific example in Ultima Ratio Regum: the creation of family crests. The crest or shield generator has a number of existing pre-built components from which it can then use to create the final piece. This includes pre-built templates on the design of the shield, each with its own rules on the layout, size and shape, and key features. Then there is the specific graphic or crest on the shield itself, whose availability is influenced by the type of shield design. Once we get to the design, there are a lot of options, we could have a gargoyle, a skull, the sun or even a snowflake to name but a handful of the dozens available. Each of these graphics carries specific traits, such as the types of properties used in the language of the family motto or what the family perceives as their strength and virtues, not to mention the ASCII art for the graphic itself. So as particular options are selected in the creation of the crest, it prevents specific properties from being used but also enables others.
This of course requires a lot of time and effort during development to ensure there is sufficient range in the properties visible. Even in this one example of family crests, there are 5 different shield designs and over 70 unique graphics that can be used. The design types can enable multiple graphics per shield and even the colours used when drawing the art to the screen is influenced by the decisions made along the way.
This process is largely replicated across all generators in the game, it’s just how the pre-built chunks are established and the rules for connecting them will vary. If we consider one of the more complicated systems from the 0.8 release, the procedural speech and dialogue systems for NPCs, the same rules apply, it’s just the rules and templates established are more nuanced.
Every character in URR can speak English, but each culture has its own dialect. To facilitate this, the dialect will have its own set of nouns. To achieve this, syllables are first created by lumping sets of letters together, and then names are crafted by multiple syllables stitched together. These names can be used for locations, objects and even people. The naming conventions can vary with each culture, given their stitch syllables in pairs or triplets. Furthermore, each culture can create its own set of greetings, insults and compliments. And when responding to questions prompted by the player, the sentences can vary in depth and complexity, based on an idea of how verbose that dialect is. So while some cultures may speak to you with rather flowery language, others may seem more curt or direct.
But the number of pre-built templates is only one critical part of ensuring a rich and diverse set of possible outcomes, it’s also about the probability distribution of how frequently these items appear. Do all the family crests run the risk of looking similar to one another? What are the odds that two cultures use markedly similar dialects? This is always a challenge with procedurally-generated games, given you want to maintain a sense of familiarity while continuing to provide novelty in each run. For Johnson, the intent was to go in the other direction. And ensure that every new culture feels bespoke and sufficiently different from all others that appear in your current playthrough.
Mark Johnson: “A lot of PCG games have kind of ‘flat’ generators and what I mean by that is maybe there’s 10 outcomes and each one happens one in ten times, that type of thing. Whereas it’s far more compelling to have say three outcomes which each happen 30% of the time and then 50 incredibly obscure ones which only happen 0.2% of the time.
For instance a game like ‘The Binding of Isaac’ does that quite well because it has a large number of extremely rare things which can happen and that makes it kind of quite compelling I think. Because it pretty much always gives you something unusual to latch on to when you’re doing a playthrough I guess is how I would put it. And so my thinking for URR was I didn’t want that. At the macro generation level there should be big differences between each world, between each culture, between each
whatever. So there are lots of hidden functions in the game which basically check if something that’s been created is too much like something else. And if it is then it spins it and re-rolls and tries it again. That I think is a really central part of how you generate stuff.
It kind of foregrounds difference it’s really obsessed with making things different. And to me, a good way of doing that is to have at the kind of macro-level a smaller number of really different templates which then bifurcate after that because it makes sure that things are are always quite different when the player encounters them. So it takes a lot of time, but I must say when you spend the day creating a procedural ASCII vase – as probably the only person who’s ever created a procedural ASCII vase – when you spend the day doing that and it looks bloody great by the end then you feel that was a day well spent. I have created a new piece of interesting generated content which is meaningfully different from everything else in this world.”
And when you start laying out how many generators there are, you already begin to see the scale of this monumental task that Johnson offered unto himself. The actual final number is hard to tell, and Mark himself wasn’t entirely sure when I asked, but it means for every possible facet of the game, there is effectively a collection of pre-made, curated options for the generator to select from.
But regardless of the number, they vary in depth and complexity given the particular challenge they’re designed to tackle. Hence some generators, even those that are highly critical to the experience, can be very simple, while other seemingly innocuous elements to the player present massive challenges during development.
Now it’s safe to say that all of this sounds cool, but also still markedly formulaic. It’s not going to result in this plausible, sensible world that players experienence in URR. Which brings us to the next step of URRs generative process.
Returning to earlier when I discussed the dialect system, it’s much more complicated than I originally described. A given culture doesn’t just have its own naming convetions and set of common phrases, they also have their own unique forms of expression that reference aspects of their heritage. A NPC you speak to can discuss aspects of their political or religious ideologies, they can comment on a topic by relating it to local geography or wildlife, or by referencing a well worn story that is defined in their cultures history.
So it’s pulling from other parts of the established game world in order to build the dialect. This history, the geography, the political ideologies are already defined before the dialect is established. And this is the real secret behind Ultima Ratio Regum, the chains of meaning we described earlier are achieved by having some procedural generators read the output of other generators as use that as part of their own creative process.
Mark Johnson: “A lot of roguelikes have disconnected things, like you’ll have a floor on Nethack and one room contains a lake, and one room has a bunch of leprechauns, and one room has some lava, and one boom has a bunch of swords, and one room has a whatever. There’s no links there; it’s just a bunch of rooms picked at random. So I thought well what’s the kind of extreme antithesis of this? And the answer is connections: everything should be connected in some way.
So every concept should in some way link to every other concept. If someone’s from a culture where ravens are thought to be lucky, then the player rocks up with a shield with a raven on it, they should go ‘oh great shield, I like it!’. That to me felt extremely un-PCG and so seeing whether I could PCG a world that didn’t look like PCG seemed both like a cool challenge but also like a really good way to develop something new, something different and something which wasn’t just random rooms and so on.”