Author Topic: Ultima Ratio Regum (0.8 released after five years!)  (Read 239628 times)

UltimaRatioRegum

  • Rogueliker
  • ***
  • Posts: 318
  • Karma: +0/-0
  • Username says it all, really.
    • View Profile
    • Ultima Ratio Regum
    • Email
Re: Ultima Ratio Regum (v 0.7 released, 18th April!)
« Reply #90 on: September 09, 2015, 11:13:04 AM »
4) Ha, that's using wizard mode. In game you can save the area you're on so .png, but it only saves the parts of it you've explored!

Now I'm sad because I found the largest city on the map and I wanted to take a giant screenshot of the whole thing...

But now Im curious about the next update,how will the NPCs interact with us?Will their speech be more like the sometimes weird DF speech or are only the important NPCs be able to talk with me?

Heh - I did once take such a screenshot, but it needed a bit of fiddling with wizard mode to actually allow it. It's rather out of date, but it looked cool: http://www.ultimaratioregum.co.uk/game/files/2014/12/A-City.png - the empty district there is now the market district; I hadn't finished its generation when I took this picture.

All NPCs will be able to talk, but I do *not* want them to have weird idiosyncratic/non-sequitur speech at all - I'm pushing for far more realistic conversations, sensible flow of conversation, etc. From the average person in the street you probably won't be able to find out that much, but you should still be able to talk to them! From people of note, though, you'll be able to get way more information.

It still bothers me that the green "Poi" bar is shorter than the others :).

Ha! Those will probably be removed in the next release as I work on other things before then returning to think about how health/combat will work in a version or two :).

Tzan

  • Rogueliker
  • ***
  • Posts: 193
  • Karma: +0/-0
    • View Profile
Re: Ultima Ratio Regum (v 0.7 released, 18th April!)
« Reply #91 on: September 09, 2015, 03:58:05 PM »
Quote
All NPCs will be able to talk, but I do *not* want them to have weird idiosyncratic/non-sequitur speech at all

Forum Member said: "I used to be a game developer like you, but then I took a job to the wrist".

UltimaRatioRegum

  • Rogueliker
  • ***
  • Posts: 318
  • Karma: +0/-0
  • Username says it all, really.
    • View Profile
    • Ultima Ratio Regum
    • Email
Re: Ultima Ratio Regum (v 0.7 released, 18th April!)
« Reply #92 on: September 11, 2015, 10:27:19 AM »
Quote
All NPCs will be able to talk, but I do *not* want them to have weird idiosyncratic/non-sequitur speech at all

Forum Member said: "I used to be a game developer like you, but then I took a job to the wrist".

We've all been there :(

UltimaRatioRegum

  • Rogueliker
  • ***
  • Posts: 318
  • Karma: +0/-0
  • Username says it all, really.
    • View Profile
    • Ultima Ratio Regum
    • Email
Re: Ultima Ratio Regum (v 0.7 released, 18th April!)
« Reply #93 on: September 12, 2015, 11:27:51 AM »
A rather short and snappy URRpdate this week, with hopefully something rather more substantial in a week's time:

http://www.ultimaratioregum.co.uk/game/2015/09/12/not-quite-the-shortest-update-ever-but-not-far-off/

UltimaRatioRegum

  • Rogueliker
  • ***
  • Posts: 318
  • Karma: +0/-0
  • Username says it all, really.
    • View Profile
    • Ultima Ratio Regum
    • Email
Re: Ultima Ratio Regum (v 0.7 released, 18th April!)
« Reply #94 on: September 19, 2015, 11:12:33 AM »
I’ve just finished reading Q, a novel by the Italian literary collective Luther Blissett (that actually being the name of a footballer, a name they deemed to be inherently comic), which I absolutely loved. I recommend that everyone interested in URR give it a look since it looks at a lot of themes similar to those I’m trying to convey in the game, and so I will avoid spoilers, but there is one crucial point here (and that is mentioned in the book’s blurb, so it’s not a spoiler) – the narrator adopts a wide range of names and identities throughout the book. The book – set during the Reformation – emphasizes, albeit implicitly, the impossibility of ever being truly secure in knowledge of someone’s identity in an era where transport is limited, countries appear “massive” without aircraft and trains and cars to traverse them, and for all except the highest-ranking members of society there are no clear records kept on who is who, who lives where, and who is from where. Reading the book managed to segue quite nicely into some thinking I’ve been doing myself recently, but the book made this all the more certain in my head: URR has got to have a disguise mechanic.



Of course, we can still have a layer where the player can “earn” permissions to certain areas via transparent means. By which I mean – bribe someone to give you documentation to access Place X, or earn the loyalty of a religion so they’ll let you into Place Y, and so on – but surely we could take full advantage of the detail of the world’s faces/clothes/cultures/social norms/etc by implementing a disguise mechanic. I think this would have several components:

Appearance: add items for the temporary dyeing of hair and lightening/darkening of skin tone and temporary facial tattoos, and allow for adjusting hairstyle. Other NPCs will, in part, judge whether you are part of their nation based on how your face/hair look.

Clothing: the player adopting certain items of clothing lends other NPCs to assuming the player belongs to certain categories. This would be both clothing, but also things like rings, necklaces, types of armour worn, weapons sheathed, etc.

Speech: this is a really interesting one, and I suppose ties back into the ongoing question of “how is the conversation system going to work?”. It would be amazing if there could be some kind of system where the player can try to “fake” the forms of speech expected in that nation/culture/religion, and the better they can do this, the less suspicion they fall under. Perhaps the player can offer special greetings once the player has heard them once (“Greetings of the Divine King of the Snow!”) or generic greetings if not (“Greetings”), and the more “generic” comments the player makes, the more suspicious NPCs become, but the more the player knows what needs saying, the more they’ll fit in. Equally, once one becomes used to how people of a certain nation speak, perhaps one can select what “style” of speech to speak in a given conversation? That could be so interesting (in my current ongoing drafting of how conversations are going to work, I’m working on trying to define methods for generating different styles of speech).

So once you adopt the first two – dye your skin, and find the right clothes – you’ll be able to walk around in most nations undetected. But if you want to talk to anyone there, you’ll need to mirror their patterns of speech – and, equally, perhaps a particularly isolationist nation has a lot of guards on every major trade route, and you’ll be challenged by them even if you look like you belong to that nation? I think there are so many interesting potential gameplay experiences here: to some cultures your character presents themselves as they “truly” are, in other nations you entirely try to fake it, and maybe in other nations you play it by ear? This seems like another mechanic which would really take advantage of the detail in the world if we can make NPCs very observant about when something seems to be “off” when looking at/talking to the player.

Whether this will be 0.8 or 0.9 remains contingent on precisely how large 0.8 ends up being – is it just NPCs, or is it conversation as well? – but this is definitely going to turn up very soon, though it might be in a different release to conversation per se. If anyone has any other ideas for some more details on this mechanic, or perhaps how it could work in other contexts, or other parameters we could civilizations vary by: let me know!

King_of_Baboons

  • Newcomer
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Ultima Ratio Regum (v 0.7 released, 18th April!)
« Reply #95 on: September 19, 2015, 08:05:23 PM »
Nice idea,bro.

I think that the whole disguise thing could open some paths for future stealth missions(if that ever becomes a thing).

Example:The Elbwin Family,one of the most influential nobles in town,are going to throw a costume party at their manor.Infiltrate the party and steal their secret documents and bring them to *name of rival family here*.Don't forget to wear a costume and a mask.

It would also be interesting to wear some sort of royal jewelry and then everyone would think that you are a noble and give you gifts and whatnot  8)

UltimaRatioRegum

  • Rogueliker
  • ***
  • Posts: 318
  • Karma: +0/-0
  • Username says it all, really.
    • View Profile
    • Ultima Ratio Regum
    • Email
Re: Ultima Ratio Regum (v 0.7 released, 18th April!)
« Reply #96 on: September 20, 2015, 11:32:37 PM »
Agreed!

Your final comment raises an interesting question: can you disguise yourself as a *demographic* (person from nation X, religion Y, etc), or as a *specific* (so you can pretend to be Person X who Person Y has never  met, which could be rather interesting). I'm inclined to say #2, but it'll be trickier to code!

King_of_Baboons

  • Newcomer
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Ultima Ratio Regum (v 0.7 released, 18th April!)
« Reply #97 on: September 21, 2015, 07:53:39 PM »
Okay,so I was checking out the interiors of the manors and I noticed that there is slight error in the manor making thingy.

The civilization Im in doesn't like slavery and yet the lower levels of every manor has about 16,or more,slave beds.

So unless these families have a shitload of babies(which could be plausible since the civ has no gladiatorial arenas to keep them entertained,I mean,what else would you do in those times?),I feel that the town manors need to have variations with no basement beds if there is no slavery in their towns.

Also the game crashes if you try to export stuff inside a manor.But its not a big deal since the game is smart and saves before closing the window.

UltimaRatioRegum

  • Rogueliker
  • ***
  • Posts: 318
  • Karma: +0/-0
  • Username says it all, really.
    • View Profile
    • Ultima Ratio Regum
    • Email
Re: Ultima Ratio Regum (v 0.7 released, 18th April!)
« Reply #98 on: September 27, 2015, 02:56:21 PM »
Okay,so I was checking out the interiors of the manors and I noticed that there is slight error in the manor making thingy.

The civilization Im in doesn't like slavery and yet the lower levels of every manor has about 16,or more,slave beds.

So unless these families have a shitload of babies(which could be plausible since the civ has no gladiatorial arenas to keep them entertained,I mean,what else would you do in those times?),I feel that the town manors need to have variations with no basement beds if there is no slavery in their towns.

Also the game crashes if you try to export stuff inside a manor.But its not a big deal since the game is smart and saves before closing the window.

Ah - those are probably servant beds. Is the flooring wooden or stone? If stone and the beds are proper beds, then servants; if wood and the beds are extremely simple, then slaves. Ah, interesting re: exporting, thanks for pointing it out!  I'll look into it.

And now, this week's update, cross-posted from the game's blog...

--------
Normal service will be resuming next week: I’ve moved house, settled in, and started planning out the final push on NPCs, which is to say tracking all the important NPCs as they move around the map – a process which has required me to do a lot of thinking about how to code it before actually getting started (this will turn into what it is effectively a Travelling Salesman problem where the time values at certain points are unknown, which I’ll write about here in the next few weeks). Anyway, here’s a post I wrote a little while ago with some of my thoughts on the future of the Encyclopedia; next week we’ll have an URRpdate as usual.

---------

I’ve decided to remove the Encyclopedia from URR because I increasingly feel/fear it is going to end up doing the player’s “job” for them, and because my original conception of how the Encyclopedia is/was going to work is clearly going to be a programming nightmare.

Let me explain my logic. Right now, the Encyclopedia gives the player a full overview of everything in the world, though that’s only because the game is obviously not replete with gameplay as of yet. The intention was to – either this version, or more likely the version afterwards – fundamentally change the Encyclopedia so that it only starts off with information about your nation, religion, culture, histories, etc, whilst the others remain unknown. Then, each time you uncover a little nugget of information on your quest, the Encyclopedia would update itself. So when you first discovered the name of a nation, it would add in an entry for that nation, but all the information about that nation would be displayed as “????”s (or maybe just blank regions where text could be inserted) until you found those out, and then it would be added. Equally, were you to discover some piece of information that was meaningful, but you didn’t know which nation/religion/whatever it was associated with, there would perhaps be another list of entries in the Encyclopedia without names, noting that *some nation* somewhere has a given flag, but you don’t know which nation. When the player then encountered irrefutable evidence that Flag X belonged to Nation Y, the Encyclopedia would then “conflate” these two entries into a single entry, associating Flag X with Nation Y for ever more.



However, as in the first paragraph of this entry, I increasingly realize that there are some pretty major issue with this type of system. Firstly… surely this is doing the player’s job for them? Surely if the focus of the game is uncovering these cultures and how they interact and searching for the items you seek in the maze of heresies and histories and all the rest of it… surely we should be leaving these connections to the player, and getting the player to come to recognize the nations and cultures they encounter? I fear now that codifying this type of information in the Encyclopedia will run into several major issues. Firstly, it’ll “force” the player (or at least behaviourally strongly encourage) into constantly opening the Encyclopedia to check things, rather than remembering “ah yes, this is Nation X, I encountered some of their emissaries before”. Secondly, the player might not actually notice a useful bit of information, but if the Encyclopedia then updates, it tells the player that piece of information is useful! It seems to me this second one presents a major issue. Thirdly, there’s a question of what information the Encyclopedia should show. To stick with the nation example, should it show the national flag? The national dress? The national style of shoe? What vases in that nation look like? There has to be a line drawn somewhere, because if you want the Encyclopedia to potentially list everything about a given nation, you risk basically reproducing everything about that nation and leaving nothing in the actual game.

So, those are the gameplay issues. There is also a programming issue, which is that I increasingly realize this type of tracking – and perhaps most imporantly, getting the game to notice when a useful piece of information has been “seen” and then updating the appropriate Encyclopedia page – is (or would have been) a horrifying nightmare. This is a secondly concern to the gameplay, of course – if I still thought this was a good method I would certainly have done it – but it still matters somewhat.



What’s the alternative? Well, I think I’ll keep the Encyclopedia in for 0.8 and probably 0.9. Whilst the world is “open”, I think it only enhances the game to be able to see everything at the start and give new players some impression of the size/scale/scope/variation of the planet and the variation of its cultures. However, a little further down the line – shall we say 0.10? – I’m now 99% sure that I’m going to remove it permanently, and rely two things. Firstly, the player’s ability to become familiar with the interconnected world they find themselves in; and secondly, crucially, an alternative to the Encyclopedia (maybe a “Journal” or something of that sort) which records every piece of information the player character sees/hears/experiences, but not the significance of it. With this model you can once more view/read everything of note you have ever looked at/seen, but it doesn’t tell you *what does/doesn't matter.* So once you’ve read a book, you can forever “look up” the information in that book (so it basically as if the player character has an eidetic memory). Therefore, this will be a replacement Encyclopedia where you browse “books”, “clothes”, “paintings”, and the like, but you do not browse information about “nations”, “religions”, “cultures”, since that’s what you’re piecing together. Equally, I'll also work on a system whereby the player can "tag" certain items in their viewed history as things they think are relating to a particular riddle, and then browse according to tags and assess the data they have and what else might fit into that category.

Therefore: the Encyclopedia will survive 0.8 and 0.9, and then be replaced by this new version which records player character experience but leaves understanding up to the player – which is surely the whole point of the idea of the game and the riddle(s) hidden across the world’s cultures! For now, however, the Encyclopedia will remain to assist players as we go through the worldbuilding -> gameplay transition in looking around the world, getting some grasp on its detail/complexity, etc. See you all next week for the resumption of normal service!
« Last Edit: September 27, 2015, 03:23:21 PM by UltimaRatioRegum »

UltimaRatioRegum

  • Rogueliker
  • ***
  • Posts: 318
  • Karma: +0/-0
  • Username says it all, really.
    • View Profile
    • Ultima Ratio Regum
    • Email
Re: Ultima Ratio Regum (v 0.7 released, 18th April!)
« Reply #99 on: October 04, 2015, 09:50:01 AM »
I’ve planned out how important NPCs are going to be handled, and starting tomorrow (Monday) I’ll be working on this. If all goes well… I would expect this to take a week to get all the basics going, but then some of the activities for more complex NPCs (so rulers have to find their way back to their bedrooms in castles, for instance) might take a little longer. I know I rarely write technical entries, but here’s a rare semi-technical entry about how exactly I’m designing the NPC system. Enjoy!

1) The game looks over the entire world and identifies every location where a guard should appear. This means it counts up the number of guard-worthy buildings in each city centre (mints, parliaments, etc), in upper-class districts (currently always three major families, but I do intend to change that in the near future), and stores each guard in a list. It then also looks for an appropriate place for that guard to live – if we’re in a fortress, the guard will be stored in the same map grid (i.e. the fortress) and if we’re in a city the guard will almost certainly live in a nearby lower/middle-class district. Either way, it also stores where these guards should spawn. For non-guards the game assess how many other important people should be appearing on each tile based on the ideologies/religions/etc of each area (so we’ll have ambassadors, blacksmiths, chieftains, doctors, executioners, gladiators, inquisitors, judges, monarchs, lords, ministers, officers, other nobles, regents, abbots, archivists and mercenaries). For now they cannot spawn in the middle of what I’m calling a SCHEDULE event (see below) as this would quickly increase the complexity, but I don’t think this will be an issue, since the world will be vast enough that 99.9% of important NPCs will have begun doing things by the time you ever get to see them.

2) There is now a new dictionary called abstract_creatures, who are the important creatures (I assume only people, but I’ve named it “creatures” in case there are… I don’t know, noteworthy mounts or something later?), which all of these people are put into. For each guard it places a guard in their guarding area, a guard in the district/place they would live, and then has them both schedule a time at which they cross over. For everyone else it just places them in an appropriate starting location. Whenever one of these people takes a turn, it’ll look into this list (instead of the grid-specific lists) to get the person – and as for when it does this, we then look at the kinds of event I’m creating for these abstracted-out people.

3) The game then generates two kinds of “event” for the schedules of these guards, and for all important NPCs – what I’m calling “TIME events” and “SCHEDULE” events. TIME events are those which happen at the same *time* every day – get up, go and guard the thing, stop guarding the thing once the other guard appears, return home, etc. For those in governments it’ll involve going to the appropriate buildings, for rulers it means holding councils, for gladiators going to the arena and fighting and hopefully-not-dying, etc. Then they will sometimes gain SCHEDULE events, which are one-off occurrences: talk to this diplomat, check this town out for heresy, meet secretly at this location on this date, etc. The game will track whether an important NPC is going a TIME or SCHEDULE event, and if a SCHEDULE event, it will ignore all TIME events until there are no more SCHEDULE events to complete, at which point the NPC will look at the next TIME event it would normally have, do that, and from that point onwards behave within its normal list of TIME events.

4) The NPCs use the time “quantum scheduling” system previously described, and when they are heading towards a target in a grid which has not yet been spawned, they assume the highest possible time it would take them to reach it were it spawned – so if there’s a building that could spawn anywhere, we assume it takes 200 ticks to reach it (all grids are 200×200) – if it could only spawn in the left-most side of that grid and the NPC will be approaching from the left, we assume it will take 100 ticks to reach it, etc. After the grid is spawned, the game will actually create a list of all possible timings from each gate leading into that grid to each important location on that grid; this can never be exhaustive for non-city areas or for houses (as there are simply too many), but for NPCs moving to important doors (of which there might be a dozen) from one of four city gates, one can readily see it’s the work of a moment to have the same calculate those and store them for future use after the player leaves that grid and the grid becomes abstracted once more.

5) What then happens if the player steps onto a grid with these abstract people, or leaves a grid on which there exist people who need to be abstracted? Well, this (obviously) is the tricky part, and something I know Dwarf Fortress found challenging to program, and now I’m at this point myself I see why. If you step on and there are abstract NPCs, it will have them “rewind” to the start of their most recent action, generate/reload the map, and then have them play out that action physically. This will mean creating quite a static list of “Actions” and “What This Looks Like On A Spawned Map”, but that shouldn’t be a problem (creating rigid lists is often much simpler, if more time-consuming, than writing PCG!). When the player then leaves, the game will then track how far through their latest action each NPC was, and schedule their next action for either the standard time (if a long way off) or the shortest possible length of time it would take that NPC to start doing that action when moving on the spawned map… and then save the map and do everything else as normal.

6) This means – I think – that NPCs will never wind up doing anything faster than they possibly could if they were “walking it” on an actually present map, but they will sometimes do things slower, but this is simply unavoidable without spawning every single grid at the start of the game (in this regard this is vaguely akin to a Traveling Salesman problem where the travel-length value at each vertex is unknown and/or changeable based on the actions of an external actor). This means that whether or not a particular area has yet been spawned or not, the player will be able to track with great accuracy the movements of important NPCs, and guards will change their shifts irrespective of player actions, and so forth.

I’ll be starting coding this tomorrow. I’ll start with guards since I already have most of their code, and then once I’ve checked that I’ve got them going from their guarding place to their homes and vice versa at appropriate times, and changing over their watches, I’ll move onto the more complicated important NPCs who move between more districts, might move between cities, etc, and we’ll see how it goes. An update on important NPC progress will therefore be next week’s blog post – see you all then!

UltimaRatioRegum

  • Rogueliker
  • ***
  • Posts: 318
  • Karma: +0/-0
  • Username says it all, really.
    • View Profile
    • Ultima Ratio Regum
    • Email
Re: Ultima Ratio Regum (v 0.7 released, 18th April!)
« Reply #100 on: October 11, 2015, 08:58:31 PM »
I am absolutely *swamped* with work and coding and everything else right now, but thanks for the extra resources! I shall get onto them shortly :)

----

Some Updates

A couple things before we get started this week. You can now watch my talk (https://www.youtube.com/watch?v=NxV5Ln8BOAo) from the UK IRDC 2015 on URR’s general generation systems. Check them out! Also, I’ll be at this year’s ProcJam (http://www.eventbrite.co.uk/e/procjam-2015-kickoff-day-tickets-18723814433) 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:

(Hyperlink due to size) http://www.ultimaratioregum.co.uk/game/files/2015/10/Important_NPCs1.png

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”).



Reworking Guards

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.



Next 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![/list]

UltimaRatioRegum

  • Rogueliker
  • ***
  • Posts: 318
  • Karma: +0/-0
  • Username says it all, really.
    • View Profile
    • Ultima Ratio Regum
    • Email
Re: Ultima Ratio Regum (v 0.7 released, 18th April!)
« Reply #101 on: October 18, 2015, 09:39:21 PM »
Major progress on important NPCs this week! We now have all NPCs correctly linking up with their abstract selves, the game correctly listing and assigning historical and interconnected importance (if any) to all important NPCs before they are actually generated (from slaves to kings), the delegates/representatives for democratic nations being generated and tethered to a home district/town/etc, minor vassalage families are spawning, and early progress has been made towards even the generation of castles! Read on…

Importance of Important NPCs

Firstly, the game now selects a lot of new important things during world generation; or rather, it has always done this and then stored “keywords” and information so that specific areas can be generated later if/when the player sets foot in them, but this has now been expanded to every NPC who might be important. Therefore, the world at generation decides precisely how many servants live in a given mansion, for example, and how many mercenaries live in a mercenary guild in a certain city, and so on. The map I showed last week was partly complete in this regard but was lacking a bunch of other important NPCs I had actually forgotten about, but I believe the game now generates them all correctly. This means all guards are generated at world gen, along with all other obviously-important NPCs (like rulers) and a small number of other NPCs (like slaves, servants, prisoners, etc) who are then intermingled with non-important versions of themselves.

Since new important NPCs have been added, take a look at this new diagram – you’ll see that there’s now a bunch of important NPCs spawning in towns, settlements, more in cities, all over the place! Much more colourful and much more variety, and shows that not everyone who matters lives in a city…

http://www.ultimaratioregum.co.uk/game/files/2015/10/Important_NPCs2.png

Historical Importance and Secret Information

The game can now assign “notes” to each important NPC, notes which might be referenced elsewhere in the game and will determine some of the unique things you might be able to do with each unique NPC. Examples include whether that NPC is involved in a plot, is secretly a worshiper of another religion, has an unsolved crime to their name, fought in a war/wars, is corrupt or embezzling somehow, what other important NPCs they’ve met, where they traveled, and so forth (and also past-tense examples for all those I wrote in the present tense, so an important NPC might have been involved in an un/successful plot in the past, but is not involved in one currently). This will obviously develop far more in 0.9 onwards, but the basic framework is now in place for meeting a merchant in one place, who tells you about a plot he overheard involving someone in the next town over, then finding that person and encouraging them to give you information about the plot, and discovering it is being lead by a number of political delegates who all secretly worship another religion, and then finding out a list of delegates and trying to decipher who it might be, and finding out this plot may be attempting to put a particular person on the throne, a person who – as someone else told you – may just know the location of one of the items you’re seeking…

…and so forth.

Representation and Delegates

I turned back to the democratic ideology choices this week and added a nice bit of extra detail here. There is now a new NPC type, the “delegate”, shown for now with an “a”, and each democratic(ish) nation will have a selection, depending on how many seats there are in their parliament. Once the game knows this number, it then carries out a reasonably complex equation. The game counts up how many towns, monasteries, and districts there in a nation (say, 4, 2, and 18), and then attempts multiples alongside each of those (1,2,3,4) for how many representatives there might be from each town/monastery/district, and then attempts to get that as close to the target delegate value as possible. If it hits it directly: great. If not, then the game gets as close as possible to that value, and then adds in a few extra delegates which belong to the major families, the military, the national bank, the national religion, or some combination, depending on how many “extra” delegates are required. This obviously produces a lot of variety – in some nations each monastery has two delegates, each city district just one, and each major house two; in another maybe each city district has two delegates, but the military fields six of its own delegates, and the bank a couple too. Delegates have been given (temporary and very basic) schedules for me to test in the coming week getting them all moving correctly around the world map. Here’s an example map of nations with the “representation” ideology (in white) and their distribution of delegates, who will all be scheduled to come together to the parliamentary building once every X weeks/months/etc:

http://www.ultimaratioregum.co.uk/game/files/2015/10/Delegates1.png

Road Aesthetics

A minor thing – I noticed that all road curves were curved, and that doesn’t really stick with the whole geometric-aesthetics thing, so road curves now vary, just like almost everything else, depending on the nation they’re found in. A truly minor detail, but once I realized it, I just had to fix it. The octagon and diamond inevitably look similar (the octagon just has less diagonal), but still:



Early Days for Castles

On evenings when I didn’t have enough time to sit down and really do a lot of this complex scheduling/technical stuff, I started work on castle generation and, although it took a long time to figure out how exactly this was going to work, I’m very pleased with the initial results, and I’ll definitely have something to show in this regard in… two weeks? Something like that. But here’s a little hint of some castle walls, a gate, a moat, and is that… is that something which might become a DRAWBRIDGE?!



Vassal Houses

The game now spawns an appropriate selection of lesser houses for nations with the “vassalage” ideology. There’s a longer blog post in the work for the future about how I’m reworking these for 0.8 and the new variation I’m trying to add to all the nations as a result, but that’s a future thing; nevertheless, these now appear, and each is given a town to rule; in the very near future I’ll be expanding this so that a “county” appears around each town which each family rules, and all the farms and whatnot within it, which is the area that vassal then controls. Still not quite sure how the mottoes for these lesser houses will generate, but I’m sure I’ll come up with something acceptable in the near future.



What next?

Well, by the end of next week I hope to get the important NPCs moving and scheduling themselves around the map, even if only in a very basic state, and to have significantly more progress on generating castles, and hopefully to allow you to follow and track important NPCs whether they are”abstract” – i.e. the player hasn’t yet gone close enough to them to pawn them – or “real” – i.e. the player has gone close enough – and these NPCs should carry out their schedules regardless of whether they are on the other side of the world, or directly in front of the player. That’s a pretty big ask, and I’ll be busy for much of next weekend, but I’d hope for the first steps towards it next week. I’m also drafting out in the background a few other improvements to the policies system (which is now becoming “ideologies”, as that is far more descriptive of what I’m after here), extra variation in each nation, and also some thoughts on ambient flora and fauna and making those a) more interesting and b) actually exist, respectively. I’m also now strongly leaning towards saving up both NPCs and conversations for a big release, as DF did that a while ago and it seemed to work out fine, and I know it would be worth the wait… I know I mention this debate every entry at the moment, and I still haven’t 100% decided, but I’m about 95% on the “save it up for an epic first release” side of things. Either way, see you in a week!

UltimaRatioRegum

  • Rogueliker
  • ***
  • Posts: 318
  • Karma: +0/-0
  • Username says it all, really.
    • View Profile
    • Ultima Ratio Regum
    • Email
Re: Ultima Ratio Regum (v 0.7 released, 18th April!)
« Reply #102 on: October 25, 2015, 09:14:41 PM »
Lots of further work on important NPCs (this “Important NPCs” series of blog posts is probably going to hit at least eight or so in total). The major developments this week: the game now assigns nearby home districts to each important NPC, and in turn an actual house when their district is actually spawned; the game now adds in naval trade routes and creates a range of maps for optimizing NPC pathfinding around the world; and NPCs now move around the world map and take an appropriate length of time to make moves! Read on:

Homes are Assigned

Homes are now assigned to all important NPCs, and each NPC has a “work” location and a “home” location (although special events, like a gladiator being pulled away from their training to fight in any one of many possible arenas, will add another “work” location). In some cases these are the same districts – so the guards who guard castles are also guards who live within castles, and their work and home districts are the same, and the same goes for every guard in a one-tile fortress, town, etc – whereas other guards will live elsewhere. There are no homes in a city centre, but the guards who guard the mints or parliaments have to live somewhere, and so they now live in other districts, where the district depends on the NPC (so the guards of mansions are better-off and live in middle-class districts, whilst the guards of arenas will live in lower-class districts, and so forth). When the player then enters a district with homes in for the first time, the game will look over which important NPCs are housed in that district, and will assign actual doors and houses to those NPCs, and ensure that random NPCs in crowds will never enter these houses. Here’s a little output noting which guard in a pairing each guard is (“first guard” or “second guard”, their form of guarding, where they begin the game (whether on duty, or not on duty), and then where they work and where they live; and you’ll notice a range of living districts for the mint guards.

http://www.ultimaratioregum.co.uk/game/files/2015/10/Homes.png

Ocean Trade Routes

The game now generates ocean trade routes. All settlements except hunter-gatherer encampments which “touch” the coast now count as being a “dock” (even if these do not physically spawn yet, but will soon), and the game now has an algorithm for attempting to piece them together in a reasonably interesting, efficient, and wide-reaching way. The player will be able to jump onto these shipping routes, as will important NPCs who need to travel very long-distance (which will be rare, and mostly for mercenaries, soldiers, ambassadors, diplomats, plotters in various schemes, explorers, inquisitors, preachers, etc). I’m very happy with the kinds of shipping patterns this produces, and is something I’ve been meaning to add for a while, since it connects up parts of the map not ordinarily connected and thereby allows important NPCs to potentially travel to places they couldn’t travel to before (more on this below). These routes will show up on the world map once you find them, and when you consider boarding a ship in 0.9 (probably) onwards, you’ll be told where that lane stops, how long it will take you to each location, how safe from pirates etc each part of the route is, and so forth.

http://www.ultimaratioregum.co.uk/game/files/2015/10/Oceanroutes.png

Road and Off-Road Pathfinding

When an NPC is looking for a path between settlements, the NPCs consider two possible routes – one using any tile they’re able to use, whether something fast like a road or something slow like an ordinary piece of terrain, and another using only “special” forms of travel, meaning roads, naval trade routes, and (in the future) desert caravans and mountain passes. Whichever one is faster (and safer) will be the one the NPC selects. So in this first picture, we see the terrain of a given world. In the second picture we see “all valid tiles”, and we can see that oceans are excluded aside from shipping routes, deserts are entirely excluded (since caravans do not yet exist), mountains are excluded (since mountain passes do not yet exist) and rivers are excluded, except on tiles where a road crosses them. In the third picture we see the final map which only uses roads and shipping routes, which might take longer paths to a given location but each particular tile will be faster – and so the game will check them both whenever an NPC wants to move. I debated going even further and weighting every single tile and using some kind of A* with Bounded Costs system, but a) that would be a surprising nightmare, b) it’s very CPU-intensive and this multi-settlement pathfinding has to be done effectively instantly, and c) I actually think this can have gameplay value: if you are told Person X is travelling to Y, you can be told if they’re travelling by road, or not, and can try to catch up with them that way, rather than knowing they’re going by the absolute optimal route, which might be very challenging for a human player to deduce.

http://www.ultimaratioregum.co.uk/game/files/2015/10/Terrain.png

http://www.ultimaratioregum.co.uk/game/files/2015/10/Worldpathfinding.png

http://www.ultimaratioregum.co.uk/game/files/2015/10/Worldroads.png

A final interesting note: we can see in both of these pictures that the area in the northwest is cut off from the rest of the world. That area happens to have no towns which are on the coast and therefore have docks, and same goes for cities, and it is separated from the rest of the world by mountains and desert, and cannot therefore be accessed by land (unless the player is willing to move through desert or mountains without caravans/passes, which will cause each turn to take many many times longer than normal; NPCs will not have this option). Therefore a future (but probably quite simple) system will be required to floodfill the world and to ensure that every settlement, no matter how obscure and hard to reach, can always be reached via land, road, shipping route, caravan route, or mountain pass, or some combination – something this particular generation doesn’t achieve.

NPCs Moving Around the World Map

Although this is all snazzy and important, the most important thing by far is that all important NPCs now move around the map on their standard schedules. They will not yet appear and spawn if the player enters the same tile, and they are not yet able to be given one-off tasks (“Come together in Parliament for a vote”, “Go to this arena for a fight”, “Present your latest artistic work in front of the King”, etc), but they all correctly make their way around cities and towns, they perform their actions at the right times, they get up and go to sleep, change watches if they’re guards, tend to vegetable gardens if they’re monks, and so on and so on. Now, naturally making sure that the player can physically see this happening is the next step – and a big one – but at any moment in time I can now check what every single important NPC across the world is doing, or in the process of doing, and when they’re going to stop doing that and start doing something else. There isn’t really a nice picture I can put up for this, but it’s happening, and that’s crucial and very exciting.

Next Week?!

The next two weekends are both free for me to focus entirely on coding (as well as ongoing evenings etc), so I’m hoping for a lot of progress. For next week I’ll be continuing to inch forwards on castle generation, hoping to get guards once more changing over their patrol timings with each other, and start to get all the important NPCs spawning when the player steps onto those tiles and being tracked whether abstract or spawned. That’s quite a lot, so we’ll see how it plays out, but I’m very pleased with my speed of development at the moment, particularly considering how many other professional (and personal) commitments I have at the moment. See you next week!

UltimaRatioRegum

  • Rogueliker
  • ***
  • Posts: 318
  • Karma: +0/-0
  • Username says it all, really.
    • View Profile
    • Ultima Ratio Regum
    • Email
Re: Ultima Ratio Regum (v 0.7 released, 18th April!)
« Reply #103 on: November 01, 2015, 12:23:18 PM »
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…



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:





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



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!

King_of_Baboons

  • Newcomer
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Ultima Ratio Regum (v 0.7 released, 18th April!)
« Reply #104 on: November 01, 2015, 02:14:14 PM »
Wait,Im confused,did you removed those walls that block access to other districts just for these town screenshots or do towns no longer have them?