First, sorry about the late update this week! I had a ton I wanted to get finished for this update, and I came close, but needed some of an extra evening to actually get it all done, hence the late Monday post (next week we’ll be back to the usual weekend stuff). This week we have a fairly major update again – more work on scheduling, pathfinding, and so forth – and a bunch of minor updates on various things that needed finishing or improving before 0.8’s release. Scheduling and pathfinding for important NPCs is coming along well, but is still not finished, owing only to the immense difficulty of the task (pretty much all my spare time is currently going into this) – but I’ve pushed well past the 50% mark now, probably to around 75%, and with a really concerted push this week we should be almost completely finished by next week’s blog post. So: this entry is going to update you all on that big task, alongside a bunch of other smaller things…
…but first…
Fancy coming to work with me for 9 weeks?
Are you a student? Fancy coming to work with me on procedural generation for a few months? Now’s your chance! We’re looking for two people to come and join myself and Dr Sam Devlin(
https://www-users.cs.york.ac.uk/~devlin/) and Dr Gareth Beale(
https://www.york.ac.uk/digital-heritage/members/gbeale/#research) on a nine-week project for the “YCCSA Summer School”(
http://www.york.ac.uk/yccsa/activities/summerschool/) to examine methods for setting rules and subsequently generating a particular category of building – those that have strict and explicit social rules to their layouts and their use by different categories of human actors. For example, this could include religious buildings, hospitals, police stations, prisons, airports, military bases, etc. The exact direction of the project can be altered to fit the right candidate, but that’s the basic outline now – generating architectures of buildings with clear social, not just architectural, requirements to their physical layouts. YCCSA is the York Centre for Complex Systems Analysis, and is a highly multidisciplinary research group that the three of us are all currently a part of.
As above, you must currently be a student, though you can be from any field and any country. We’re looking ideally(
http://www.york.ac.uk/media/yccsa/documents/summerschool/2016/Algorithmic%20Generation%20of%20Social%20Architecture.pdf) for one computer scientist and one artist (2D or 3D are both fine), but that’s open to change if particularly good candidates from other backgrounds apply. You’ll be housed at the University of York in the UK for the nine weeks during which this should be your full-time occupation/work, and we’ll (i.e. you, me, Sam, Gareth, and the other person) meet up at least once a week to discuss the project. We may well collectively get a paper or conference submission out of the project at its conclusion, which would look extremely strong on any undergraduate CV if you plan to pursue further study. If you’re interested, feel free to ask some questions here, send me a message, etc, or pass this on to your friends if you aren’t eligible but you know someone who is. The competition is usually pretty fierce for the positions, though, so you’ll definitely need a strong CV to be successful. Deadline for submissions is March 17; hopefully we’ll get some applications from some roguelikers and produce something innovative and interesting! If for some reason you aren’t an undergraduate student this year but will be next year, I would expect similar opportunities to arise in 2017 and 2018 too, which I’ll announce as and when…
Now, onto the URRpdate proper:
Scheduling
I’d say I’m… 75% finished on AI scheduling and pathfinding for important NPCs? As far as I can tell, we’re now at the stage where:
All important NPCs spawn correctly in their houses and can be seen sleeping/behaving within those houses.
All important NPCs whose day jobs are OUTSIDE buildings – e.g. guards who guard outside a building, or gladiators, or merchants in open-air markets, and so forth – all now have perfectly working schedules and find their way to their jobs, irrespective of where the player is, what the player’s doing, etc.
What this means is that one can follow an NPC from sleeping in their bed all the way to walking half-way across the map, through exchanging their guard post with another guard, and then track that guard all the way back to their home in another district, and watch them go to bed. Although this might not seen all that tricky to code, the complexity emerges when one considers that due to the size and scale of the world map, it is of course chunked. Only the map grid the player is currently in is loaded, whilst the rest of the world is stored elsewhere in your save files. The same also applies to buildings, which are only actually generated when the player first steps inside, again to save on generation time and memory usage.
What this means is that there are many, many variations of scenario that can apply to something as seemingly simple as just having an NPC move across a map:
Their house has been spawned.
Their house hasn’t been spawned.
Their home district has been spawned.
Their home district hasn’t been spawned.
Each district between their home and their work has been spawned.
Each district between their home and their work hasn’t been spawned.
Their work district has been spawned.
Their work district hasn’t been spawned.
The player is in their home district.
The player is in a middle district between home and work.
The player is in their work district.
The player moves between districts whilst the NPC is moving, thereby spawning and despawning areas of the map whilst the NPC is trying to move through those areas!
Therefore, the NPC might enter unspawned areas, enter spawned areas, leave unspawned areas, leave spawned areas, and must have their schedule consistent as they move between these different areas, whilst always making sure that if the player “looks in” on them at any time in their schedule, they are doing the right thing, just as the player might enter/leave spawned/unspawned areas with NPCs going about their thing.
This has necessitated four major systems – we have a list of “potential NPCs” who have yet to be spawned and who have thus far moved entirely in the abstract, a list of “abstract NPCs” who HAVE been spawned but have since been de-spawned due to the player moving away from the map grid they’re in, active “creatures” on the map grid the player is currently on, and abstract “building” creatures for creatures who have been spawned, but are now in a building, but the BUILDING hasn’t been spawned. All NPCs are thereby shuffled between each of these four categories, each of which can be accessed or acted upon in various ways according to the player’s location and the status(es) of the NPCs within them. This is by far the least complex system I was able to come up with for handling all of this, and it’s actually coming together now! You can track people all across different districts irrespective of your movement and their movement, and they always turn up in the right places at the right times. The remaining AI stuff is all to do with handling NPCs whose schedules take them indoors (for their work, not their homes), of whom monks are going to be the most challenging, though I don’t anticipate TOO much difficulty for the others…
Clothing Implementation
Clothing has now been transferred out of my graphics-testing python file and implemented into the game proper. Everyone in nomadic and tribal nations now therefore wears all the appropriate clothing, which like all other clothing can be examined. This means all four major clothing types for this release – feudal, religious, nomadic, tribal – have been implemented, at all ranks from the lowest peasant to the highest ruler, leaving only armour to be generated in a later release (probably the next release, 0.9).
Counties
Vassalage nations now split their land up into counties, or regions, or districts, or duchies, or whatever the nation calls them. Each is roughly centered upon a town, and therefore “owned” by the lord, count, viscount, duke, or whatever the nation calls them, that controls that town (and thus mansions spawn in those towns to house these important people, and town halls do not generate as these nations would not have mayors for their towns). I’ll be doing a little more with this system later, but for the time being, here are some example maps of the vassalage-y nations and the counties they created (shown by arbitary colour differences, though when you view them in-game, you get colours of the house in question that rules the area). I’m happy with the kind of size these regions are, and it’ll add another nice bit of variation to a couple of nations each time. There are still a couple of minor peculiar bugs to work out here, but it should be resolved soon:
Castle Basements
Castle basements have now been finished as well, and can contain slave quarters, and a torture chamber or dungeon, and potentially… other stuff as well? They often have two parts and two down stairs, if for example the nation keeps slaves and there is a dungeon or torture chamber, as those would be accessed from separate staircases (though I just need to make a mental note to ensure that the AI can figure that out!). Here is an example, going from the slave quarters, back into the main body of the castle, and then down the other staircase into the dungeon (which is much nicer than jails, since these dungeons are for important prisoners). Upper floors are being changed a little, but I should be able to show them off next week.
Jail Bedrooms
Jailers now have bedrooms which are underneath the jail, rather than having them sometimes leave and return and so forth. This was a slightly strange solution, but I decided it was a solution I was happiest with rather than having jailers leave and return in the morning (leaving prisoners alone would seem strange) or having jailers who take many shifts (I didn’t like this and wanted to emphasize that jails *belonged* to the jailers on some level), so there is now only one jailer who sleeps in a “secure” chamber below the jail. These bedrooms are minimalist and simple so they aren’t really worth showing, but suffice to say that that’s where they now appear.
Harems
Although the appropriate NPCs will not actually exist in this release – they join a list of NPCs like inquisitors and explorers who will be added in 0.9 – there is now space in castles and mansions for the rulers/lords to have a harem, of either sex/both sexes (depending on cultural practices, accepted norms, and the orientation/age of the ruler). Harems contain reclining couches, which are a new form of furniture I very quickly set up a really cool generation algorithm for, and I really like how these look. Right now these couches only appear in these areas, although I might change that in the future. The couches themselves are, of course, both coloured and patterned according to the family whose mansion you find them in, or the ruling house if they’re found in a castle, so here are some examples of reclining couches with the coat of arms that would have them next to them, whilst the shapes emblazoned on them are dependent on the civilization to which they belong, in this case three “lesser” houses in a vassalage nation and one major house:
What next?
This week I’m still working on scheduling/pathfinding, and will be focusing on getting all the scheduling around castles working, and then moving onto those who need to schedule their way into, and around, buildings, and then those who spend their entire schedule within certain buildings (such as certain categories of priests). If the progress on scheduling seems slow, please let me assure you it isn’t, and basically 100% of my spare time is on URR development at the moment – it’s just a huge, complex, and challenging task. But I’m definitely well past half-way and I can see how it’s all going to (finally) come together, even if there’s still quite a bit of ground to cover. See you in seven days!