• Register
Post news Report RSS Scheduling Progress, Clothing Implementation, Counties, Jails, Harems

Lots of AI and scheduling improvements, alongside a bunch of snazzy new graphics and generators.

Posted by on

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.

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:

  1. All important NPCs spawn correctly in their houses and can be seen sleeping/behaving within those houses.
  2. 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:

  1. Their house has been spawned.
  2. Their house hasn’t been spawned.
  3. Their home district has been spawned.
  4. Their home district hasn’t been spawned.
  5. Each district between their home and their work has been spawned.
  6. Each district between their home and their work hasn’t been spawned.
  7. Their work district has been spawned.
  8. Their work district hasn’t been spawned.
  9. The player is in their home district.
  10. The player is in a middle district between home and work.
  11. The player is in their work district.
  12. 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!
  13. 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).

Nomclothing

HGclothing

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:

Counties

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.

Under

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:

Couches3

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!

Post comment Comments
Hell_Diguner
Hell_Diguner - - 3,645 comments

Ever thought about adding one tile trapdoors down to oubliettes?

Reply Good karma Bad karma+1 vote
UltimaRatioRegum Author
UltimaRatioRegum - - 307 comments

There are going to be "secret doors" of some description, but trapdoors/ladders as well are not impossible! Those might not make it into this release, though, since I need to figure out how exactly they'll work.

Reply Good karma+1 vote
Omegakill
Omegakill - - 367 comments

Will there be variation in what NPC's do? For example, take the guard, will he just wake up in the morning, go to work for x hours then come home and sleep? Or will he go to the pub every Tuesday and Church every Sunday, or maybe on a random day he will be sick/ill or even rather than going to the pub on that Tuesday he decides to visit his brother in another town.

Regardless I'm looking forward to playing this.

Reply Good karma Bad karma+1 vote
UltimaRatioRegum Author
UltimaRatioRegum - - 307 comments

Hmm, interesting question. Quick answer is: yes, but not necessarily in this release. I'm giving everyone the most basic-but-comprehensive schedule possible in this release, but in 0.9 I definitely want to expand this into the kind of variety you've just described and get the schedules of NPCs varying according to appropriate/relevant factors.

Reply Good karma+1 vote
Post a comment

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