Ultima Ratio Regum 0.9 is mostly about procedurally generating the game’s items:

With the item generation itself complete (and with coins and currencies also generating), the next thing was to get items appearing in shops. This meant returning to the code that generates all possible items, and then integrating that with the code for generating a shop; now when a shop is first created the game creates a list of possible items that might appear in that shop from the much wider list of items that civilization creates, and then it puts one on each of the “stall” tiles within the shop. If the list runs out, it then reshuffles the list and “deals” out items again. This means that for some shops you’ll see similar items cycling relatively quickly, such as armour shops for example, while others – such as book shops – continue to produce a large range. Some shops, such as general stores (can spawn any low- or medium-quality item from that civilization), antiques shops (can spawn any high quality item from that civilization), curiosities shops (can spawn any medium- or high-quality item from any other civilization), can therefore have extremely large libraries that cycle around again. In turn, because some shops define particular categories (e.g. “low quality novel”) rather than specific items (a specific low-quality novel), variation can also occur there. In the picture below you’ll see a range of different shops I’ve collected from various places, selling various different sorts of goods. In all cases I’ve tried to make sure the colours of the items are logical for what the item is, and that each category of item has a different character. For example, in the top-left of these you’ll see rings and necklaces (I suspect it is obvious which is which) with the rings in this shop being turquoise, jade, silver, iron, and platinum. The others are necklaces, whose colour (dark grey, silver, gold) again reflects the actual material you see in the image of the item. In the other examples here you can see shops selling armour, various kinds of ammunition, shields, wine, wooden and pottery goods, pocket watches, antiques, ambergris, spices, maps, mining tools, and almost anything else you could think of.

The second step was to get their images appearing correctly. Every generated item naturally has a generated image, and we need to move these out of the separate program I design the graphics in (this being far, far faster than testing them within the game itself) and into the game. This might seem like a totally trivial thing, but in the graphics-creation program all the variables that might lead into the creation of an item are randomised, because in the real game they would be connected to generated civilizations – that don’t exist in the graphics creation program! So every “leadership = random.choice([‘Monarchy’,’Theocracy’,’Representation’,’Stratocracy’])” had to be corrected to “leadership = civ.leadership” for the appropriate civilization, and so forth across every variable (policies, aesthetic styles, home terrain, names of settlements, etc etc etc) that might feed into every possible generated item. This wasn’t particularly cognitively demanding but did take a little while – making the graphics separately and importing them in is still a hundred times faster, even with this tiresome final step, but this did take a little while to fully implement. Nevertheless, with this done, you could then look at any of the items on sale in a shop, and – drumroll! – get a lovely generated image and a little description to go with them. Here I am browsing through a general store:

The next step was to restructure the inventory. When I began working on 0.9 the inventory looked like this…

…and that was fine, but now I had all the items generating, it was immediately clear that some of these categories were going to become absolutely swamped with stuff (i.e. the trade goods category) while others would be relatively lacking, and that this would both generate an interface issue (and an aesthetic one) but would also make it trickier to locate the exact items you want to do something with, at a proper speed. As such, five new categories in the inventory have now been added – “weapons” (melee, ranged, etc), “ammunition” (musket balls, gunpowder, arrows, bolts, etc), “games” (board games, but also more later on), “tools” (pickaxes, shovels, watches, etc), and “survival” (the three basic resources for travelling, i.e. water, food, and supplies), each with an appropriate new icon and the rest of the sequence appropriately re-ordered. (“Keys”, “Notes”, “Scrolls” and “Tablets” do not presently exist, but will be popping up in the future). This then yields this:

With the inventory now updated the next step, of course, was to create the interface for buying / selling / trading. This is a pretty crucial part of the game so I took some time over this. The first thing was to figure out what I could fit into the screen’s size, and although it would have been lovely to fit in a) images of the items you’re thinking of buying/selling, b) images of the currency you’ll be using, c) a list of the items you’ll be buying/selling and how much it’s going to cost you, and d) any comments or questions from the person you are buying/selling from/to, it quickly became clear only three of these could fit and something would have to go. As such, the left side of the screen shows you the item you’re discussing (a) then on the right-hand side you have a list of what you are currently trading (c) and words from the person you’re haggling with (d). You can then look at the various things the person has for sale and select the ones you want, and on the right-hand side the price will update and show you a list of all the things you presently intend to buy. This looks like this in a specialist store…

…and something like this in a store with multiple item categories, e.g. a “General” store, an “Antiques” store, or a “Curiosities” store:

You then select what you want to buy by pressing enter on the items you want, and then when you press enter you are given the option of adding them into your inventory or shipping them to any other nation you are thus far aware of.

Now then, what about trading and selling? Given the lack of fantasy elements and more generally the tone of the game, we’re not going for the sort of in-game inventory where you can hold as much as you want (a la Dark Souls) nor the sort of in-game inventory where your carrying capacity is limited by an essentially arbitrary number of things (a la Dungeon Crawl Stone Soup), nor something where carrying capacity is a matter of the size of your items and organizing them appropriately (a la Resident Evil 4). After a lot of consideration and trying to combine both the interest in some of the detailed trading mechanics I have in mind here, and a degree of realism, and some long-term strategic choices it should be interesting for the player to make, I’ve settled on a two-part inventory system. Half of the inventory is the normal inventory as above, where your character carries items; all items now have a weight value, and over that weight value it takes you twice as long to move around (in-game time, not player experienced time) or three times if you really overload yourself. All items now show how much they weigh. In turn, there is a second value now, size. This value does not relate to how much you can carry, but does relate to how much you can ship to other nations to trade. You can therefore carry items yourself to other places to trade, but the more efficient method is to ship them ahead of you – but this requires advance planning of where you’ll be going next. Each nation has a limited amount of warehouse space it automatically gives you, and this space can be increased by purchasing more room in that state. Then, when you travel somewhere else, you can sell the items you have in your inventory and the items you shipped there. In this regard I was partly inspired by the rise of letters of credit in the European banking system during the Reformation (for a fantastic history of this see the novel “Q”) and also partly by things like the Hawala system, which in a very different way “abstracts” out what is being moved around and traded. I think this system both reaches a high level of realism re: what the player can carry, but also allows for major and distinctive trading mechanics, and encourages strategic thinking re: planning out your future moves, where you’ll need money, where you’ll be able to get money, and so forth.

Aside from this, various other things have also now happened. You can now find currency exchanges in market areas…

…and also when you enter and leave cities, something new now happens! This menu appears…

…and you have the option to just go on (assuming you can afford it, if the city has an entry or district cost), back out, exchange currencies at the border of the city, buy supplies, boost how much storage capacity you have in that city (infinite in your home city), or (later) you’ll be able to fast-travel to some other land location, like taking a ship to another location but instead with a horse, carriage, etc.

(You can see a tiny bit of final polish is needed here, but you get the idea)

Lastly, going back to shops, there is now a complex calculation for how much you can sell things for. Selling something in its home nation will always yield a lower price than it was bought for; nations with protectionist or planned economy policies will give you more money, but nations with free trade or mercantile policies will be far less impressed. In other nations, meanwhile, you are guaranteed as a basis a 15% boost in the sale price of anything you sell, and then many other factors come into play. For example, nations with policies clearly related to the item you’re selling will give you more money, so if you’re selling a history book to a trader from a nation with the “Antiquarian” intellectual policy, then naturally they’ll pay you far more. There are opposites to this, however, so philosophy and history books do not do well in states with the “Populism” cultural policy (it’s almost as if there’s a comment about the real world here). Some of these are complex, for example wine will sell better in a “Monastic” nation but only so long as the wine is of medium or high quality, but not low quality (since the monks have high tastes); while spirits will sell extra well in a “Conscription” nation but only at low and medium quality (since the conscripts can’t afford the highest quality drinks). There are also calculations whereby some nations will be particularly fond of goods from other nations regardless of what is being sold, and that boosts all prices – while other nations have the opposite, and dislike goods from particular places. It’s a complex set of calculations, and I haven’t listed all the factors here, but basically I wanted to ensure that a) it was logical to the player where things would fetch a high price, but also b) that this calculation was something the player would come to uncover in a given world, organically developing a sense of what the particularly good trade routes are.

Oh, and appropriate armour and jewellery and so forth now also appear on NPCs! There are of course many variables that determine what sorts of things they’ll be wearing, and especially what might be on a necklace or a ring that person is wearing, but this nicely adds to the variety of the game world – and, of course, now guards and soldiers are no longer walking around witout any clothes on, which I think we can all agree is a massive improvement.

Right, I think that’s everything for now! This is such an exciting update and I’m really pleased to finally be able to share it. There might be one last update before the actual release, but if not, come back on DECEMBER 31ST for the 0.9 release, and all the procedurally generated items you could ever want!


  • 0.9 is looking fantastic, Mark. I’m so excited to explore URR’s world, it was already feeling so alive with 0.8, but with the new item generation, things will get so much more interesting!

    Keep up the amazing work!

  • I’m amazed at how fast you manage to program complex mechanics that interact with one another and at the same time have the artistic talent to design art in such a specific stylized aesthetic. Marvelous in every regard Mr. Mark, always a delight to read your blog posts.

  • Loving the descriptions of stuff to come; makes me very excited for end-of-year. I do have a question, though I may not say it very well.

    I think it was described some time ago that some items can have clues related to the overall plot of the game. Maybe this was with regards to its actual look, or more of its detailed description. This may apply more if treasure maps were being sold by somebody, and less for items that are directly used (like armor). If an item has a clue from its visual appearance and can see the item in the shop before buying it, is there more incentive to purchasing said item than being able to view it at any time or reselling it later?

    • Thanks William! Yes, indeed, there will be clues in all sorts of items, BUT the item which will have lots of clues – e.g. treasure maps, books, etc – you won’t be able to see the clue part before purchase. For instance, I intend on a system where you can see a book’s cover and buy it, but all books will have “clasps” or something like that, and once you open them to read them, the resale value will plummet, and likewise the resale value on a map you’ve opened will plummet too. It’s tricky though, it’ll need some thought and some balance, and some feedback from players too :).

      • That’s what I figured would likely happen, but wanted to ask anyways. Can only see so much from a distance. The map could be potentially rolled up, like a poster you’d find at a retail store.

        • I like that idea! Right now it just shows a ‘?’, but that’s mostly because I needed to get the release done…!

  • Mark,

    Although Dwarf Fortress and URR are advancing the state of the art of procedural generation, it is unfortunate that this information is not widely shared. There are a lot of people who could learn from you on this topic.

    I noticed you already nixed the idea of going open source ( https://www.markrjohnsongames.com/2020/12/27/ultima-ratio-regum-0-8-released/#comment-1755 ) but could you please create a small program that procedurally generates stuff, just so we can understand how it happens under the hood? You’ve gone into great detail about generating the maps in a previous blog post, which is quite helpful. It would be even more helpful to be able to get under the hood a little. The code wouldn’t even have to function (due to missing assets or libraries), but only be well documented so that it could be read and understood.

    In lieu of the above, can you please leave some pointers on how you learned to do this?


    Required Name

    • RN, thanks so much for taking the time to write this message. I appreciate it a lot. This is an interesting idea; I’m definitely not opposed to doing this in the future. Leave that with me and I’ll give it some thought!

  • Having just poked around in the game for a bit, I want to make a few comments.

    1. The speech options are remarkable, but also overwhelming. It’s like being confronted with a vast wikipedia entry every time you meet someone. While it is better in some ways than Bethesda’s simplistic CYOA style branching paths, it makes conversation in URR a problem. How can a user know what to ask, or what information to retain? It may be required in future to indicate to the player some how what the most useful topic of conversation is any any one point.

    2. I am very interested in the story (to uncover a conspiracy) but I wonder if maximum procedural generation is the solution. I’m not sure if anyone will find the procedurally generated cultural details compelling. Here I am referring (in part) to the contents of the conversations mentioned above, which I found to be piles of nonsense. Presumably the player is supposed to remember some of it. In Nethack, objects are carried in an inventory. What will your method be for carrying cultural knowledge acquired by the player? Requiring players to remember masses of details of a randomly generated cultural details IN THEIR HEAD is a huge ask. And how will these entirely randomized, and thus arbitrary, cultural relationships produce a compelling story? I know it’s early days, but I’m having a hard time seeing it right now. I don’t want to discourage you, but this seems to me to be the biggest challenge facing your game.

    3. The art is rudimentary, but very compelling taken as a whole. It seems you’ve arrived at a peculiar style. I like it. I notice, however, that it can be difficult to ascertain what is inside a room because of the unique decoration of the floors, for example. I strongly suggest that instead of requiring users to ‘l’ook at everything, you simply provide a description of the room that lists what is visible, and to retain that list as the player moves about the room, updating it only as the player sweeps their view across it. ‘l’ooking is better for careful examination of something, whereas in our everyday life we easily grasp what is inside a room without having to take our time to look at each individual thing. If you are married to the idea of looking, then I suggest simply printing out the result of the look wherever the cursor is, instead of requiring the pressing of the enter key. This will enable faster scanning by the player. Keep in mind also blind players for whom this feature might make the difference between a playable and unplayable game.

    Can’t wait to see what you do with 0.9 in 13 days.

    • Thanks so much for these comments, RBLTCN :).

      1) Thanks! Yeah, that’s sort of what I was going for. Part of the gameplay is / will be deciding what to ask, what’s worth asking, what you ask to whom, and things of this sort. I take your point about potentially identifying worthwhile conversation topics, but I also worry that might reduce the sort of thing I’m going for. Besides, in future versions (e.g. 0.10) it should be a little clearer, as the game will let you know when you’ve got a new topic you can ask someone about, for example, or you’ll be able to more specifically ask people about a single place, or book, or person, or whatever.

      2) I appreciate the honest feedback! I’m surprised though – the conversation system is specifically designed to NOT produce nonsense, especially compared to other comparable mega-PCG games. A lot of what the player learns is carried in the encyclopedia (‘E’) but I am debating adding some kind of journal system, or other forms of information storage… yet at the same time (perhaps because I have been recently playing La-Mulana) I don’t mind the requirement for the player to keep this information. But I agree, it is and has always been the biggest challenge, but when I compare what I see in my head, to what’s in the game, I’m seeing extremely promising progress. (Though I might be biased…)

      3) Thanks for these thoughts – I agree, the list of stuff should show up without you pressing Enter! I’ll probably add that in 0.9.1. I also like the idea that when you enter a place it tells you what you can see. That’s a bigger thing, since there’s so many permutations, but I agree that would be worth adding.

Leave a Reply

Your email address will not be published. Required fields are marked *