Important NPCs Part IV

Lots of further work on important NPCs (this “Important NPCs” series of blog posts is probably going to hit at least eight or so in total). The major developments this week: the game now assigns nearby home districts to each important NPC, and in turn an actual house when their district is actually spawned; the game now adds in naval trade routes and creates a range of maps for optimizing NPC pathfinding around the world; and NPCs now move around the world map and take an appropriate length of time to make moves! Read on:

Homes are Assigned

Homes are now assigned to all important NPCs, and each NPC has a “work” location and a “home” location (although special events, like a gladiator being pulled away from their training to fight in any one of many possible arenas, will add another “work” location). In some cases these are the same districts – so the guards who guard castles are also guards who live within castles, and their work and home districts are the same, and the same goes for every guard in a one-tile fortress, town, etc – whereas other guards will live elsewhere. There are no homes in a city centre, but the guards who guard the mints or parliaments have to live somewhere, and so they now live in other districts, where the district depends on the NPC (so the guards of mansions are better-off and live in middle-class districts, whilst the guards of arenas will live in lower-class districts, and so forth). When the player then enters a district with homes in for the first time, the game will look over which important NPCs are housed in that district, and will assign actual doors and houses to those NPCs, and ensure that random NPCs in crowds will never enter these houses. Here’s a little output noting which guard in a pairing each guard is (“first guard” or “second guard”, their form of guarding, where they begin the game (whether on duty, or not on duty), and then where they work and where they live; and you’ll notice a range of living districts for the mint guards.


Ocean Trade Routes

The game now generates ocean trade routes. All settlements except hunter-gatherer encampments which “touch” the coast now count as being a “dock” (even if these do not physically spawn yet, but will soon), and the game now has an algorithm for attempting to piece them together in a reasonably interesting, efficient, and wide-reaching way. The player will be able to jump onto these shipping routes, as will important NPCs who need to travel very long-distance (which will be rare, and mostly for mercenaries, soldiers, ambassadors, diplomats, plotters in various schemes, explorers, inquisitors, preachers, etc). I’m very happy with the kinds of shipping patterns this produces, and is something I’ve been meaning to add for a while, since it connects up parts of the map not ordinarily connected and thereby allows important NPCs to potentially travel to places they couldn’t travel to before (more on this below). These routes will show up on the world map once you find them, and when you consider boarding a ship in 0.9 (probably) onwards, you’ll be told where that lane stops, how long it will take you to each location, how safe from pirates etc each part of the route is, and so forth.


Road and Off-Road Pathfinding

When an NPC is looking for a path between settlements, the NPCs consider two possible routes – one using any tile they’re able to use, whether something fast like a road or something slow like an ordinary piece of terrain, and another using only “special” forms of travel, meaning roads, naval trade routes, and (in the future) desert caravans and mountain passes. Whichever one is faster (and safer) will be the one the NPC selects. So in this first picture, we see the terrain of a given world. In the second picture we see “all valid tiles”, and we can see that oceans are excluded aside from shipping routes, deserts are entirely excluded (since caravans do not yet exist), mountains are excluded (since mountain passes do not yet exist) and rivers are excluded, except on tiles where a road crosses them. In the third picture we see the final map which only uses roads and shipping routes, which might take longer paths to a given location but each particular tile will be faster – and so the game will check them both whenever an NPC wants to move. I debated going even further and weighting every single tile and using some kind of A* with Bounded Costs system, but a) that would be a surprising nightmare, b) it’s very CPU-intensive and this multi-settlement pathfinding has to be done effectively instantly, and c) I actually think this can have gameplay value: if you are told Person X is travelling to Y, you can be told if they’re travelling by road, or not, and can try to catch up with them that way, rather than knowing they’re going by the absolute optimal route, which might be very challenging for a human player to deduce.




A final interesting note: we can see in both of these pictures that the area in the northwest is cut off from the rest of the world. That area happens to have no towns which are on the coast and therefore have docks, and same goes for cities, and it is separated from the rest of the world by mountains and desert, and cannot therefore be accessed by land (unless the player is willing to move through desert or mountains without caravans/passes, which will cause each turn to take many many times longer than normal; NPCs will not have this option). Therefore a future (but probably quite simple) system will be required to floodfill the world and to ensure that every settlement, no matter how obscure and hard to reach, can always be reached via land, road, shipping route, caravan route, or mountain pass, or some combination – something this particular generation doesn’t achieve.

NPCs Moving Around the World Map

Although this is all snazzy and important, the most important thing by far is that all important NPCs now move around the map on their standard schedules. They will not yet appear and spawn if the player enters the same tile, and they are not yet able to be given one-off tasks (“Come together in Parliament for a vote”, “Go to this arena for a fight”, “Present your latest artistic work in front of the King”, etc), but they all correctly make their way around cities and towns, they perform their actions at the right times, they get up and go to sleep, change watches if they’re guards, tend to vegetable gardens if they’re monks, and so on and so on. Now, naturally making sure that the player can physically see this happening is the next step – and a big one – but at any moment in time I can now check what every single important NPC across the world is doing, or in the process of doing, and when they’re going to stop doing that and start doing something else. There isn’t really a nice picture I can put up for this, but it’s happening, and that’s crucial and very exciting.

Next Week?!

The next two weekends are both free for me to focus entirely on coding (as well as ongoing evenings etc), so I’m hoping for a lot of progress. For next week I’ll be continuing to inch forwards on castle generation, hoping to get guards once more changing over their patrol timings with each other, and start to get all the important NPCs spawning when the player steps onto those tiles and being tracked whether abstract or spawned. That’s quite a lot, so we’ll see how it plays out, but I’m very pleased with my speed of development at the moment, particularly considering how many other professional (and personal) commitments I have at the moment. See you next week!

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…

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.

Military Districts

Until today three districts remained without generators: docks, military districts, and city centers. I knew how I wanted the centers to generate but hadn’t worked on them yet, whilst docks I’m leaving until I actually implement ships and naval travel, but military districts needed to be done this releae and were proving very challenging. I didn’t just want to have huge regions of endless barracks – I wanted something much more varied – but at the same time I wanted to try to only add things that would have gameplay valuable if/when you gained access to a military district. I’ve settled on a middle-ground between the two – some areas are just for decorative purposes and to make the world feel consistent, coherent and real (akin to farms, for example), whilst other parts have clear gameplay goals, will contain important NPCs, etc.

So, military districts (like upper-class housing districts) are split into four parts. Each of these has a number of features which slot together in a fairly complex manner, and in a range of different orientations. These can be: Barracks, Parade Grounds, Archery Ranges, Siege Weapons, Armouries, Officer Quarters, Hospitals, and Stables. These combine in a range of different permutations to produce military districts. Each military district is also guaranteed to include two special combat NPCs – these may be able to raise a stat, or train you to use some of the more complex moves for a weapon. More on this in a few versions time when we’re doing weapons and combat. Here’s a labelled example:


Archery Ranges and Siege Weapons are self-explanatory, and (currently) for decoration only (you can’t raise stats by using the ranges or anything like that). All the others, however, will have gameplay use. Barracks contain troops, their beds, possessions, etc, and therefore may contain important NPCs. Parade Grounds are self-explanatory, and once we have NPCs in two versions time, you may be able to see soldiers marching around there in times of peace, or actively drilling in times of war (not sure how much variation it’s worth thinking about here). Armouries are most certainly not decoration and will contain huge numbers of weapons if you can gain access to them, but will be well-guarded. Officer Quarters will contain high-ranking military officials, and possibly some expensive items too. Hospitals will contain a range of healing items and those able/willing to heal you for a price (or if you are a close ally of the civilization), and Stables, funnily enough, will contain lots of horses (though I am still working out how exactly riding is going to integrate with the rest of the game). There will also presumably be patrols moving around the outside ring road of the district in the future.

I tried hard to make each building recognizable by shape, which is something I’ve already been putting a lot of emphasis on with the different kinds of special building that spawn in housing districts (banks, theaters, arenas, etc). In this case stables are all right-angled shapes, barracks are a 9×7 grid, hospitals are more uneven, organic-looking lines and branches of building, officers quarters are a loop than encloses an area within it (or sometimes two areas), armouries are either octagonal or a number of octagons with a large gate at the front, while catapults and archery targets have distinct characters by which they can be recognized. The circular buildings – there is one in the top-left near the central fort, and one within a loop of road in the bottom-right – are the buildings that house training NPCs.

However, military districts have two restrictions on your entry – they are expensive to enter, and you must be very friendly with the civilization in order to gain access (or be playing as the player class which allows you to try sneaking into districts, though I am still figuring out the exact mechanics there). Starting in a civilization with a military district will therefore be a significant early-game boost, though I will try to balance this by giving significant value to non-militaristic civilizations too. I’m currently working on the lookup images for these new items. We already have archery targets:


And I’ll get siege weapons done soon enough. Along with city centers and upper-class housing districts, I want entering military districts to be a significant investment that makes you think about whether it’s worth it for what you may find inside. However, these – along with markets – will be arguably the most valuable districts to explore, although market districts are deliberately free to enter. If you’re low on money you can always check out a market district (assuming you can get to it within the city), but you’ll have to think harder about entering those other districts. So, all that remains to be done here is siege weapon lookup images which I’ll probably draw this week, and then as everything else we need some appropriate door graphics, but otherwise they’re done for this release. Once I’ve got them finished off I’ll be working on city centers, at long last. I’m anticipating a 0.6 release somewhere around mid November, which is also when I hope to finally start my full-time development year. In the real world I’m currently house-hunting (at last!) and hoping to move at the start of November, and once I am settled in the new place, that’s when the full-time year starts. Updates as and when…

Glorious October Cities

I’ve spent most of this week URRing, which has been a nice break (I’m waiting on a lot of PhD feedback from my supervisors, so rather than twiddle my thumbs, it made sense to get some coding done). Hoping to start full-time year at the end of this month, or possibly the very start of next month, depending on how fast I’m able to move house. In the mean time I’ve been working partly this week on finishing off religions for this next release, but mostly on cities. As a whole I’m past the 3/4 mark on 0.6 (after which no release will ever be this large) and there isn’t that much which needs finishing off. The largest part of what still needs doing is city centre generation and military district generation which I haven’t even touched yet, and then a large number of smaller things – improving market generation, finishing off hunter-gatherer settlements, a few issues with world/map generation, etc. Docks are going to be closed this release since they require integration with a number of other factors – the movement of ships, ships docking (so handling multi-tile “creatures”), departure/trading schedules, etc – so they will appear probably in 0.9, as I don’t want to code part of them, leave it for half a year, and then come back and have to figure out how the hell it all works. Anyway, this week’s stuff:

Firstly, I added a lot of variation to religions based on the discussions in the previous blog post. Religions now have four special factors, and some religions will have none, one, or all four of these factors. These are a unique feature (festival, pilgrimage, animal sacrifice, etc), an exclusion (a particular type of weapon they consider heretical and cannot be used if you worship them), the punishment for leaving that religion (none, excommunication, open hostility), and then a list of other religions, if any, that they consider heretical, and whose believers they are hostile to. Here’s an example from the in-game encyclopedia:


Aside from that, the major thing I’ve worked on this week is the city exploration screen. If you’re on the world map and you move into a city, the screen changes from this:


…into this:


…which is quite a complex screen when you first see it, but there’s a lot of information that needs to be stuffed in there without compromising on clarity (as much as possible). It displays the nature of each district (the characters in the corners, [, $, 1, etc), whether you are currently in it (displayed by a lighter shading, the @ symbol, and the arrows on the edge of the screen), and most importantly, the cost for entering that district. This is the first aspect of the strategy layer of the game and the use of the player’s time and resources. The cost is shown in this picture in the nation’s currency – some nations only have a single currency, whilst others have two levels of currency like most real-world coinages. The “this city is not populated” message will only be there until coinage and NPCs are implemented, of course, but I thought it was important to be clear for 0.6 on this point.


The sidebar display a load of information about the city. The top text will describe your relationship with that nation, and therefore whether you are given discounts or charged extra for movement, and below that how much of the appropriate currency you have. Movement within your capital is totally free, however, as is any nation you are closely allied with. Then it tells you what district you’re in, and lists all the buildings you know of within that district. All districts within your home city will start explored, whilst you will be able to purchase maps to other cities, or ask for directions to specific buildings when exploring abroad. For the next release or two currencies are not implemented so your movement will be free, but in either 0.8 or 0.9 currencies, and currency exchanges, will appear. I’m looking forward to generating the images for the currencies too, as there’s a very cool selection of possible coins in there.

Other stuff:

– All castles, graveyards, crypts (below either graveyards or cathedrals in theocratic nations), taverns, arenas, jails, theatres and asylums now have full (and pretty awesome) name generators. Fancy visiting Blackwish Bastion, Whispering Orchard Necropolis, the Sepulcher of the Golden Bones, the Tankard and Dragon, Boneblade Fighting Pit, Slate Palisade Lockup, the Theatre of the Choleric Faces, or the Tranquil Gate Sanitarium?

– Some cities which don’t have enough roads going into them now gain extra gates so that you can always access them from various directions, and these are shown on the world map.

– Player stats have been updated to reflect the upcoming combat mechanics – you now possess strength, dexterity, endurance, perception, finesse, and marksmanship, two of which will determine your skill with each of the six types of weapon (slashing, long, heavy, short, bows/crossbows, and gunpowder).

– Marshland is fully implemented and hunter-gatherer settlements, towns and city districts all generate correctly on them, allowing for pools of marsh water without jeopardizing pathfinding.

– An early draft of religion-spread mechanics has been implemented; any civ that believes in “Religious Freedom” as their policy will have the religions from all neighbouring civilizations reflected, including those they neighbour with a colony, rather than their main body of land. This then determines which buildings spawn in religious districts, and they are described in the city view screen appropriately – “a Stupa of the Six of the Leaves”, “a Church of Her of the Mountain”, “a Chapel of The Thousand Divines”, etc etc.

– I fixed a bug causing towns to generate large circles of road in the middle of the ocean.