Download

BLOG       DOWNLOAD/ABOUT         LINKS         CONTACT

23 November 2014

Thinking Out Loud

Development of LoSt is seeing another burst of activity, be it long or short. On the top of my old todo list was to get a decent "AI" (or, call it, action determination system) up and going for NPCs and enemies, so that's where I'm at now.

A golden rule to keep in mind when developing NPC/critter behavior is that the actors need to be "thinking out loud" to a certain extent. It's easy for a developer to fall in love with a system where there's a lot of hidden stuff going on, stuff the player simply won't notice. In many situations, simple hacks are better than complex algorithms. Making changes in the code will also have more predictable results if you're using simple rules (a fixed probability to flee/fight as opposed to a function that takes into consideration factors like relative health and strength of the opponent).

Truly believable characters may come off as bland; a fictional person is much more easy to make memorable if defined by traits underlined to an almost absurd degree (consider the monomaniac ramblings of Captain Abab or The Red Queen in Alice; the archetypical nice naughtiness of someone like Little My (in the Moonmin books) or Pippi Longstockings; the sincere stupidity of Sancho Panza. Examples that might hit closer to home include the conspicuous inclination of pixies/leprechauns in traditional Rogue-games, or how that pesky puppy in ADOM ceaselessly gets into fights with ogres and worse).

I'm basing my "AI" system of how I did it in my abandoned Roguelike Squirm. Each actor is always in a certain state, which dictates the actor's behavior (eg. "hungry-at-home" state: if there is food on the table, eat it, else go to "cook-and-put-food-on-table" state). The personality of any actor is really contained in the sum of states that actor is capable of being in, as well as (what I call) the "bias switches" used to switch the state of the actor, depending on what it observes on the map. It is a quite flexible system for tactical behavior (switching between different attacking/defending states, so that some goon might keep her distance, seeking cover and firing a gun, maybe turning to run if she gets hit herself, whilst man-eating big-dogs might hunt in packs, aiming to surround their victim and go for the throat) as well as functional or even choreographic (going to the doctor if you've been shot in the leg; frequenting the railway station to proclaim the villainies of villains and handing out cash bounties to said villains' vanquishers; heading to the saloon with a loaded gun to settle all your debts once and for all).

The whole thing borrows heavily from Bear's Roguelike Intelligence articles on Roguebasin. Andrew Doull's essays about developing Unangband was also a huge inspiration back at the time I was developing Squirm.

Right now I'm just testing it with a desert stray dog, quite ineptly identified by the game as "a dog, holding teeth". It starts out in a "wander" state, which just loops endlessly, with the dog always walking in a random direction. Its sole cause in this world is self-preservation: if someone (presumably the player, being the only other living thing in this infinite desert) inflicts damage upon it, it fights to the death.

I might test this further with some more desert life (I have a prototype for randomly generated plant species lying around), but I'll soon be delving back into the lead mines to develop the slave break scenario a bit more. It's a pretty fruitful scenario to use for early development. It involves some fighting, possible even between two groups (slaves and owners, if it turns into a real uprising), which is good to get a lot of technicalities in place. There will also definitely be some talking, and I hope to develop at least the slave community as an interesting part of the setting/theme, with their own rumors and rituals, staying pretty small while hinting at larger issues.

As always,
Minotauros

No comments:

Post a Comment