Forum

OpenKatana AI

Discuss Artificial Intelligence and Bot programming.

Moderator: InsideQC Admins

OpenKatana AI

Postby hogsy » Thu Sep 27, 2012 12:54 am

Hey y'all!
I thought I'd start up this thread as somewhat of a diary on my work on the AI for OpenKatana. Sadly the AI is one of many things that I've left kinda last minute since I've been so focused on the engine and everything else I've just never found the time, and having to write up most of it from scratch isn't exactly too easy (though some old code has been brought over to save time so that's alright). I'll probably document various bits and bobs on what we're doing here so that others may either learn from our mistakes or offer their own input. Now the AI in OpenKatana is nothing special despite how I've often spoken about it like it is, that's mainly just to get people interested with what we're doing here and there's no point showing no enthusiasm about such things! Anyway right now it's rather late so I'll just jot up a few notes here and continue writing out the rest of this tomorrow at a more reasonable time. May I also add that I'm no expert in artificial intelligence and this is actually my first go at writing up some related stuff, though I must admit it's always been a keen interest of mine which is why I'm putting so much thought into it.
Things I'll go into in the following posts are the states, waypoints, emotions and relationship stuff and I'll update all this as I do more work and share ideas or thoughts I've had (again I'm no expert here).
Also for those that don't know what OpenKatana is, OpenKatana is a remake of the infamous Daikatana with our own twists, the project is both highly ambitious and we have access to pretty much everything from Daikatana's development to help us reach our goal.

OpenKatana uses a state-based system for each monster, these states are composed of two types and those are "think" states, and standard states such as awake, asleep or dead. The current list of states is as follows...
Code: Select all
   MONSTER_STATE_DEAD,         // Monster is dead
   MONSTER_STATE_AWAKE,      // Monster is awake
   MONSTER_STATE_ASLEEP      // Monster is asleep

Code: Select all
   MONSTER_THINK_FLEEING,      // Monster is fleeing
   MONSTER_THINK_ATTACKING,   // Monster is attacking
   MONSTER_THINK_WANDERING      // Monster is just walking around

It should be noted that there are a few "think" states that are yet to be added which were in an earlier iteration of this system so I'll add those in later. Anyway each state function should be fairly clear here and states are handled in the main think routine Monster_Think which handles both our monsters states, their associated think routines, any cases for our particular monster type or physical state (such as jumping) and even our monster emotions which I'll get into later. The outline here is really that emotions must not be modified in any external monster code and states must not be modified in any of the base monster code (other than in the functions Monster_SetState and Monster_SetThink, these are to prevent any possible conflicts between "think" states and standard states). With all that we have our basic state-based stuff.

After that we have a basic like / hate relationship check for each monster, this was initially planned to be a little more complex but for the sake of time I've kept it simple. Monsters are basically either good or bad, depending on that other monsters will decide to either attack, run, hide or whatever they need to do about the other monster that may be within their sight. What I have planned in the future is to have a list of predifined relations for each entity and if a particular entity is not on that relationship list and that monster is looking at it then his interest in that will increase, he'll approach and our relationship with that entity will be based on the response we get, but this feature is somewhat pointless in something like OpenKatana due to its fast-paced nature (but it's perfect for our next project) so that's on my list of future plans.
Code: Select all
   MONSTER_RELATIONSHIP_HATE,
   MONSTER_RELATIONSHIP_LIKE


And that's me beat for tonight. Tomorrow I'll talk about the emotions a little bit and some ideas involving that, even including some ideas I have for the future. I will also write about my work on writing out the prisoner monster and some challenges that have surrounded that. Thanks!
User avatar
hogsy
 
Posts: 198
Joined: Wed Aug 03, 2011 3:44 pm
Location: UK

Re: OpenKatana AI

Postby frag.machine » Thu Sep 27, 2012 3:05 am

Nice... A properly made Daikatana would be cool. Do you guys have a project page and/or screenshots ?
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2063
Joined: Sat Nov 25, 2006 1:49 pm

Re: OpenKatana AI

Postby hogsy » Thu Sep 27, 2012 12:46 pm

Yes we have a pretty poor IndieDB page set up but there isn't much on there to see...
http://www.indiedb.com/games/openkatana

There's also a QuakeOne thread about the project here...
http://quakeone.com/forums/quake-mod-releases/works-progress/8675-openkatana.html

And a Quake.de thread here...
http://www.quake.de/phpBB2//viewtopic.php?t=11867
User avatar
hogsy
 
Posts: 198
Joined: Wed Aug 03, 2011 3:44 pm
Location: UK

Re: OpenKatana AI

Postby gnounc » Fri Sep 28, 2012 4:50 am

Nice to see the thread make its way over here!
As an aside though, please throw in a few more linebreaks : )
User avatar
gnounc
 
Posts: 424
Joined: Mon Apr 06, 2009 6:26 am

Re: OpenKatana AI

Postby hogsy » Sat Sep 29, 2012 8:38 pm

Hehe I'll try. Love writing out huge blocks of text though ;)
User avatar
hogsy
 
Posts: 198
Joined: Wed Aug 03, 2011 3:44 pm
Location: UK

Re: OpenKatana AI

Postby leileilol » Sun Sep 30, 2012 2:07 am

A Daikatana that's properly programmed and with proper waypointing for the buddy AI would be a decent work.
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Re: OpenKatana AI

Postby raynorpat » Mon Oct 01, 2012 11:57 pm

Hi hogsy,

Stuff looks good, I will surely be keeping on eye on your project.
raynorpat
 
Posts: 27
Joined: Tue Feb 26, 2008 12:21 am
Location: USA

Re: OpenKatana AI

Postby hogsy » Tue Dec 11, 2012 10:09 am

It's been a while since I updated this, I stated various times that I'd update it soon but never really got round to it so I guess I'll make up for that now as best I can. Since I first made this thread a lot has changed but overall the concept has stayed the same so I'll mainly be talking about that.

Waypoints
Something that's getting a lot of attention and thought mainly relates to how monsters will navigate their environment, and while the system isn't completely finished yet it's so far being planned out to be totally dynamic. When a level is loaded, basic waypoints are automatically placed around the level at specific points such as the players spawn, each monster spawn and weapon positions, and these are pretty much "reference" points which are each given their own special flags which monsters can look out for such as WAYPOINT_ITEM, WAYPOINT_SPAWN and much more. When monsters start moving around however they will start placing out their own waypoints which will refine and reposition themselves overtime depending on the current state of affairs within the world which means that an environment can be pretty dynamic without effectively breaking the AI navigation within the level.
Currently the navigation code isn't entirely optimal but now that we're back on track I hope to work on it a bit more...

Items
The item system in OpenKatana has been somewhat overhauled over Quake's so that weapons can easily be assigned and handled by both monsters and players. This is mostly done with bots in-mind but may also be useful to monsters within the world as it means different weapon types can easily be modified and refined without having to specifically touch the monster itself, this could potentially make balancing the game more easy on our end and on top of that it also means weapons which are used by both monsters and players do not have to be written out again and again just so the code is specific towards every monster. This isn't anything I've experimented around with too much but again it's something we might look into doing.

Anyway that's all I can think of for now, be sure to keep an eye on our blog however as we sometimes post about progress over there...
http://oldtimes-network.com/
User avatar
hogsy
 
Posts: 198
Joined: Wed Aug 03, 2011 3:44 pm
Location: UK

Re: OpenKatana AI

Postby hogsy » Sat Feb 16, 2013 2:11 am

Quite a bit of a bump here I guess but I hope it's allowed. This is a post I recently made on my blog concerning the AI for OpenKatana which I hope a few of you will at least read and give some input on.

For those that would like to read it on the website then you can get to it via the link below, otherwise read on...
http://oldtimes-software.com/blog/archives/16

When I initially started work on the AI for OpenKatana I must admit I had no plan of how it'd develop and how It would piece together, so to be fair work on the AI for the game has been a little messy but then at the same time what we're doing is quite unique; as players play through a level our waypoint system will map out everywhere you go and everything you do constantly adjusting everything which then allows enemies within the world to easily track-down and follow the player wherever he may go. As most enemies in Daikatana had melee-based attacks this system is incredibly good for what we want to do and on top of that it turns out the waypoint system has other uses too as we recently found when working on a new gamemode for the project.

While the waypoint system is coming along great, however, we're still stumbling around somewhat in-regards to figuring out how the AI itself will fit together. How much should the base-AI system handle? How much should individual monsters themselves handle? Should certain things only be handled by the base-code so that each monster is consistent or should certain "overrides" be allowed within the monsters own code? And one of the most daunting questions for me is, how should the emotion system be handled as a whole? Because for those that don't know we're running a basic simulation of various emotions for each monster within the game so that each monster can get bored, scared and even excited but would a turret, for example, fear the player? Obvious answer is no and if anything a turret would simply be angry and nothing more. But of course right now the base-code which handles the emotions and other states does not take this into account, it does not care if the monster ranges from a huge massive monster to a little moving box. Another issue here is simply getting the right balance with each individual monster, and because of the way the emotion system currently works this is fairly difficult though to be fair I am currently heavily revising all this but it's still a huge dilemma.

Another interesting thing however are the relationships within the game. Unlike in Quake where every enemy basically hated the player, it's a little different here and we're perhaps handling this a little more intelligently than most games (though I'm not sure if it's going to be completely finished for OpenKatana). Each monster has a list of known monsters and their relationship with them, but in some cases they may encounter a monster they have not seen before in which case their relationship would be based on that enemies response (and that enemy could easily be the player). An enemy will respond to another monster they haven't met depending on the health, their own emotional state and the potential threat of that particular enemy, and if certain things are met then the two might team up or otherwise blow each other apart. While this system is still being worked on, it could result in some very interesting instances or potentially end up as being a small useless detail.

Thanks for reading!
User avatar
hogsy
 
Posts: 198
Joined: Wed Aug 03, 2011 3:44 pm
Location: UK


Return to Artificial Intelligence

Who is online

Users browsing this forum: No registered users and 1 guest