Forum

Quake AI diagrams

Discuss Artificial Intelligence and Bot programming.

Moderator: InsideQC Admins

Quake AI diagrams

Postby daemonicky » Thu May 12, 2011 10:30 pm

Oh page, where were you when I was browsing Quake C :) http://ai-depot.com/FiniteStateMachines ... tical.html

Does anyone have experience with making such nice diagrams out of some code? I think taht it would be cool to do it for arbitrary QuakeC, it can make it easier to orient in your code and easier for others to dive into it.
:)
User avatar
daemonicky
 
Posts: 185
Joined: Wed Apr 13, 2011 1:34 pm

Postby Sajt » Fri May 13, 2011 4:59 am

Those sort of diagrams are confusing :( The code is much easier to understand for me...
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Postby daemonicky » Fri May 13, 2011 11:57 am

Sajt wrote:Those sort of diagrams are confusing :( The code is much easier to understand for me...


I believe each person has its own way of understanding. BUt, I would really like to recommend you just getting to know some UML, I found some of them usable. They are quite obvious and they are standard.


I am a visual guy, so I like Venn diagrams, ERD ... I have done little coding in visual languages, but they appeal asi nice to me :
User avatar
daemonicky
 
Posts: 185
Joined: Wed Apr 13, 2011 1:34 pm

Postby frag.machine » Sat May 14, 2011 1:14 am

A state diagram would be cool to describe Quake's AI. But in a nutshell this is the monster "brain":
Code: Select all
1) do I have a movetarget ? If so, then I'll run self.th_walk towards it;
2) if not, I'll just hang on here running my self.th_stand function every 0.1 seconds(*), hopeffuly awaiting some player find me;
3) if I see a client, I'll set my .enemy field to point him, play my sight sound to show how pissed off I am, turn to him calling ai_face() and exec my self.th_run function;
4) if my self.th_missile is set and I have a clear path, I'll call it randomly;
5) if I am close enough and I have self.th_melee set, I'll exec it;
6) at any time, if somebody hurts me I may (or may not) play my pain animation and, if it has a different classname(**), I'll save my current value for self.enemy in self.oldenemy, set self.enemy with my agressor entity and go on;
7) if my health is below zero, I'm done. I play one of my cool death animations, turn non-solid(***) and eventually I'll drop a backpack with some goodies. If my health is too low, I'll just turn a rain of rotten meat giblets;
8) I am very stupid to deal with obstacles, specially long walls,  and human clients abuse this limitation in several ways. Also, I have no understanding of the world where I roam aimlessly: I use to avoid water, even small puddles that would be otherwise safe to cross on foot. I don't distinguish water from lava or slime, and gaps deeper than 32 Quake units are virtually show stoppers to me.


(*) some QuakeC coders (read: me mostly) may set higher frequencies to the standing AI. This requires handling animation in a independent timing;
(**) monster_army (and monster_enforcer IIRC) are the exceptions, they'll try to kill another of their kind;
(***) except of course if you're running some gibbable corpse mod :)
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: 2078
Joined: Sat Nov 25, 2006 1:49 pm

Postby Lardarse » Sat May 14, 2011 2:59 am

frag.machine wrote:monster_army (and monster_enforcer IIRC) are the exceptions, they'll try to kill another of their kind

Nope. Enforcers are "smart" enough not to.
Roaming status: Testing and documentation
User avatar
Lardarse
 
Posts: 266
Joined: Sat Nov 05, 2005 1:58 pm
Location: Bristol, UK


Return to Artificial Intelligence

Who is online

Users browsing this forum: No registered users and 3 guests