A roguelike game inspired by the literature of Jorge Borges, Umberto Eco & Neal Stephenson, and the games Europa Universalis and Dark Souls. URR aims to explore several philosophical and sociological issues that both arose during the sixteenth and seventeenth century (when the game is approximately set), and in the present day, whilst almost being a deep, complex and highly challenging roguelike. It explores questions of philosophical idealism, cryptography, linguistics and the writing and formation of the historical record, and will challenge players to hopefully think in ways and about themes that are rarely touched upon by games.

Post news Report RSS Important NPCs V

More work on important NPCs (giving them homes, matching them no matter where in the map they are, etc), and major new variation in tows, ad other stuff!

Posted by on

This is now the fifth post in a row about handling the game’s important NPCs who need to be tracked in the abstract even when the player is nowhere nearby, and need to spawn when the player is nearby, and need to move appropriately when the player leaves map grids, enters them, and does anything else. In the last week I’ve coded it so that the game will correctly match up physically-spawned NPCs with their abstract “copies”, making sure that the right NPCs spawn in the right places; towns in nations with the “isolationist” policy now spawn with town walls, whichI think are *really* excellent and I’m very pleased with how they turned out; towns in internationalist nations also now reflect this preference; I’ve enabled the game’s ability to distribute important NPC information to a small number of a larger group of NPCs (if you read on it’ll be apparent what this means); NPC homes are now identified specifically when the player generates the map grid they live on and I’ve ensured that all abstract schedules now work correctly. In all honesty this is more of an “important NPCs and other stuff” update, but nevertheless there has been enough NPC progress to merit continuing the title. So: read on!

Matching Up NPCs

Now when any important NPC spawns, the game correctly matches them up with their abstract version. In some cases this can be slightly more complex than usual – for instance when spawning a priest in a map grid with a whole bunch of priests, it needs to spawn the right priest, or when spawning a merchant in a market district it needs to correctly choose the merchant who sells the particular type of goods in question (who will be stored in the game’s abstract information, so that they can be referenced at any point even if they haven’t yet been spawned). I know I’ve mentioned this several times in past entries, but I think this time it is *actually* full implemented, at last. There are some classes of NPC who do not yet spawn physically and therefore cannot yet be matched up to their abstract counterparts – for instance lords of towns in vassalage nations, or delegates for parliamentary nations (since I haven’t yet worked out where the heck they live!), but the system can be easily expanded to those when the time comes.

Town Walls and Diasporic Communities

In keeping with my plans to ensure that all ideologies have actual physical effects (akin, this is a blog post in its own right, which will probably appear in the next few weeks) I’ve added in the code for placing walls around the towns which exist in isolationist nations. Depending on the aesthetic preference of each nation – the standard square, circle, octagon, diamond, cross I’m going with at the moment – town walls generate according to a slightly different algorithm, and look quite different once constructed. Here are illustrative examples for each shape (square, diamond, octagon, cross, circle). At some point these will likely gain guards at the gates at the outside, either to check who turns up, or perhaps to charge those wishing to enter depending on economic policies…

User Posted Image

Additionally, “Internationalist” civs have the reverse of this, and all of their towns contain what I’m calling diasporic communities. When such a town spawns the game will look for the nearest nation to that town’s nation which the nation actually has diplomatic ties with (so no nations they’re hostile with, and no tribal nations) and will then spawn a few of the houses (and some of the crowd) from that nation instead. Here’s an example of a town which had a community from another feudal nation, but sometimes they might even have a nomadic community living there, which would merit a different brick tile as well as brick colour:

User Posted Image


User Posted Image


(You’ll see some new shapes and things in the latter picture, which are the new “Barracks” and “Military Base” structures for various ideologies, with (of course) an appropriate shape for the nation in question). I am of course fully aware that this two-colour system is not how these things would look in the real world, but again, recognition/visuals/gameplay > realism in this case, since I want it to be very visually apparent that you’re living in a more varied town than normal. As above, all of this is part of the background objective of this release, which is making the world’s nations even more varied by completely reworking the ideology system. More on this later!

Prisoners, Farmers, Monks, and so forth

There is a particular category of NPCs where you have a number of the same kind of NPC in a grid, but only some of them are “important” and therefore need to be tracked. As I’ve mentioned in a previous entry, a jail might have 80 prisoners, but only 3 of them might be particularly important. The game can now distribute the importance to a random three prisoners, whilst also storing the remaining 77 so that the player cannot leave, return, see which prisoners have “respawned” and thereby deduce which matter and which do not.

User Posted Image

All Abstract Schedules Work

This is a small but crucial point – I’ve now confirmed that all abstract schedules work correctly for all important NPCs, and that when the game starts (now fixed to exactly midday on Jan 1st, 1700) they all start off doing the correct job they should be doing. Whether an NPC moves from tile to tile, or always stays within the same map tile, and whether they are exchanging guard duties, tending to vegetable gardens in monasteries, ruling a nation or shopkeeping, all schedules now (as far as I can tell, and with 2000+ important NPCs per world gen, this is tricky) seem to work perfectly. I haven’t had a crash in a long time, and I can look at the important NPCs sitting on any map grid and they all always appear to be doing the correct thing. It is of course possible there’s a bug hidden in here somewhere, but I’m actually feeling very confident about it now. This is a major step towards next week’s objectives (see below) and it feels really good to have it all functioning correctly. I’ve also worked hard on optimizing the time it takes for abstract NPCs to take their moves, particularly when the player is fast-travelling, though this inevitably takes a bit of time; but since the laptop I program on is ancient and garbage, and players won’t be fast-travelling during gameplay anywhere near as often as I’m doing it in testing, I think a tiny pause per step is acceptable (though I will still continue to improve it).

Home Doors

Now, when the player generates any map grid, the game looks over all the important NPCs stored by the game, notes those which have their homex/homey variables on this map tile, then looks over what kind of door they should be living behind – a standard house, a castle, a church, and so forth – and then finds an appropriate door on that map grid and makes that their home door. For buildings with multiple doors (cathedrals etc) it stores all doors in a list of “home doors” rather than just the one. For some NPC types this hasn’t yet been completely handled – inquisitors, sailors and explorers will probably lack any home tile, I’m not yet sure where exactly certain NPCs will spawn and act (e.g. blacksmiths), and so on – but the overwhelming majority now get a set of door tiles attached to them. This also means that once such doors have been assigned, random crowd NPCs will never go through that door. Again, we continue to build towards next week’s objective (see below) of getting all the important NPCs to always act correctly “in person”, as well as in the “abstract”.

Next Week

My plans for the coming week are to begin work on the most challenging part of all: getting spawned NPCs (i.e. those the player can physically see on their map tile) to act according to their abstract behaviours and schedules. This is a huge one, and it will likely take more than a week for the entire thing, but I hope to have significant progress to show in seven days. I’m also probably going to slowly continue work on things like castles and ideologies in the background, and continuing to add to town variation (I need to get manors spawning for “vassalage” nations, and military bases for “standing army” nations, for example), but ensuring identical behaviour for spawned/unspawned NPCs is the core goal for the next couple of weeks. See you then!

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: