A couple things before we get started this week. You can now watch my talk from the UK IRDC 2015 on URR’s general generation systems. Check them out! Also, I’ll be at this year’s ProcJam opening talks (though not speaking this time) down in London, so you should all come and say hello, both to me and other excellent PCG folk speaking. Hopefully see you there! And if not, I recommend taking part in ProcJam – a lot of awesome stuff came out of it last year and I’m sure the same will be the case this year. Also, as mentioned previously, I’ve now started a job as a three-year research fellow; currently I’m therefore working on URR at weekends and in the evenings. Progress is speeding up again now, but it’ll inevitably be a little slower than it had been pre-move. As such, I’m now seriously once more considering releasing NPCs without the conversation mechanics as 0.8… but I might not. Basically, I’m going to finish NPCs, and then take stock; but that possibility is still on the table. I don’t want people waiting ages, and I do obviously want the NPCs to be tested, but at the same time I promised gameplay and the conversation system is going to be in-depth and exciting, so I want to offer that, even if that means a longer time between releases. We’ll see.
Now, onto this week’s update, where I am pleased to report that development has now resumed after around a fortnight of moving house and starting-new-job admin, and we have some initial progress in the handling of the game’s important NPCs. So, read on…
Placing and Counting NPCs
When a world is generated there is now a block of code which looks over each tile, examines what is in the tile and the ideologies of its owning nation, religion, and all this kind of data, and comes to a conclusion about how many guards there should be, what kinds of guards these are (Mansion, Parliament, Castle, etc), where they should rest (in that same tile, as in a Fortress, or in another city district), and so forth. It does the same for all other important NPCs, and then counts up the total. Here’s a map I had the game print out where each tile was coloured according to how many important NPCs it had. A black/grey tile had none, and then the colours/numbers went through the rainbow to denote numbers of guards from 1 to 10 – dark red, red, red/orange, orange, orange/yellow, yellow, yellow/green, green, light blue, mid blue. If there are 10 or more, it uses a ‘+’ symbol. One can see roughly where all the major cities are, and get some impression of where fortresses are, and for the time being nothing spawns in towns which would “merit” a guard (though this will probably change) and so those don’t show up (same goes for tribal encampments, though I might add guards to certain buildings there in the future). I think it’s quite interesting to note how different cities have different textures of how important NPCs are laid out, depending on their ideologies and so forth. Note also that some of the fortresses have different numbers, again according to their layouts/ideologies. Anyway, here’s an example of this map:
And some zoomed-in examples of cities with very different “important NPC textures”, where in most cases the +s are indicative of things like city centers and upper-class districts and military districts, whilst the common 1/2/3/s tend to be lower-class districts where the national ideologies vary what spawns and doesn’t spawn there:
As for these important NPCs: they are stored in two areas – if it is an important NPC who will never ever leave the tile they are currently on, it saves them in the potential_npcs list on that map tile; if it is an important NPC who will be moving around the world, it saves them in the potential_npcs list in the world overall; this separation is to avoid a situation where even NPCs who never leave their map grid were in the global set of abstracted-out NPCs, there would be no point scheduling them and going over their routines/actions, since those can just be modeled when the player goes near. At this point it also (though this is not fully implemented yet) creates a bunch of tags for each important NPC. This might be something mundane and overt like “Guards the mansion of Family X”, or something covert like “Intends to murder NPC X in a plot with [list of other NPCs]”, or “Once met a mercenary who knew where [secret item X] was buried”, or whatever, which one might be able to discover. This brings us back to the previous discussion a while ago of secrets NPCs hold: a jail might have 50 prisoners, most of whom might be mundane, but a few will hold secrets which might be of use to you in some way.
Spawning Important Folks
Until the player goes near to any of the important NPCs, they remain “abstract”. They are able to act and gain connections by possessing the list of “npc_info” stuff listed above (who they plan to usurp, their other secret agendas, etc), and this also means that a spawned NPC can talk about an unspawned NPC without that NPC having to be spawned, which means that all the important NPC information is set up before the spawning of any of those NPCs. When the physical version is spawned because the player has stepped onto their map tile (or they are a roving important NPC and they have just moved into the player’s map tile), the game looks for the “npc_info” which describes an NPC of that sort and then tethers that npc_info to the physical copy of that NPC and deletes the abstract copy. That then doesn’t change the abilities of other NPCs to reference the important NPC, but it just means they now reference the physical copy rather than the abstract copy, but either way the game knows the information relevant to that NPC, and that NPC can move around the map (whether “physical” or “abstract”).
When I worked on guards in the past few weeks, I hadn’t fulled realized that guards were, basically, an “important” NPC, and therefore would actually need to be tracked to their homes and the rest of their schedules just like all the others. This means I’ve had to undo a little bit of the code I wrote before for tracking guard pairings and so forth, but this didn’t actually take as long as I’d feared. Guards now still spawn correctly and match up with their “abstract” selves, but no longer exchange their positions, as that requires me to transform some abstract guards into real ones at appropriate moments, and then get them matching up whether or not all, some, or none of them are spawned – the next step is therefore to get them (and everything else) performing according to their schedules, which is the objective for the coming week.
Important (and unimportant) NPCs remain permanently/temporarily spawned when they cross districts, so you can follow them; guards can exchange their patrols with one another at the correct times; TIME (regular) and SCHEDULE (unique) events work, or at least have begun to be implemented. See you then for more work on the important NPCs of URR!