Crowd Mechanics (Part 2 of 2)

This week I’ve pretty much finished off crowd mechanics for cities. I’ve also been working on the lower tiers of clothing, and the middle-class clothing looks great, but the lower-class clothing needs some work to be aesthetically comparable to the upper/middle equivalents, so I’ll show that off in a future entry. Right now, though: crowd mechanics are done (or cities), and that’s what we’re going to talk about here.

Permissions (and Guards)

Each tile of the human-scale in the game now has a variable called only_allow – this lists the permissions required to enter that tile (if the list is empty, than anyone can enter it). For example, we might have (“Religion”, 25) which means that believers of the religion with the “25” id can enter it, (“Family”, 6), and so forth. Sometimes I’m sure these will overlap, though currently they do not. At the moment these restrictions exist on upper-class mansions (where only that family and its allies can enter), warehouses in shop districts (so that random citizens don’t path towards them for no reason), religious buildings in religious districts (where only believers will enter them, though I suppose very occasionally someone from another hostile religion will…?), embassies in city centres (which are heavily guarded), and military districts per se. I’m sure some others will appear in the near future, but those are the only permissions in the city so far. As well as the existing crowd mechanics, I’ve also begun to write the code for guards who are tethered to a given permission, and are alerted if/when that permission is violated, and will act accordingly – but this isn’t a crowd mechanic, and isn’t finished, so we’ll talk about it more later. Here’s a simple example of a permissions diagram for an upper class district along with the outside of that district, where the areas inside walls for each of the major families is blocked for any outside that family (I will be adding in “lesser families” this release and giving them appropriately less-impressive crests). It’s simple, but effective (the other houses around the edge are wealthy, but not wealthy enough to merit guards, “territory” in the district, etc).

Upper 1

Upper 2

Irrelevant and Branching Roads

The NPCs on roads now avoid (for the most part) roads which go nowhere, and if they do go down a road which goes nowhere, they know that and will generally branch off and move towards their own target outside the road system. Equally, NPCs will no longer run in circles sometimes (a major improvement, as I’m sure you’ll all agree) and won’t branch onto tiny pieces of road. They can also cross each other intelligently without losing their sense of direction – in an earlier version two NPCs walking around each other would sometimes get “diverted” by the act of stepping around each other and wind up changing direction. Many of these irrelevant roads are also connected to permission-based areas as in the above section, and this is obviously a system I’ll be developing in more depth in the future as NPC/player relationships and factions become more complex. So this is the district from the above diagrams, where the light green roads can be walked by anyone, and the dark green roads either cannot be walked, or will only be walked by those with appropriate permissions or pathfinding objectives:

Upper 3

Moving Off-Road and On-Road

As above, NPCs can now sometimes decide to move off the road to find their own targets. They’ll do this if they see themselves approaching a dead-end road, and they’ll sometimes do this anyway regardless of what kind of road they’re on. In these circumstances they either select a region of the map where there is nothing in particular and path to there, and then continue pathing from there to elsewhere if the player is still viewing them (or despawn if they’re out of sight), or they will choose to path towards a specific door (which they have permission to enter) and then go through that door. As the below gif hopefully shows, this makes the movement of NPCs appear far more organic and stops NPCs looking like creatures just being channeled down the road with no ability for doing their own thing. We’ll obviously see how this works once we introduce important NPCs who have their own non-crowd objectives, etc, but you can see it pretty well in the gif in the section below…

Crowd Generation

The game can now generate appropriate “crowds” who might move around. For example, a civilization with the “Theocracy” and “Vassalage” ideologies might decide to have priests moving around their city, escorted by priests. A civilization with the “Monastic” (new to this release) and “Conscription” ideologies might enlist conscripts to escort high-ranking monks safely. Equally, there are some more general groups – groups of clerks and diplomats in the city centre, groups of general humans in any area, etc – who can also spawn in any nation regardless of their ideological preferences. Here’s an example of a priest and a few general citizen followers moving around a district – one will also note that certain skin tones are surprisingly hard to see against the road’s background colour. On the one hand, all roguelikes which expand their colour schemes a little bit (e.g. DF, CoQ, etc) will sometimes have certain colours which can’t be combined well, and whilst it’s annoying I’m not sure if there’s a solution; but on the other hand, maybe there is some solution? Change the road colour to make it more grey so it always stands out against all skin tones? I’ll ponder it. Either way, this gif starts with a priest (‘p’) being escorted by a bunch of soldiers (‘5’) moving around the corner around this religious building. I then just let it play on a little longer to see the slaves (since this is a slaving nation) wandering about. Note also that the game ensures the priest is “leading” the little convoy, since i had some problems with the leader’s escorts dancing around in front of the leader due to a quirk in the pathfinding system. Enjoy!


“Party” Generation

I’ve also implemented a system where “parties” (in the “group” sense of that word) can spawn more organically around certain areas – these include parks and gardens, around taverns, around markets, and in graveyards. In this case a number of NPCs from all over the map will path towards the area and then basically “hang around” for a while, before then making their way off. I’ve found around some places it gives an interesting feeling to these areas when you just sit and watch, and although I’m still working on exactly balancing the algorithm so that the ebb and flow of NPCs is exactly how I want it, this gif from a city centre garden is *fairly* illustrative, though it still needs some tweaking. And bear in mind, of course, one isn’t generally going to be waiting around to see the grounds form and un-form, but I’ve just stood here for this example so we could see groups forming, growing, and then disbanding.


District Demographics

I’ve also implemented a system for spawning appropriate demographics of NPCs (and their clothes, items, etc) for each NPC who spawns in each district. This comes down to three things: NPC type, NPC wealth, and NPC “distance”. To explain this slightly better, let’s have a look at this diagram, newly added to the in-game Guidebook (‘?’ to access). This is (currently) the full set of possible NPC types which will be able to spawn in the game:


So, NPC type is the “class” of NPC – we might want general humans to be spawning in lower-class housing districts, classes of soldier to spawn in the military districts (who I intend to give patrol routes to, but that hasn’t been coded yet), clerks and diplomats might be spawning in the city centre, and so forth. Capital letter NPCs will be specially tracked by the game, whereas lower-case NPCs make up the crowd. Also, nations which keep slaves will spawn slaves in the appropriate districts, just as nations which have eunuchs will spawn a very small number of those unfortunate individuals around the place. NPC wealth, meanwhile, means currently the quality of their clothing (and, in the future, the quality of any armour, weapons, bodyguards, jewelry, etc) – this is obviously closely tied to the district that the crowd NPC is spawning in, but with some variation. Middle-class districts spawn mostly middle and a few lower wealth NPCs, lower-class districts do the reverse, markets spawn an even mix, and so on. NPC distance, lastly, relates to whether the NPC spawning is from that nation and from its capital; from that nation and from a distant town or colony; or from a different nation altogether. Currently everyone who walks around in a city is from that nation (though I will of course later add groups from other nations) but might be from different regions, so you’ll see people who are culturally similar – clothing, hair style, etc – but physically different (skin tone, hair colour, eye colour, etc) as they come from different areas of the same nation. The game picks all of these according to a range of factors, and then spawns a mix of NPCs appropriate for the crowd in a given nation.

Bugs and Issues

In this process I ran into a bunch of bugs and issues. Firstly, for some reason, saving and loading the game would cause the AI for each NPC in the crowd, and the NPC itself, to become disconnected so they no longer referred to each other, meaning that when I tried to delete “self” from the list of NPCs when a given NPC no longer needed to be around, it couldn’t find self, and crashed. Weird. I tried to find a proper solution to this issue, but in the end I just changed it so that the scheduler only referenced the .npcid of each NPC, rather than the NPC itself, and that meant that even if some byte somewhere in the AI changed itself in saving/loading for reasons I could not divine, the npcid was always remaining the same (being a variable, not an instance of the AI class attached to an instance of the NPC class), and so the game could always identify the correct NPC and AI to delete upon reloading. Similarly, moving on the human-scale from district to district made some weird errors like massive groups of NPC suddenly spawning and NPCs from the next map tile teleporting into another map tile, but those were all quickly fixed. Some maps were also coming up with extremely rare tiles which didn’t have a .roadmarker variable, which denotes what NPCs are/aren’t allowed on it and whether it is a road curve which should be treated specially, but that was due to another bug I hadn’t even noticed involving the types of terrain spawning under trees (we had some trees spawning on road tiles!). This has all been sorted, and it all runs extremely smoothly. Additionally I noticed some unnecessary variables were still stored on every tile in the human-scale maps, so those have been removed, and save files have been reduced by around 15% as a result, with an attendant (very minor) improvement in load times!

Next up?

Well, the next things to do are to extend this outside cities. I need to get NPCs behaving sensibly in slums, graveyards, villages, fortresses and tribal settlements, each of which is going to need some unique changes to the algorithms I’ve worked on for cities. After that, we’ll be moving onto handling NPCs within buildings (and entering/leaving buildings), which is obviously extremely imporant. Then we’ll be moving onto unique NPCs who are specially tracked by the game because they matter (merchants in shops, rulers, nobles, etc) and who therefore need to be able to move around the world. These three steps are my three primary goals for the rest of July (it’s a lot, but I think I can crunch it), then in August I’ll be moving onto finishing off clothing styles (we’ve got feudal clothing almost finished, but I need to add military clothing, religious clothing, nomadic clothing, and tribal clothing, so there’s still a ton to do on that front!) and adding in a conversation system to the game. This system is going to be essential, so I really need to think hard about how the conversation system should work, what the balance is between the hand-made and procedural, etc. Then I need to redo how families and allegiances/associations work, fix a bunch of minor bugs from the last few versions which continue to stack up, and then 0.8 will (amazingly) be pretty much done. Aiming for a September release currently, which is around the time I’ll be starting a new job I can’t yet formally announce, and probably starting work on the other secret project I also can’t yet announce (both game-related, though!). Exciting times! Let me know what you think of this week’s development, and I’ll see you all in seven days…

Crowd Mechanics (Part 1 of 2)

This week I’ve been developing the crowd mechanics, and it’s going well, but first we need to talk about how exactly I need this to work:

We have two levels of resolution: the map grid the player is walking around on, and then every other map grid (in the 250×250 tile world map) which is not currently loaded. Therefore, any NPCs who are important but are not currently spawned must be tracked by the game when they’re on a non-loaded world map tile. This, of course, gets very complicated when you have an important NPC start on the loaded map tile the player is walking around, and then step off that map tile onto another… and then how do we track them over, say, 50 turns if the player THEN decided to follow this important NPC onto another map tile, spawning that tile (which the NPC has been walking in, even though it hasn’t been spawned)? Well – for the time being we aren’t worrying about that, although I think I have a good solution. What I’ve been doing this week is getting the standard crowd spawning and walking around sensibly in city districts, which means Lower-Class, Middle-Class, Upper-Class, Military, Market, City Centre, and Religious districts (docks and castles are still not spawning; castles will be coming 0.9, and docks either 0.9 or 0.10 depending on how development plays out).

I tried a few systems last week where NPCs could walk freely around the map without paying attention to the roads, and this ran into two issues. Firstly, having 100+ NPCs moving at once was necessary for the city districts to not feel like a ghost town (even if I made sure the game slyly spawned/de-spawned NPCs around the player to give a false impression of greater density) and this, on 200×200 maps, was beginning to cause minor performance issues; secondly, it just didn’t look very interesting, and there didn’t seem to be any real method or deliberate action to what NPCs were doing. If you trailed them until they hit their target location, they’d just then choose another location, and repeat.

So, this new method had three logics: firstly, to create a form of pathfinding which doesn’t actually need the game to calculate paths to reduce CPU usage; secondly to make NPC movement seem more deliberate; and thirdly to allow NPCs to “path” (or rather, fake-path) towards the gates at the edge of cities, and thereby withdraw themselves from the map if the player trails them long enough, rather than just continuing to identify new locations on one map which they are allowed to travel between. So, I got to work.

LayoutsThe first step (above picture) was to identify areas of the map which a) any NPC could walk (light green), b) which any NPC could walk on and which were curves in the road which the NPCs would have to stop walking straight to traverse (yellow), and which only certain NPCs would be allowed on (dark green) for each of the seven current city districts. There are also some areas of the map which aren’t roads which are blocked to some NPCs (like the courtyard in a mansion, for example), but those aren’t integrated just yet. I created this secret road map, got NPCs spawning on roads, wrote a bit of code for them to be able to identify another road coming off the first road, and let it run.


The first trials would up like the above picture. NPCs spawned on roads, and could sometimes path correctly… but they were always looking for other branches of the road networks they could move onto, but seeing parts of the road they were already on as being a “different” road, and therefore they kept flicking uncertainly back and forth between hundreds of subjective “roads” which, to a human player, would be obvious.The next step was to add a road_direction variable (basically the same as the player’s facing variable) where they keep track of what direction they have been moving, and they can’t read a “road” into their current direction, or their opposite direction, and thus will only detect new roads to explore if those roads are at right-angles. I then upgraded the code for the curves, creating hidden “lanes” for the NPCs to path along:


Which can be usefully compared to the overall pathfinding map for the same district…


…for when we come to NPCs moving off the roads.

Anyway. With that fixed, I upped the number of NPCs, and we got this wonderful image:


This looked cool, but it was a bit too dense, and they looked too similar all sticking to the road paths rather than diverting. We’ll be coming to the “going off the road” issue later in this entry, but the next step was to try and balance their spawning, de-spawning, and the density of the crowd. I firstly needed to make sure an equal number were spawning in front of the player and behind the player, and that some NPCs would spawn directly at the gates, even if those gates are in full sight of the player, and that they would then cut back across the player’s movement. Once that was done, and people were likely to spawn in front of the player, and behind, and at all different locations – and a full complement of civilians was spawned before the player even set foot into a map grid – we had something which looked much better. Here’s a gif of watching a wide range of people wandering around (for now it is spawning them with a random culture, rather than spawning an appropriate population distribution for each nation), and then after they’ve walked around for a bit, I decided to have a closer ‘l’ook at one of them and browse their clothing:


And here’s a comparable screenshot of  “examining a passing NPC” in progress, which I have chosen simply because I really liked how this guy looked:


Two stages now remain: to ensure this works for all city districts (and then extend it to tribal settlements, fortresses, towns, etc), and to also make sure that sometimes NPCs wander off the road and go exploring on their own. The first is still in progress, but the second seems to be going reasonably well. The objective is to get the NPCs very rarely “breaking off” from the road and heading to other places on the map, either a randomly-selected location (which they are allowed to walk on), or a door they are allowed to go through (so a random “human” (‘h’) can path towards a random house in a lower-class or middle-class district, and then if the player sees them go through, that NPC is then associated with that house). Equally, we should have a small number of NPCs spawn off roads out of the player’s line of sight, and then path towards the roads, and then move towards road properly. When working nicely, this gets the majority of NPCs keeping to the roads, whilst very rarely we see one of the NPCs break off and head elsewhere, and if you follow them, they will either carve a path through the terrain or make their way to a door and then pass through – I’m clearly going to need some flavour text for “You see a person go through a door”, “You hear a door open and shut” if you’re right next to it but don’t actually see them go through, etc (whilst making sure this doesn’t get obnoxious and it doesn’t fill up the message log). As was suggested in a previous thread, I’m also going to add lots of flavour text when you enter/exit buildings, but that’ll come later this release. I’m still finishing off the pathfinding to non-road areas, so that’ll probably come next week when I’ll likely have finished pathfinding (I hope) and have the remainder of that to show off, and possibly some other clothing too? See you then!

IRDC 2015

I’ve just got back from this year’s (UK) IRDC! Here’s a little report on my (mis)adventures at the conference, how things went overall, the speakers and talks we had, some reflections on boardgames from a person who never plays boardgames, and a couple of broader game design-y thoughts thrown into the mix.

The National Videogame Arcade

So, first off, I must give an immense thank you to the National Videogame Arcade for agreeing to host us, and even kinder, for agreeing to fund the conference themselves! I appreciate it immensely, and it was a pleasure to get to use a really great conference space in a building full of awesome gaming stuff. The broad question of “how should we curate/display/archive computer/video games?” is an ongoing debate in academia and elsewhere which is far beyond the scope of this blog entry, but suffice to say: I think the NVA offers a great experience in its ongoing exhibits, there has clearly been a lot of thought put into every area of the building, and the conference/speaking area is very welcoming and has a strongly collaborative atmosphere to it. I also very much appreciate being asked to speak at the GameCity Nights event on the Thursday before the conference, which was great, and for the NVA’s understanding when I was suddenly too ill on the Friday to give a second talk to Notts students.


So: after the successful first talk, and feeling wretched on Friday from a sudden bout of food poisoning and losing my voice, we then moved onto the conference proper:

Day 1


On the first day we had fourteen talks, and hopefully we’ll get all/most of these on Youtube soon:

1025 – “”And [my bot] vowed to return victorious!”: Spelunky as an AI Benchmark” (Tommy Thompson)
1050 –Dungeon Crawl Stone Soup Development” (Pete Hurst)
1115 – “Alternative Death Systems” (Darren Grey)
1140 – “Generative Design” (Paul Jeffries)
1205 –Modability and You” (DarkGod)
1330 – “Making a Roguelike that uses Twitter Data” (Sean Oxspring)
1355 – KeeperRL Development” (Michal Brzozowski)
1420 –The Curious Expedition Development” (Johannes Kristmann)
1445 – “Murder Puzzle – No Longer a Roguelike” (Ido Yehieli)
1510 – “Scaling Brogue (Flend)
1535 – “Creating a Procedural Level Editor” (T M Stoddard)
1600 –Sir, you are Being Hunted Development” (Tom Betts)
1625 – “Algorithmic Generation of Global Racial, Cultural, Religious, and Architectural Variation” (Me!)


Talk 1 Talk 2 Talk 3

There were some very interesting talks in the bunch! I tried to mix up the scheduling of the AI and the PCG, the modern and classic roguelikes, the technical and the aesthetic, etc etc, and I think it went reasonably well. It’s also nice to give people a chance to present their work who perhaps aren’t used to presenting to other game developers/designers, and I think the strong inclusivity of an unconference like the IRDC is one of its strengths (even if we do get some slightly “rougher” or earlier-research talks than in other conferences!). Afterwards, we grabbed some food, but I still felt like crap, so sadly I had to back out and get an early night (and so I could get back to the NVA early the net morning, too).


Day 2

On Day 2 I felt less wretched, and the plan for this day was to have an exhibition of both roguelike art and classic roguelike games, and to try and encourage those who came into the NVA into the exhibition to try their hands at the games.

This… was not totally successful. The setup was great, the posters were really well-printed and looked awesome, but there were several issues. Firstly, the fact the room was down a corridor and around a corner from the main lobby definitely had an impact; even with the large “COME PLAY ROGUELIKES!” sign an NVA staff member kindly deployed, it still appeared “off the beaten track” from the rest of the arcade (though there was obviously nothing that could be done in this regard, and the room itself was great); secondly I perhaps should have included more non-ASCII roguelikes in the mix and I had perhaps underestimated how scary and un-user-friendly these appeared, even with our residents experts (and a number of the devs of the games on display!) on standby to help out; thirdly, I had miscalculated what I thought the demographics of the NVA’s attendance, and a far larger percentage of those turning up were children and young teenagers, rather than older teenagers-and-older which I’d expected; and fourthly I should have deployed some kind of chart showing the controls for each game, as well as having experts on-hand to help.


But: it was the first time we’d tried anything like this (and the first time a roguelike exhibition/showcase has ever been tried?), so I still think it was a worthwhile experiment, and if something of the sort is ever attempted again, it’s clear we need to make some significant changes, and to alter our plans on the fly based on where we’re based, if it’s going to be a success. We got probably around two dozen people of various ages over the day trying them out, and I was pleased to see a number of players spending time on DoomRL, The Curious Expedition and my own work, but it definitely stands more as a useful experiment than, if we’re honest, a great success. I might write up some more thoughts in the future on displaying games whose mechanics are not immediately obvious (I noted the NVA had Pole Riders set up, and the ease with which people could pick it up and play it really hammered home that a lot more effort will/would be needed to make a roguelike, or some comparable game, at all easy to pick up, or to at least intrigue people enough that they’re willing to spend a few minutes figuring out what to do), but that’s all for now.


Afterwards, myself and a few companions went off to play boardgames, and this brings me to my next (slightly more abstract) discussion which isn’t actually related to the IRDC specifically…

Thoughts on Boardgames

At this point I must make a shameful and shocking confession – I don’t play boardgames at all. I’m aware of the incredible growth of boardgames in the last ~5 years, and I think it’s great because anything which brings games (of any sort) to wider and wider audiences can only be good, and people who do play boardgames tell me there are some real gems out there (even if I haven’t encountered them). Anyway, Darren Grey had brought along a bunch of board games, and I decided to give them a whirl, playing some Labyrinth, Hey That’s my Fish, Coup, Resistance, and Welcome to the Dungeon, and I must say I enjoyed them all tremendously (Resistance was my favourite without a doubt, at least in part because it was akin to the thirty-player month-long games of Werewolf I used to play on twoplustwo back in my poker days).

Whilst playing these I was particularly struck by their similarities to a number of traditional (meaning 52-cards, 4-suits, 13-ranks) card games. Coup had a rummy-like aspect; Resistance was, on one level, somewhat akin to a trick-taking game with a trump card (the “Fail” card); Labyrinth was also somewhat akin to rummy’s card-counting necessity when trying to deduce the melds one’s opponent might be pursuing; Welcome to the Dungeon was strongly reminiscent of bidding in Bridge where one strikes a balance between making a successful bid more challenging to your foes, and establishing a bid you think you can actually make; and so on. Perhaps this is just my brain (well-attuned as it is to classic-card-games) making certain connections where others would make different connections, but I still thought it was interesting how many mechanics seemed to me to have been developed from more traditional card games.

I also found myself surprised by how much I struggled with hex games compared to square-grid games, and this has made me ponder a little more about whether whatever ability I have to rapidly “read” a computer game simply doesn’t transfer that well into board games. This seemed particularly strong when I noticed I was winning every game of Labyrinth – based on a square grid – and losing every game of Hey That’s my Fish – based on a hexagonal grid! Now, this is a small sample size, of course: I think we played three games of Labyrinth and around eight games of Hey, That’s My Fish. However, the statistics remain rather striking: a 100% win rate on the square-tile game, and a 0% win rate on the hexagon-tile game, both of which were four-player games. I realize that in x% of times (where x is a number I cannot calculate right now) that will just be from variance and luck, but I don’t think it’s that. Multiple times in Hey, That’s My Fish I made a move without realizing how good that move would be for somebody else, and not of course out of any misunderstanding of the core mechanics – I just didn’t see what would happen. I also failed to spot potentially strong moves on the hex grid multiple times, and found it surprisingly tricky to calculate sensible future moves by the other players. By contrast, I felt I was playing Labyrinth very strongly, making educated guesses about what objectives other players were going for, thinking through carefully all the repercussions of my moves, and utilizing the “fixed” and “movable” points on the map as best as possible (particularly trying to place my piece in a fixed location where possible to reduce the possibility of my opponents messing with my positioning). Either way, I’ll ponder this a little bit more, but I’m definitely interested in board games from this point onwards and I finally acknowledge Darren’s insistence that board games have a lot to teach us about game design…

Oh, yes, and we signed the NVA Developers’ Wall! A great honour!


A Couple More Things

– Next year, we might in Paris. I put this here in the hope that the person who offered this will now feel compelled to host it in order to not disappoint!

– The Curious Expedition is a delightful game, a wonderful addition to the growing arsenal of modern non-ASCII roguelikes, and I cannot recommend it highly enough. Go and buy it now!

– I was told yet again that I should do a 7DRL some time… but don’t hold your breath.

– I had some super-interesting discussions with other excellent games thinkers about the possibility of totally removing combat from URR. I continue to ponder this idea, but haven’t reached a conclusion yet.

– Lastly, and not related to the IRDC: something extremely exciting is hopefully soon to be confirmed, and it is something that I think everybody who reads this blog is going to be interested in. More on this when I can speak about it (assuming it all comes together!)

– Next week: pathfinding and crowds?!?! I’ve gone through two models of crowd mechanics already, and neither was good enough, but I think I’ve finally cracked it this time.

Clothing, Characters, Inventory, Faces, Genetics, etc

Other stuff to read

Before we start this week’s entry, I have some other stuff you might all like to read! This week I had a piece published at First Person Scholar about the intriguing player-AI dialogue which develops in the danmaku game “Warning Forever”, and a piece in Memory Insufficient about the alternate history aesthetics of the Red Alert series. If you’re interested, do give them a read and support those other two sites!

Now, on to this week’s many attractions:

Clothes as Items, and Inventory Changes

Clothes have now been transported out of the file I use for working on the game’s graphics and added into the game itself, and turned into items (with a horrifyingly large number of variables – it took me much longer to integrate them than I expected). When you look at an item of clothing, it tells you nothing except the quality of the tailoring – “ornate”, “well-made” or “poorly made” – and what type of thing it is – “shirt”, “pair of trousers”, etc, and tells you nothing about the nation it is from, as that’s part of the learning/discovery process. Along side this implementation, the inventory system has been changed. Previously there were different keys for each action, so one would press ‘d’ to ‘drop’, ‘D’ to ‘drop several’, ‘t’ to throw’, and so forth; they’d then bring up your inventory, you’d select the item you wanted to perform the action with, and go ahead and do it. However, this meant you only saw the picture of the item when you pressed ‘i’ to simply look at your inventory, and that meant the images were (to an extent) being wasted. I’ve now changed it so that there are only two inventory functions: ‘i’ brings up your inventory, and ‘D’ allows you to drop many items at once (without looking at them). When you now press ‘i’, therefore, and choose an item, a line of text at the bottom of that item lists everything you can do with that item, so you always get to see the graphics, and the range of possibilities for each item is made a lot clearer (so things you can wear, or things you can use in some way, or eat, or whatever). I think this is a lot better, makes more use of the graphics, and tidies up the UI a little (given how many roguelikes use every damned letter on the keyboard). An example of a piece of clothing currently un-worn, and one being worn:


Character look-up

The look-up window for any character (player or NPC) has now been significantly changed and upgraded, and faces have also been moved out of the graphical-testing file and fully integrated into the game’s code. The first page currently shows the face of the NPC you’re looking at (or your own), and lists everything that person is currently wearing (which is visible; rings are “invisible” if they have gauntlets/gloves). The second page will soon show health, but I’m still working (yet again!) on thinking through how health is going to work, so we’ll have to see, and for now it has been removed (and will probably stay removed for 0.8 unless I finally figure out how health will work, even though I know how combat is going to work). So here’s a shot of me (without a first name, so the name up there is my family name), and this time I happened to be in the “scarification” civ. You’ll also notice I’ve made all eyes into a light grey instead of white! The reduced contrast is far less jarring.

Blue man shirt

Browsing clothes

The coolest thing about the new look-up? You can now hit Enter and browse through all the things a character is wearing, using the arrow keys. As you move around the “grid” of things the character has on them, each image then appears on the right-hand side (the first time the right side of the screen has ever been specially used!). For now, therefore, you can look over the upper- and lower-body garments, and boots, but I’ll be working on all non-armour garments in this release, meaning that we’ll be adding gloves, and probably cloaks too, but armour will come next time, and necklaces and rings will come… whenever. Either way, here are some nice illustrative screenshots of this! (With some placeholder first names and surnames…)

Blue man shirt

Blue man shirt

Blue man shirt

NPCs are now spawning

This speaks for itself, really, given the above screenshot. They don’t move, think, react, converse or do anything yet, but they are there, and the game can handle them and draw them correctly, and the player can ‘l’ook at them and browse what they’re wearing. My objective for this coming week before the IRDC is to really crunch and try to get crowd mechanics working to the point that NPCs will spawn and despawn out of the player’s line of sight. As for line of sight and field of view, there’s something cool on that point later down this entry…

Genetics, Culture, etc

I’m pleased to say (and one might extrapolate this from the integration of the facial images) that we’ve now got a model for genetics and cultures spreading around the globe. Genetically the game now chooses large chunks of land for eye and hair colours (they bleed out around the edge, but these screenshots show only the dominant colour in each region; equally, although these are very geometric and unsmooth, that doesn’t ultimately matter, since populations of NPCs in-game will always blend and travel). The first picture shows eye colour variation, the second hair colour, in a generated world:

Eyecolours Haircolours

As for how these work for individual NPCs, basically, each nation has a “core” set of values for their skin tones, eye colour, etc, and that’s based on what values are present in their capital city specifically. Equally, they can also spawn NPCs who might have been born hundreds of miles from the capital, but are still within the same nation. The further you get from a nation’s capital, therefore, the more and more people you’ll see who are born according to the demographics of that particular area, and the closer you get to the capital, the more you’ll see people who look like the people of that capital city. Cultural norms will be maintained however far you go – so people in the capital and a distant colony have the same hairstyles – but visual/genetic markers (eyes, skin, hair colour, etc) will vary as you move around. So if you have a capital city on the far, far east, and a colony of that nation on the far west, and in that colony you might expect 25% to “look like” they came from the capital in terms of eyes/skin/hair colour, most to look “native” to that colony in eyes/skin/hair etc, but they will be visually unified according to their hair styles, other cultural markers, beard styles, clothing, etc etc. So we basically have two layers – the “genetic” and the “cultural” – and these blend and intertwine as you move around the world. Also, different types of civilization have different levels of cultural variety – the open and well-traveled nomads have the most variation within a nation, the small tribal societies have the least, and the feudal civilizations are somewhere in the middle.

Field of View Optimization (at last!)

People have been asking for this for years, so I have finally put some time into optimizing the field of view algorithm, and now you can see basically everything on-screen at one time. Buildings will still have a reduced field of view, and it’ll reduce at night, too, but here’s a screenshot and a gif of wandering outside in the daytime:


URR fov

Next Week

Well, the IRDC is in a week’s time, and I’m crunching like mad to get some kind of NPC pathfinding/crowd mechanic simulation going there. It’s going reasonably well, and I think I’ll have something good to show off, but I’ve been running into some fundamental design questions – can NPCs push past each other, for instance, if one occupies a tile the other wants to get past – which have surprisingly far-reaching algorithmic implications for how pathfinding and gameplay will actually play out in the longer run.

Procedural Clothing Generation (Part 2 of ?)

This week I’ve finished off procedural clothing generation for the richest individuals in feudal nations. The game can now create upper-body garments, lower-body garments, and boots, for each civilization. These different garments across a given civilization maintain a consistency of colours, a general consistency of size/aesthetic, and a consistency of whether the patterns etched into the clothing are circles, octagons, squares etc, based on the visual preference of the nation in question. Thus far these are only the “upper-class” clothing variations, but I think one can reasonably extrapolate how the others will look (which will come in a few weeks, I expect). Here’s a summary of the three layers of clothing currently implemented – I’m also going to add gloves and cloaks this release, but haven’t got around to them yet (since they’re hardly a priority compared to implementing crowd mechanics before the UK IRDC in a fortnight’s time!), but they’ll probably reflect the coats of arms of important houses if upper-class cloaks, and then just have some appropriate patterns on for middle-class, and nothing special for lower-class. Anyway, onto the clothing of our procedurally-generated aristocrats:

Upper-Body Garments

There are currently seven “archetypes” for upper-body clothing, an example from each being shown below. I’m working on an eighth archetype but it is proving extremely challenging to make it look anything other than awful, so that one might not see the light of day. Regardless, each of these has three sub-archetypes, making for twenty-one high-level “clothing styles” at present, each of which then undergoes extensive randomness within that clothing style, meaning that even if the maximum number of feudal nations are present, there will still be several “unused” high-level clothing styles left over – so that’ll do for now.


Lower-Body Garments

It is very challenging to make “trousers” which look even vaguely as interesting as upper-body garments (or boots or gloves, for that matter!), but I’ve done my best. The “Japanese” and what I have taken to calling “Hebrewlonian” archetypes in the above picture (middle top, and third bottom) will count as both upper- and lower-body garments, whilst the lower-body garments shown here will be distributed to the rest of  the clothing styles. Although in many nations there will be little sexual dimorphism (so to speak) between clothing styles for men and women, this will not be the case in some cultures, and a “dress” clothing archetype has yet to be worked on (I’ll get to it in the next few weeks). So some nations have the J/H archetypes above for both sexes; some nations will have the other above clothing for both sexes; some will have different clothing for the two sexes (and this will all, obviously, be chosen procedurally). So, some trousers/skirts etc (skirts are especially hard to make interesting, but I’ve done my best):



Now onto the “paired” items of clothing – boots (and gloves). I decided for the time being to forego “shoes” and go with something of a Game of Thrones/TV-adaptation-of-Wolf-Hall logic, i.e. that even those at the very top of society have to give something towards practicality and pragmatism, and basically wear extremely nice boots, rather than wearing beautiful footwear which never comes anywhere near a bit of mud. Boots, like gloves, have a distinct item for each in a pair, so that we can handle things like losing limbs, damaged limbs, etc, later in the game. Gloves and boots use the same colour system – they take the established colours from the clothing above, and then blend it 70% into a generic “leather” colour, to give the impression of dyed leather. Boots are therefore deliberately a tad less “striking” in colour than other items, but still maintain a strong semblance of the same colour schemes. Remember, as always, that you’ll never see these next to each other in game!



Gloves are coming soon… but possibly not before the end of June, since now that I have the three most essential items of clothing in place, I’m working solely on NPC mechanics in preparation for showing off an interim “0.8”-ish building at the UK IRDC at the end of the month.

Complete Generated Clothing Sets:

Here are some complete (aside from gloves) “sets” of clothing – note, of course, that the zoom level does vary across each item of clothing so that the player can see maximum detail, and you’ll obviously never see them all in-game “lined up” like this, but I think it’s quite nice to look at some of the aesthetic consistencies across different items of clothing belonging to the aristocratic echelons of a given civilization:

Clothes 1

Clothes 2

Clothes 3

Clothes 4

(Note that Set 4 contains no lower-body garment since the robe covers both the upper- and lower-body slots, and also in some of these examples, the underlying pattern – square, diamond, etc – varies, which it won’t in the actual game.)

I will be working on middle-class and lower-class/slum clothing soon, but that’s taking a back-seat now to work on some mechanics for the version I want to be able to show off at the UK IRDC. There will also, of course, be distinct clothing styles for nomadic civilizations and tribal civilizations, but those are going to come along later, although I do have some ideas for what types of generators I’m going to build for both of those.

Future Mechanics

Clothing generation is increasingly pointing towards an obvious but potentially very interesting and unusual mechanic: the ability to “fake” being a member of a given culture. Perhaps you can don clothes of other cultures (and perhaps lighten/darken your skin, as many real-world explorers and “adventurers” in the distant past did for exactly this reason?) and attempt to “pass yourself off” as a native in a distant land… which then yields potential gameplay around attempting to maintain the deception, say appropriate things in conversation, and give nothing away, whilst perhaps other NPCs are capable of noticing slightly unusual things about your character which suggest to them that all is not as it seems? I think this could be some really interesting territory to explore in the future…

What next?

Well, we now have heads, upper-body and lower-body clothing, and boots, so I’d say we’re about to ready to actually create URR’s NPCs. This week I’m going to be working on optimizing the field-of-view algorithm which needs some serious improvement for the next release, creating the new “character lookup” window which has room to include a face and to scroll through their clothing (and in 0.9 their armour and weaponry, if any), and continuing to work on crowd mechanics, spawning/de-spawning NPCs, etc. See you next time for an update on hopefully all of these things!