Wednesday, February 18, 2009

An AI that can express emotions

I've been trying to get my plan together for our lecture at GDC: Here

There's plenty of academic stuff I can go over, particularly models of personality, mood and emotion that you see in a lot of affective computing literature. That of course is pretty useful information in and of itself (great to get going if you're interested in learning more for yourself).

But I really wanted to get something so compelling and convincing for people to see that they simply couldnt ignore the subject. Right now there are plenty of people who really can't see the benefit of having thier agents express emotion. I can understand where they're coming from, given that its additional production effort that is taking you into unproven territory.

I'm just not entirely convinced that I can produce this artefact that is so utterly compelling that it changes how many in an industry views thier own efforts. Sure, there are people like Wil Wright saying that we need to explore this kind of game-space more and he's a pretty smart cookie after all. But you know how hard it is to convince someone that games dont simply have to be about killing?

Given that the Wii has expanded the market into new areas, you would think more experimentation in what is arguably the most profitable game segment ever (the simulation) you would expect more. But visit any game trailer site and look at the number of simulation games that aren't based on war and you'll see where I'm coming from.

Imagine trying to pitch a game involving the creation of the AI equivalent of a romantic comedy in the vien of "four weddings and a funeral" and you'll maybe see my problem. I think games have the potential for social and emotional simulation that may well be a huge underinvestigated role for games as a medium, yet I'm just not entirely sure I can create something convincing enough that people will see what that might look like.

Right now my demo looks awful, has models for basically what they had in sims 1 in terms of AI and has no compelling behavior that people can draw a line and say "yeah, I can see that would be fun to play". Without that obvious fun factor, I just don't see the thing being truly convincing to the game development community.

I'm going to try and consolidate my thoughts on the link between emotion and obvious game-related behavior over the next few days. So I can think of specific use cases and the passage of code that elicits the correct behavior selection and action from the AI that will demonstrate the potential of modelling emotion to extend the depth of reactions at least. There are so many fundamental philosophical questions that this whole thing brings up though. I mean if you'd have asked my wether I would have been reading Descartes this time last year, I'd have said definitely not. Now I'm reading about neuroscience, philosophy, acting, emotion research, psychology and iconography in order to get a handle on the real "meat" of this problem.

I think I need a lie down :)


Sunday, February 08, 2009

Behavior Tree XML

Previously I was working on parsing XML for the game entities and thought I'd continue through to actually parsing the AI setup from that effort. So now after a few hours work (which included a lot of refactoring and there's a ton left to do of that) I can now actually specify an XML file as part of the AIComponent specification in the GameObject's XML.

Here's a typical GameObjects XML:

Arrgh, it wont display XML! :)

Hopefully you can see here that the game object has a number of components. In this case, the AI component (a gamecomponent of type "AI") has a tree specified as another XML file. When I parse the AIComponent spec, I'm basically passing that xml file spec to the AIComponent, which instantiates the AIActor class with the given XML file, which then loads the Behavior Tree of the actor with it. Long winded, but certainly much more flexible than before.

Now I've got to refactor some of the blackboard code to do the same thing I think. Although I need to do more work there to allow arbitrary values to be added, queried and removed. CRUD as I believe the acronym goes.

So now I can play with different priority values easier. But its still not as flexible as runtime tweaking. I guess the next big step is to add Lua or some other scripting engine into the codebase. Can't say I'm a massive fan of Lua's syntax though, might try GameMonkeyScript or AngelScript.

The other option, is to make myself a network proxy interface and allow this kind of tweaking to work via the network. Essentially this means that I need an object attribute system (I already do) which then works transparently over a network, which is pretty simple. Then I just code a nice C# app that does remote inspection of the various objects+attributes and bobs your uncle. Or auntie if you have a weird family :)

Right, onwards..


Thursday, February 05, 2009

Snow day fun!

Hmm, seems like a semi-productive day. Snowing outside anyway so I wasn't going to go out

I got an XML parser sorted out for the game objects in my engine. Basically all game objects are component based (i.e they use aggregation rather than inheritance).

So now I have a bit more flexibility as I can save my test worlds in an xml file and have the world loader class simply load the world.xml file (or whatever) that defines all of the agents and other objects in the game.

Next up is to do the same for the behavior tree itself. I've already done an editor of sorts that I can knock into better shape for the XML creation of a tree, so its just a matter of using the excellent XMLReader library to parse in the BT itself. (Incidentally, if anyone is looking for an XML class that does the business, I am preferring this one to TinyXML, which I've also used in the project).

Fun thing is that I got libCurl setup yesterday to pull a spreadsheet from google docs as XML, I can then feed this into the world loader class and theoretically I can actually distribute my game "levels" via google!

I also wasted an hour or two looking at the various video capture software to try and record a video of the app (its not really a game yet). Tried wegame, guncam, fastcampro but of course fraps is the only really useful solution outside dumping raw frames and using something like premiere to turn that into a video. Fraps did a bloody good job of recording 720p video from the game, but unfortunately windows movie maker bites at encoding. But it was good fun splicing a few shots together and titling it all. Although I think the footage looks bad enough that I'll keep it to myself for posterity.

I also packaged up a .zip file of the game today to see how trim I can get it. A quick purge of some of the nvidia texture library from my media folder and I'm down to an 8meg zip file. If I were a bit more aggressive about pruning I think about 5-6meg is probably achievable. Not the ideal download, but then most of it is Ogre libraries, which now I think about it, I can mostly do without.

Anyway, a productive fun day doing some general AI coding and engine schlok and having fun making dumb movies to amuse myself. Life is good when it snows!!!