The Final AI Update

Ladies and gentlemen, I am pleased beyond words to announce that, as far as I can tell, all the AI requirements for 0.8 are finished! Now, I must qualify this: there are a number of NPC classes that do not yet exist in the game, but those that do exist perform almost all their actions, although there are a small number of events currently omitted (rare or unique events like religious festivals and the like). What this means is that around 80% of all NPCs now do 98% of their schedules, and I think they work correctly no matter what kind of strange behaviour the player involves themselves in with regardless to moving, saving, loading, spawning/unspawning areas, and so forth. As a result, I am indeed putting out the interim playtesting/bug-finding release in the next few days! If you emailed me asking to be on the list, you should find an email in your inbox with details of how to download the playtesting release, and some things to look for, within the week. For the rest of this blog post, therefore, I’ll go over the final additions and refinements done in the last week, and then from next week onwards, we’ll finally be on to dialect and speech generation! I’m so excited. But, first…

Finishing Castles

On Tuesday, Wednesday and Thursday I finished off everything that still needed to be done for castles, and so as far as I can now tell, all the possible NPCs that can spawn in a castle all function correctly with their schedules, their placement, their tracking whether the castle map grid is spawned/unspawned and whether the castle itself is spawned/unspawned, and so on and so forth. One major issue was with sleeping and waking NPCs, and in a few particular contexts guards who should be spawned sleeping in beds were spawned sleeping at their posts, whilst those who should have been on guard duty at their posts were on guard duty in their beds! This got fixed by copying a line of code which should have applied to all guards, but was instead applying to around 90% of them thanks to a typo. I then ran into some issues with entering a castle after the 1080 time of the day (which has 1440 “ticks”, each being ten “turns”) which is when all the guard schedules should switch over; for some strange reasons, the knights guarding the throne room were struggling to spawn correctly and causing a crash, which had *something* to do with beds, but I wasn’t quite sure what.

The “filled” doors are doors to the outside whilst the hollow doors are within one building, so here we see various guards and conscripts going outside. It’s slightly jerky due to all the debug processes printing, but I think it still looks rather snazzy, and I love seeing such a large volume of people going about their day without the game crashing! (You’ll also see slaves and knights in these gifs also just going about their daily business in the castle)

Finalguards

And then immediately after, the guards/conscripts who were guarding outside come back inside and head to appropriate beds:

Finalguards2

Finalguards3

Here’s a cache guard switching with another cache guards whilst various other guards/knights/etc on the same timetable also move to wherever it is they need to go in order to switch over:

Cacheswitch

Guards on upper floors wouldn’t behave

As a result, here are some guards and a knight in one of the towers finding their way down correctly, rather than misbehaving terribly:

Down

I ran into a bug whereby I sometimes ran out of beds on certain generations, but only for knights and guards. It took quite some time to diagnose what was actually happening here, but it finally became apparent that when the smallest possible number of beds spawned in the corner/side towers (four per tower, so sixteen total) and the game was trying to place guards and knights in those towers, and there was a cache in the castle, there simply weren’t enough beds, so the NPCs were stuck trying to find a bed; this meant I had to specifically enable their ability to climb up towers to find another bed, but only specific staircases (because the main staircases are in the main castle, rather than in the towers)! The disconnected nature of the upper floors of castles is unique, and has basically required adding in quite a few exceptions to a lot of NPC behaviour which ordinarliy wouldn’t have to think about impossible paths on a given floor.

After that, though, things went quite smoothly with servants, slaves, and monks. Here we have a basement in this castle containing the castle’s slaves, who were all going about their day most of the time and then filed into the basement as time went by:

Allslaves

And monks sleeping at night in their quarters:

Sleep

I then turned my attention to priests, who – in castles – can fall into two categories. In religious nations you’ll find a single large chapel with a priest walking around inside, whilst in nations that have freedom of religion you’ll find a large number of small chapels, each with a priest (and altar, book, etc) of the appropriate religion. Here’s a priest wandering around a full-size chapel for a nation dominated by a particular religion (you’ll note various servants coming and going at the same time), and then various priests in smaller chapels in a castle in a nation with a plurality of religions:

Chapel

Priest

Priest2

And I must say there were some cool religions in this castle. Jaguars for the jaguar god!

Jaguar

Then, servants. They work the same as slaves (aside from being on the ground floor instead of underground), and these worked pretty much immediately thanks to all the code in place for slaves. I then moved onto torturers and jailers, who should be spawning in a different section of the basement, away from slave quarters (if slave quarters are present) and who keep to a very simple schedule. Sure enough, these folks seem to work perfectly well now too. Here’s one of them wandering around (I also really love how under-castle jails look, don’t you?).

Jailer

And heading to bed:

Jailhome

And here’s a torturer checking out the cells under their control (where unfortunate people will one day appear), and in a later version there will be various unpleasant things in the centre of this room, which will vary from nation to nation (so different nations have different methods of torture, if torture is their thing).

tort

And slave quarters and a dungeon in the basement of the same castle, with two different staircases. This is a rare-ish scenario, but meant I had to make absolutely sure that slaves returning to their quarters knew which staircase to take (servants, being on the ground floor instead of the basement, don’t have this issue)…

Jaguar

And that’s pretty much all the NPCs for castles! In future versions I may add in a couple of extra NPCs, like book-keepers for archives and the like, and also I need to add in concubines at an appropriate point – and the actual leaders themselves! – but for now, castles still appear very active when the player wanders around them, and that’s what matters for 0.8.

Final Check, Final Bugs

The last thing to do before sending out the playtesting release is to active all possible AI actors and spend a little while wandering around the world and trying to break them myself. I’ve now done so, and to my absolute delight, I have thus far discovered that everything seemed to be working correctly, although I do still harbour a tiny, tiny concern that certain NPCs in certain houses might not always appear in their houses at the correct times, depending on the player’s actions… but I couldn’t produce any bugs here, so that’s down to be super-secret super-elite playtesting team to figure out.

I’m also going to implement a few debug tools for my playtesters, so they can now look at a debug print-out which shows all the important NPCs in that area, where their homes are, what their current tasks and schedules and objectives are, and so forth. This, naturally, will not be in the final release, but I thought it was a pretty essential feature to maximize the potential of the interim playtesting beta.

Although I have ever confidence in my team, the complexity of all this stuff does mean it has to be possible that the final 0.8 release will go out with a few minor issues still in place. This would be disappointing, of course, but so long as there are no AI related crash bugs present when 0.8 hits the shelves, I’ll be content – it would obviously be even better if there were no AI bugs of any sort whatsoever, but I’m being realistic. Pathfinding and scheduling is massively complicated already and made even more complex by the variety of permutations of spawned/unspawned/loaded/saved areas the player can bring into existence or push into the background through their movements in the game world, and despite my best efforts, I’m sure it’s still possible for an NPC to duplicate, or to vanish into nonexistence, or something else of that sort. But we’ll see! Maybe the playtesting release will be remarkably stable and nobody will find any problems whatsoever.

HAAAAAAAAAAA.

Next Week

DIALECT GENERATION! For the next week or two I’ll be working on the underlying mechanics for generating different styles of speech for each in-game culture (in the average game we need to produce around 40 very different styles of speech, and ideally many tens of thousands possible across a long enough stretch of time). I’ve started to draft this in various forms over the last month or so, and so next week I’ll give you all a run-down of what I have in mind here. After that we’ll be onto designing the conversation screen! I’ve also been giving this a lot of thought, and I have some idea how this is going to play out, and how it will connect to the dialect/sentence generation stuff I’ve been quietly putting together and experimenting with in the background. See you in a week!

Illness and Suffering

A very, very short update this week, I’m afraid. I’ve been really ill all week with a pretty stubborn chest infection which has destroyed my sleeping schedule; I’ve managed to get way less done than I intended, and just vaguely keeping up with email/correspondence obligations has been a tough enough task. I didn’t get anything done Fri evening/Sat/Sun, which is the period I normally focus on coding, and I’m taking today off work with this thing too, most of which I intend to spend in bed. So sorry everyone – I’ll get a full update back next week, assuming I’ve got over this thing by then.

Umberto Eco and URR

———– Call For Playtesters ———–

Firstly this week, before anything else: I’m looking for a small team of playtesters, probably around a dozen, to test out all the AI stuff in the next URR release, probably starting some time next month. If you’re interested, please send me an email to mark at this domain, and also link to your Twitter, or Facebook, or something that shows me a little about who you are, and just give me a line or two about why you’re interested and how much time you’d realistically be able to give it – please be honest! I want people who can really contribute to making 0.8 the best it can possibly be. I’m recruiting people to basically wander around the map, go into every building they can, check the NPCs are there and behaving sensibly, and do everything they can to mess up the schedules of the important NPCs. I’d suggest being able to commit at least 6+ hours would be a decent start, but I might ask for more if someone quickly finds a major bug, which I correct, and then upload a new playtesting version. Either way: if you’re interested, give me a shout! I should add, though, that’s it’s possible I’ll just decide to upload an explicit “beta” version with some massive warning saying THIS VERSION MAY NOT BE STABLE and let everyone test it… or I might not. I haven’t decided yet. But in case I decide to do a “closed” test, please let me know if you’d be available by the method outlined above…

———–———–

So, I had a full blog post on AI stuff coming up this week (another week of big progress, I’m pleased to say, with priests, mercenaries, more guards, ambassadors, clerks, diplomats, and various other classes of NPC all working correctly), but I learned upon waking up yesterday morning that Umberto Eco, one of my absolute literary and intellectual idols, has died. As such, I feel compelled to instead post this week some thoughts on Eco’s work (both scholarly and fictional), his massive inspiration on URR (which I’ve written a bit about before), and his impressive balancing act between work in academia and the creation of artistic work outside. If you haven’t read his brilliant work, and you’re the kind of person interested in URR, I strongly recommend going to read The Name of the Rose, Foucault’s Pendulum, and/or Baudolino, for yourself.

Eco is well-known in academic circles as a semiotician, and to a lesser but no less significant extent a literary critic and medieval historian. He was probably most famous for the idea of the “open work”, developing earlier “death of the author” concepts into a more concerted argument that texts of all sorts (games included) do not only have a single meaning, i.e. the meaning intended by the author, but rather that there are many other meanings dependent on readers, contexts, and so forth. After that most of his work focused on developing the importance of context, setting and previous experience to the deciphering of signs, most famously in (the rather excellent) Kant and the Platypus. This latter body of academic work in particular has had some influence on URR, but the most important aspect of Eco’s work for those of us who read (and write) this blog is his first novel, The Name of the Rose, with which he came to massive prominence after its first publication in 1980.

Ecopost1

The Name of the Rose has two overlapping stories. One is a murder mystery, of sorts, where various people from the Abbey are slowly being killed, and it becomes apparent over time that the methods of the killings might be drawn from the bible and have something to do with a particular lost book from pre-christian times. The second involves a conference being held at the same abbey to determine an issue called the “poverty of christ” – whether or not he owned the clothes he wore, or whether they were lent to him. This second point might seem deeply irrelevant, but is actually of immense importance to the world of the novel. One of the things I find most interesting about the novel is its placement in an era where what we might not disparagingly call “academic debates” were not, in the negative use of the word, purely “academic” – they had massive real-world impact. It might seem completely irrelevant to decide whether a particular figure from a particular religious mythology owned his clothes or not, but doing so would have massive impact on the everyday life of Europe. If it was agreed that the son of the christian god did own his own clothes, then that demonstrated that the divine had (presumably) purchased these clothes, and thereby had material possessions. If not, then not. The real-world relevance of this then becomes: should the church and the pope be allowed to own possessions, as the representatives of the divine on Earth, and thereby accrue immense wealth (so they naturally supported the “yes, he owned his clothes” side), or not? (European monarchs, cautious of the church’s strength, argued that he did not, and therefore the church has no right to have such wealth). On my first read as a teenager I didn’t appreciate the link between these two stories, but without giving too much away, both the murder mystery plot and this secondary plot are both effectively discussions about the degree of power the common people should have over the church, and over rulers and those of higher social rank more generally. They intertwine amazingly well whilst demonstrating the depth and complexity in both the lost book, and this religious debate, and their potential (or feared) real-world impact on all of Europe.

When I finally figured out what URR was going to be after a year or so, it was (if I recall correctly) a re-read of The Name of the Rose that finally made it clear in my head – it was going to procedurally generate the kind of cultural/religious/semiotic mystery that the characters in that book find themselves grappling with. It was going to distribute clues across books, paintings, cultural behaviors, historical events, ideas themselves; and the player’s central goal would be the deciphering of this procedurally generated, and procedurally distributed, semiotic-ish mystery. Over the last few years we’ve wound up with a hyper-detailed world this mystery can (soon, soon!) be inserted into, and I’m confident that in a couple of years URR will look, at least in part, just like the kind of game Eco would have made (were he a game designer). I’m hugely grateful for the book helping me work out where I was actually going with this monster project, and in suggesting a core gameplay mechanic – i.e. the unraveling of that mystery – that should end up being totally unique and unusual.

Equally, I was always also a big fan of Eco for his melding of academic and creative work (which, as you’ve probably noticed, is what I’m aspiring to myself). I think games are a particularly excellent field to pursue this in – I know of a lot of academics who write fiction and have found that it can reduce how “seriously” their scholarly colleagues take their intellectual work, but the opposite seems to be the case among the few games academics who, like me, also produce games; putting one’s ideas into practice seems to be a respected accompaniment to more scholarly inquiries. He struck this balance extremely well, and that’s certainly the kind of goal (in game studies and game design, rather than medievalism and literature) that I’m aiming for. I’ll be very sad to never read a new Eco (although I still have to read his latest two), but Eco’s ideas will certainly live on in a massive range of work, not to mention (in some currently small but soon quite significant way) in URR too. He was a totally unique author, a towering thinker, and one who somehow turned the dense, “historical metafiction” novel from something seemingly niche into a massive phenomenon. If I can manage a fraction of that for games instead – that won’t be half bad, I’d say.

Next week?

Back to AI, and I promise to try and get the blog update out on Saturday! Blog posts have been pushed back later and later on Sundays in the last few weeks, and I’d like to try and do something about that. Since I’ll have a fortnight’s worth of stuff to update you all on by next time, that should be a nice big AI update. See you all then!

On Being a Workaholic

I’ve just turned 25. As that’s a) a pleasingly round number, b) my doctorate is finally going to be submitted in the next fortnight and c) I’m moving into a new phase of my life for the next year being between academic jobs and focusing on URR, I wanted to write a little blog post (completely without pictures, perhaps for the first time ever?) about my goals for the next few years (URR and otherwise), how I intend to reach them, and a little about how my mind works (something upon which many friends have commented in the past).

What’ve I done with my life since I became an adult? Well… I’ve studied and played poker to an effectively-professional level. I’m a week or so away from submitting a PhD within the youngest 1% of people at my university ever to do so (now let’s just hope the bloody thing passes). I’ve gone from having never written a line of code in my life to where URR is now, and I’ve taken this blog from nothing to (I think/hope) a really excellent community for both URR/roguelikes but also more general games discussion and critique. I’ve published a few papers, spoken at more conferences than I can count, and got into the global Top 5 in a whole bunch of bullet hell games (though that first record continues to elude me). And yet… I feel as if I’ve achieved nothing, or at least less than I could have. Every day I’m haunted by the minutes I waste on Youtube, or the hours I spend just thinking rather than doing (even though I intellectually acknowledge the importance of a good plan), or the time it takes me to come around in the morning before I can think of doing any intellectual work. I cannot help but think I could have done so much more with my time than I have, even though (and I do not say this pridefully) it is more than most have done by my age. It’s just how my head works, for better and/or for worse.

Today I set myself some goals for the next five years. They are big goals. Some are academic goals in terms of what rank of university I should be working at, number of papers/books published, and the like; some are creative, such as finishing URR by the time I’m 30; one is in terms of this blog, which I want to continue to grow as a place for general games criticism and discussion as well as a devlog; one is a fitness goal; and one is a kind of overall objective for the level of “impact” I want to have had on gaming – academia and game development – once I’m 30. As I say, taken as a whole these are colossal goals; I’ll have to continue working (and I include coding here as “working” even though I enjoy it – I mean “working towards my goals”) 12+ hours, every day (weekends and holidays are no excuse for not working!) to reach them. I suppose in part I’m posting this entry as part of forcing myself to keep them – if I’ve made public how “high” I’m aiming, I can’t really show my face in five years unless I’ve achieved them, now can I?

Anyway. In URR this coming year we’re going to have hopefully four releases – 0.7/8/9/10. These are building interiors, NPCs (!!), strategy layer/travel/coinage, and combat (!!!!). I’m also aiming to have at least three game studies papers accepted to academic journals, if not necessarily published yet (there is often a long delay), present papers at at least half a dozen conferences, and finally snag that damned shmup world record in my spare time. I’d also like to try and break the 10,000 downloads barrier for a new version – 0.5 was 2/3rds of the way there (but was out for around half a year before 0.6 came along), but I’d like to grow the game to the point where I can seriously expect those kinds of numbers for every release (any and all ideas for how best to do this are welcome). One example would be that this year I completed missed the IndieDB “Game of the Year” voting competition, and next year I’m going to be sure to mobilize a proper voting effort rather than being almost entirely absent from the internet over that period…

So there we go – hopefully I’ll be able to meet all these objectives, high though some of them are. Maybe I’ll write another entry like this a year from now and evaluate how it went and whether I have, indeed, achieved 1/5th of the above five-year plan? We’ll see. Either way, standard weekly URRpdates will resume next week with development starting on 0.7, I hope you all have a fantastic year, and thanks for everything.

Addendum: holy crap guys, thanks for the donations and support in the past week (especially JV, I don’t know if you want your name out there, but initials should suffice). They’ve been awesome.