• Register
Post news RSS Further AI Progress on Ultima Ratio Regum

Lots of new AI work on mercenaries, guards, servants, and more!

Posted by on


This year’s US IRDC has now been booked, and will be at NYU from August 6th to the 7th! Unlike last year where various tedious things got in the way, this year I will 100% be dragging myself across the ocean for this, and staying at least until late on the 8th, and possibly a little longer depending on Various Factors. If I’m going across the Atlantic for it, those of you already in North America have no excuse! I hope to see a lot of URR fans there – for more information, you can check out the information here on Roguebasin Roguebasin.com. If you want a European IRDC – and naturally, I do too – then you should pester DarkGod, who volunteered to host it but has since gone mysteriously quiet…

This Week:

Well, in one sentence, even more NPCs now (as far as I can tell) schedule correctly. Here’s a run down!

Guards (again)

Yep, guards needed still more work. Found a bug where if you entered the house of a guard, even if they were actually meant to be in another building, so long as that building was a) in the same district and b) currently unspawned (e.g. an arena, whose guards always spawn in the same lower class district). This has been fixed. Also discovered a bug during testing that sometimes under very specific conditions actually duplicated an NPC – if an NPC went into a building, and you saw them go in (so they had been physically spawned), but the building had not yet been spawned, and you waited until they completed their initial task, and then entered (and thereby spawned) the building, they would appear in the building and behave correctly, but a doppelganger would be made and stored back into the list of abstract NPCs. Then, when it came time for that NPC to take another scheduled action, both the abstract non-existent NPC, and the physically spawned NPC, would both try to take the action (since they shared the same unique identifying number), at which point… Bad Things would happen. This has been dealt with. I know last week I said everything with guards was working, but now I *really* think everything with guards is working. Hopefully.


Due to a classic case of chaos theory, making a totally minor change that was essential to the game’s code for handling important NPCs had the unexpected side-effect of causing only the tiniest fraction of prisoners to ever actually spawn – only the secretly-important prisoners in jails were spawning, whilst the other prisoners who are classed by the game as “important”, i.e. they are saved and still appear when you change map grid, were not being spawned. This has been fixed! Here’s a jail full of prisoners (the “z” characters) wandering about their cells:

User Posted Image

And the jailer knows how to go to bed, though I slightly messed up this gif by going up the wrong staircase first and letting the mouse cursor stray in at the end…

User Posted Image

And when I go back in at night, they’re all on their beds like good prisoners, and the jailer is where they should be in their quarters:

User Posted Image

User Posted Image


There was an earlier bug with mercenaries, and although I didn’t explicitly fix it, something I’ve coded in the interim seems to have fixed it, so I’m assuming it now all works perfectly. Hooray! Mercenaries are found in mercenary guilds, and spend their day wandering/pacing their rooms. In the future, of course, you’ll be able to engage with them, but that’s where they stand for now. Here’s a mercenary guild I entered at night, and sure enough found everyone in their appropriate beds:

User Posted Image

And one waking up and starting to wander and pace:

User Posted Image

Servants and Slaves

I… think servants/slaves in upper-class houses are now working correctly. The important ones spawn and behave, the unimportant ones spawn and behave, and so forth. Here’s me running around the upper floor in a non-slaving nation (so “v” is servant, “s” is slave) and watching the servants going around their day – though in fairness, we’re in a equatorial region here, so both skin tones and wood colours tend to be darker, and combined with the brown/red in the floor patterns here, I admit that the servants are a little tricky to see! But there isn’t really much I can do about that, as it’s a rare occurence to have all three of those match up. Though this might finally galvanize me towards actually adding a 14×14 font size soon, that should help in situations like this!

User Posted Image

And in another mansion, at night, all the servants are sleeping in their quarters!

User Posted Image

However, there is some remaining weird issue going on – if we’re physically present when they should be waking up, they don’t! This is the top priority to fix this coming week.

Bugs and Whatnot

Found a weird bug this week when a guard who had left their house and was going towards the arena to relieve the other guard there somehow got switched from the “Local Pathfinding” state (where they move from one point to another on the local map by any means necessary, regardless of roads) to the “Roadmap” state (where random crowd NPCs just follow roads). This should be totally impossible, and having gone over the code many times I cannot find how this could take place, and sadly I had no debugging stuff going to catch that happening since I’ve been doing AI for three months now and this is the first time that’s ever happened. Weird. I’ve put in even more safeguards into the code to prevent this happening, but I suppose there’s got to be a tiny chance that whatever weird collection of flukes led to this occurrence could still be lurking out there. Very peculiar.

Also discovered an issue with the way I was actually playtesting things; due to things now being saved in their own subfolders in the save folder instead of being saved in one massive file, saving/loading is vastly faster and more efficient, but it does mean it’s harder for me to “reset” the game to its previous state to continue testing the same thing in fractionally different scenarios. So I wrote in a bit of stability code to basically help me testing; this probably won’t be noticed, but it just makes saving and loading things in the background a little slicker.


I’ve continued to take brief breaks from all this madness to work a little bit on the dialect generation system. I’ve identified a massive set of variables including word order and various other things, and it’s looking amazing even at this early stage. In my brief moments of dialect generation, I am coming to realize that before I go much further, I need a very clear and solid idea of what “a conversation” will actually look like. More on this in a near-future blog entry…

What next?

We are approaching a point where there is only so much I can do to try every possible scenario that I can imagine, and I’ll just need to release a playtesting build and rely on the skills of the masses (you wonderful lot!) to help me find it all. Still debating whether to do a closed or open playtest. Leaning slightly towards open right now, but I was leaning towards closed last week, so I’m very changeable at the moment on this point. I’ll update you all once I have more information. For now, though, my focus this week is on ambassadors, clerks, diplomats, innkeeps, delegates, and finishing that issue with slaves/servants.


For the conversation interface, keep it simple, similar to the "look" interface (the one with info about the npc, face, clothes etc...) but with the conversation in a box, and the face in anohter :D

Reply Good karma Bad karma+1 vote
UltimaRatioRegum Author

That is pretty much exactly the plan! :)

Reply Good karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.