Idea: AI Lib

Discuss Artificial Intelligence and Bot programming.
FrikaC
Site Admin
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Idea: AI Lib

Post by FrikaC »

Looking at QuakeMatt's Gyro II post, what do you guys think about an AI lib. What should or could it include?

Obviously bots are one thing, but I think there's quite a few other applications for AI, monsters not least among them. Also could be handy in mods like Minion Arena. Although AI tends to be very specific... I dunno, just an idea I'm tossing out there, see if anyone has any ideas on the topic.
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Post by leileilol »

a frig around feature, where monsters wander randomly, sort of like the figgin thing.

also the added ability to patrol in where they think they saw, so you could like waltz behind a crate before the enemy tracks you into the room, so he just runs forward into the next door running past you

and then forgetting about you

and a "hostage" feature where when provoked, they will attack and kill the entity in its "grudge" .entity field. It could also be used for running and setting off alarms on provoked, so they'll run to the button and press it, or shoot it if it's shootable.

you could make qeus ex lol

we're talking about monster ai, right
i should not be here
FrikaC
Site Admin
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Post by FrikaC »

I suppose. I really kinda asked for routines & features that would aid in creation of AI opponents, not really a prepackaged AI replacement for monsters. Much the same ways Gyro II has physics features that can be applied to objects.
Quake Matt
Posts: 129
Joined: Sun Jun 05, 2005 9:59 pm

Post by Quake Matt »

Generic but powerful AI routines, you mean?

I think it'd be great to have waypoint functions that handle navigation behind the scenes, and a cover-finder would be handy in all sorts of situations.

Obviously, all sorts of other niceties could be included, like target-leading functions, projectile detection (and avoidance) and even camp-spot-finders!
scar3crow
InsideQC Staff
Posts: 1054
Joined: Tue Jan 18, 2005 8:54 pm
Location: Alabama

Post by scar3crow »

I would say automatically bundle a good waypointing system to work with, ala FBX.

From there you can have numerous things such as roaming controllers, or take a note from Q2 (I think) and have the player make a waypoint whenever he rounds the corner for the sake of better monster pursuit.

Appropriate target leading code for all manners of projectiles.

A concept of cover (this could be done by checking near by waypoints, and then crossreferencing it with the players position to see if there are obstacles between the player and the goal waypoint).

Intelligent checking for ledges that is sensitive to the player and the monsters ability (fiends should have no qualms leaping from a bridge).

Concepts of defense, so you can set a shambler that will not stray from the key.

Renegade's check for plat so monsters dont get stuck under func_plats or such.

Are we talking just monsters/bots or more generally?
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Post by Dr. Shadowborg »

I'd say scar3crow pretty much hit the nail on the head. I'd been pondering such things myself for TAKOP, but have been procrastinating on doing anything because I know it's gonna be a pain in the ass. (AI is definatly not my forte...)
scar3crow
InsideQC Staff
Posts: 1054
Joined: Tue Jan 18, 2005 8:54 pm
Location: Alabama

Post by scar3crow »

Another thing that could be nice would be different movement types, more specific ones, namely for flying and swimming, as it seems at current everything is just treated as some kind of walking, regardess of where the ground is.

It would be nice to see rotfish and scrags acknowledge the range of movement they have.

What about hearing? A conceptual sense of monsters being sensitive to splashes, the player landing thud, or the player's pain sounds.
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Post by Dr. Shadowborg »

Additionally, if the waypoint system could be implimented in a style similar to FBX's (so pre-exisiting maps could be enhanced) but be able to coexist with FBX as well via some sort of deathmatch check.

Though this probably would break FBX coop compatability...
scar3crow
InsideQC Staff
Posts: 1054
Joined: Tue Jan 18, 2005 8:54 pm
Location: Alabama

Post by scar3crow »

I would like to see for any npc, be it monster or otherwise, to make use of the Target Stack system used in FBX, this could be useful for creatures facing coop players, and for perhaps chain events of scripts with an ai intervention.

One simple change that would be nice would be to actually have by default doors, switches, plats, teleports etc as triggerable by monsters, but you can specify in the entity to not be triggerable by them. Thus the monsters could use this along with target stack... It would be awesome in e1m3 to see the ogres drop down from the overhang near the exit... the player flees (their leading grenade shots) around the corner to the tower where he presses the switch, barring him in and initiating the false trap. Outside, a wall panel opens and a slipgate to the top is revealed... Having an ogre use that to be waiting for you would be freaky - or worse, start firing grenades down into the shaft as you rise up.

Honestly one of the best things for a general ai experience, though not really ai, is in DPmod LordHavoc has enemies jumping off ledges when they get near the edge... It is a bit automated but aside from notarget/intermission, it is unlikely you will see it without them attacking you. And I can say from personal experience, it is terrifying to see a shambler leap off the bridge in e4m4 to smash you (he killed both LordHavoc and I, it ambushed us, literally).

One other good thing to see would be grouping and scattering ai. Monsters that move together while searching, but so as to not get boxed up in a room (establish a leader, make way for him if youre between target and him) as well as spreading out on encountering an enemy, as opposed to staying bunched up remaining ripe for rockets.
RenegadeC
Posts: 391
Joined: Fri Oct 15, 2004 10:19 pm
Location: The freezing hell; Canada
Contact:

Post by RenegadeC »

Cover would be fun to code without waypoints, there's several approaches. Here's one that just floated into my head ..

I would try spawning an entity as a 'check point', so the monster may throw a invisible entity it's size (this is important) in a random direction (random direction isn't the best method however, I'm sure a better one could be devised, if anyone has a better idea say so as I can't think of one), the entity then checks if the player can see it with a 'visible' check ran on the actual player, and then returns to the monster either TRUE or FALSE if the player saw it then return TRUE, otherwise return FALSE. If false then store the origin of the entity in a vector then remove the entity and start moving the monster to the origin point of the check entity from the vector..

Fun stuff!
RenegadeC
Posts: 391
Joined: Fri Oct 15, 2004 10:19 pm
Location: The freezing hell; Canada
Contact:

Post by RenegadeC »

Another thing, flying monsters should fly using more realistic flying AI routines.. which would also seem smoother .. TAoV's flying creatures fly using velocity and it'd be pretty cool to see a Scrag doing the same (this would make them harder to hit also as they're movement is more dynamic); however, since it uses velocity based movement it's harder to stop the monster from getting stuck (Since TAoV is more of a 2D plane this isn't a big deal, it would be in normal Quake however) .. if anyone's interested in this I'll post the code!
scar3crow
InsideQC Staff
Posts: 1054
Joined: Tue Jan 18, 2005 8:54 pm
Location: Alabama

Post by scar3crow »

Ren - Good stuff, it wasnt until today that I had heard the concept of throwing entities with the same size as the thrower to check dimensions, but it seems so cool to me. However instead of a random direction, they could try within 180 degrees of their field of vision, so they try first in a place they can "see", still kinda random, but not quite as random.

As for flying, yes, though I would say the same could be done with swimming, so it would be more a 'lowerlimitedcontent' movement than just flying (I would love to see a underwater monster with the movement of the Ichtyosaurus, one of the few things HL did right). Rotfish could be much more dangerous simply if they did make use of the full degree of motion in the water (especially if they could dart to attack... quickly nibble off some health). An idea that would be applicable at least in new maps would be a brush with a cliptexture and a "fluid motion" tag, and if a flying or swimming monster is in that, it uses that movement code... So the scrags outside in e1m5 would be quite the threat, whereas the one at the start of e1m4 (assuming Normal skill) would use conventional motion as there is little room. Good fun.
LordHavoc
Posts: 322
Joined: Fri Nov 05, 2004 3:12 am
Location: western Oregon, USA
Contact:

Post by LordHavoc »

Just wanted to point out that there are some useful bot AI functions in my Nexuiz port of dpmod havocbot, I've reorganized it a lot to be even more plugin than it was before, and separated the havocbot AI from the general utility functions.

Its concept of waypoints is not very efficient though, manually linking (ala frikbot) and saving the waypoint links would load faster.

Also there's a known bug with tracewalk sometimes returning success when it shouldn't (but only during the code that finds nearby waypoints to start a navigation update), I haven't figured out why.

Some other things worth considering (which my waypoint linking does not consider) are jumping over gaps (such as lava/slime pits), jumping off ledges (as opposed to just falling off them), buttons to open doors, etc, frikbot does these quite well but I'm not sure its navigation would be very portable to monsters.

My code does however automatically create teleporter and jump pad waypoints with proper one-way links, and the items spawn waypoints (which in a few levels are enough for bots to navigate a level without any extra waypoints).

Sorry, rambling, just thought I should point out this code incase it helps anyone developing such an AI lib.

Here's the main code:
http://svn.icculus.org/nexuiz/trunk/dat ... iew=markup

havocbot AI:
http://svn.icculus.org/nexuiz/trunk/dat ... ?view=auto
havocbot game-mode AI:
http://svn.icculus.org/nexuiz/trunk/dat ... ?view=auto
FrikaC
Site Admin
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Post by FrikaC »

Some really great ideas here. I'll have to mull it over. Though none of these really fit with the idea of an AI Lib. We're more or less talking about "Stroggs Gone Mad" for Quake.
scar3crow
InsideQC Staff
Posts: 1054
Joined: Tue Jan 18, 2005 8:54 pm
Location: Alabama

Post by scar3crow »

Ive wanted Shamblers Gone Mad for years.

More so then any other mod for Quake.
Post Reply