Scheduling Progress, Clothing Implementation, Counties, Jails, Harems

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 and Dr Gareth Beale on a nine-week project for the “YCCSA Summer School” 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.

Inside2

As above, you must currently be a student, though you can be from any field and any country. We’re looking ideally 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:

  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!

Be Sociable, Share!

8 thoughts on “Scheduling Progress, Clothing Implementation, Counties, Jails, Harems

  1. The colorful district maps look very good, as does the generated furniture. It will be interesting to see what else ends up lurking in those castle basements, too…

    • Good good – right now there are effectively three major room types that can spawn down there (slave quarters, dungeons, torture chambers), but there may well be the odd secret room down there too…

      (… once I figure out how I should implement secret doors!)

  2. > 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.

    Haha! At what point does the NPC freak out about a stranger being in their bedroom and following them around all day?

    • Ha, at the moment, not at all; in the future, probably… hmm, I really don’t know. I’ll have to think about how the keys system works once I actually implement them a little down the line, and then build upon that in terms of thinking about building permissions and the like.

  3. “Never waste the day” shield next to a reclining couch in a harem… that’s funny!

    I hope the summer students work goes well. That’s quite a great sounding opportunity!

    • Ha, I didn’t even spot that! Good call. I hope it will be! There are more projects than places, so there’s actually (sadly) no guarantee we’ll get students, but hopefully enough good people will apply for our project that we’ll be one of the winners 🙂

  4. Man that summer student opportunity is like a materialized dream for me.
    Sadly, I’ve just started a new part time job and there is no way they’d give me this much absent time right now.
    Is there a way to chip in to this project from afar?
    ———

    I like how you casually made those very nice looking couches.
    Thinking about it. Has the design of couches not changed, since always?
    I’ve just googled “medieval couch” and “ancient couch” and it honestly seems like it hasn’t that much.
    Some of them aren’t symmetrical and they’d fit the whole haremtheme a little better I think, though. You know those that you’d imagine when thinking of a greek/roman dude who is fed grapes.
    I’m bringing this up because especially the light green and the purple couches look pretty modern in my opinion. Could be because I’m just instantly associating some industrial fabric with the more “flashy” colors.

    (also noticed the motto “Never Waste The Day” right next to the couch exhibit. Nice.)

    Glad to hear you’re coming along nicely with the pathfinding (and mainly that you haven’t lost your spirit with it). I enjoy the more techy posts a lot and it’s very interesting to read up on your continuing thought process about this crazy conundrum of possibilities.

    As always thanks for writing these huge posts. Very nice weekend read and something I’m looking forward to, every time.

    Best,
    Frido

    • Hmm, probably not, I’m afraid – see my above comment for the inherent uncertainty in the project per se! It’s possible that it would expect later into a far larger research project, but certainly not guaranteed. I assume the job isn’t something that could be done long-distance for nine weeks, perhaps?

      Yeah, I was surprised too when I googled ancient couches and the like; I tried to base the algorithm off them rather than more modern ones, but they look so similar one probably can’t tell the difference. Interesting re: colours though! I’ll give them another look.

      Pathfinding has been hard (indeed, in writing next week’s blog entry, there is actually a little bit of complaining about how much of a slog this has been) but it is well past halfway finished. Blehhhhh. Regardless: you’re most welcome! It’s awesome that it’s a standard weekend read – that’s so nice to know. See you next week for another tech-y-ish entry…

Leave a Reply

Your email address will not be published. Required fields are marked *