[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - Coding Frikbots to be scared of heights

Coding Frikbots to be scared of heights

Discuss Artificial Intelligence and Bot programming.

Moderator: InsideQC Admins

Coding Frikbots to be scared of heights

Postby Lightning Hunter » Wed Mar 19, 2014 9:43 pm

Does anyone here know of a way to code Frikbots to be afraid of falling off ledges during a fight? The biggest reason why Frikbots commit suicide and/or get stuck is because they jump off ledges when they see another bot/player. This gets them off course, and they attempt to get back up to where they were before the battle started (and they run in to a wall or jump off a cliff as a result). In maps with a void, the bots will consistently run to their death while attempting to charge a bot/player. The way I see it, all of these problems would be resolved if the bots simply refused to jump off ledges unless a waypoint told them to do so. Otherwise, they commit suicide and get stuck far too often. In Unreal Tournament, bots will shoot down at players standing near an edge, but will not jump down to join a fight unless a waypoint is nearby that allows them to do so. With the Frikbots, they charge forward during a battle regardless of what the waypoints tell them to do... This results in many suicides in void maps, and also results in bots getting stuck up against walls.

Here is an example video showing the Frikbots suiciding almost non-stop in a map called "Coagula2". This map was waypointed by me. The bots will navigate the map flawlessly when they are alone (no suicides at all). As soon as other bots are added however, they constantly jump to their deaths while attempting to charge other bots across gorges and off ledges:
http://www.youtube.com/watch?v=8UEtncOZA0o

Anyone have any ideas? I think the Frikbots would get stuck and die significantly less if this issue were resolved.
User avatar
Lightning Hunter
 
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Coding Frikbots to be scared of heights

Postby leileilol » Wed Mar 19, 2014 10:57 pm

Probably a double traceline check - a traceline forward some 128 units, and then from there a traceline down, and then detect contents progressively upward for hazards
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Re: Coding Frikbots to be scared of heights

Postby Lightning Hunter » Thu Mar 20, 2014 12:24 am

User avatar
Lightning Hunter
 
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Coding Frikbots to be scared of heights

Postby frag.machine » Thu Mar 20, 2014 11:22 pm

Be careful. traceline is among the most expensive builtins in QuakeC, CPU wise. Adding 2 tracelines per bot every time they move (tipically every 1/10th of second) can affect the general game performance.

And not trying to troll or start a flame war, but this is one of those occasions where navigation meshes would be useful. ;)

/me ducks for cover :P
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: 2120
Joined: Sat Nov 25, 2006 1:49 pm

Re: Coding Frikbots to be scared of heights

Postby Lightning Hunter » Thu Mar 20, 2014 11:43 pm

User avatar
Lightning Hunter
 
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Coding Frikbots to be scared of heights

Postby qbism » Fri Mar 21, 2014 1:14 am

This piqued my curiosity, and I'm a Definitive Waypoint fan, so I tried digging into the Frikbot functions. I don't have an answer but maybe have narrowed-down the issue.

frik_obstacles is the only check for ledges and is called from BotFrame. frik_dodge_obstruction is called from frik_walkmove and frik_movetogoal. frik_dodge_obstruction does just that (and recognizes plats) but does not detect ledges. During combat bot_fight_style calls frik_walkmove, so I guess this is why bots in combat walk around columns but ignore cliffs.

Comment from frik_dodge_obstruction:
// perform a walkmove check to see if the obs_dir is still obstructed
// walkmove is less forgiving than frik_obstacles, so I dunno
// how well this will work

Could this function be improved to check ledges? Perhaps it was left out for performance. But is it really noticeable?
User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Re: Coding Frikbots to be scared of heights

Postby Lightning Hunter » Fri Mar 21, 2014 11:27 pm

User avatar
Lightning Hunter
 
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Coding Frikbots to be scared of heights

Postby Dr. Shadowborg » Sun Mar 23, 2014 6:55 pm

Upon some consideration of this, some ideas on solving this:

1. Two traceline check is too expensive and imprecise.
2. engineside walkmove stuffs IIRC can cause issues going over mesh / hole filled floors. (as in, they will refuse to go over them)

Lower expense options:
1. Avoidance Markers and triplines.

Avoidance marker: Basically a marker / lighthouse entity that the frikbot looks for and stays the heck away from. Perhaps definable avoidance radius? IIRC, frikbots are already programmed to avoid certain entities like grenades, so this is in theory easy to impliment... Entity load could be significant though.

Tripline: Basically an entity that has an angle set along a course (following a ledge) or perhaps a special waypoint chain. Frikbot would check it's surroundings for these, then perform a dual vlen distance check, if the bot is too close, then instruct the combat AI to veer away from vectors in this direction.

Dual vlen distance check:
1. If danger entity / entity chain is found, go distance of frikbot from entity along the defined angle direction, then perform a second vlen distance check from that point. If bot is too close, combat AI is instructed to move away from this point.

I don't have time at the moment to make the code for this, so I'm just submitting it as some ideas / proposals for you or somebody who wants to help with it. If I have time later, I'll try to see what I can come up with. :wink:
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Re: Coding Frikbots to be scared of heights

Postby Lightning Hunter » Sun Mar 23, 2014 7:37 pm

User avatar
Lightning Hunter
 
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Coding Frikbots to be scared of heights

Postby qbism » Wed Mar 26, 2014 3:32 am

User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Re: Coding Frikbots to be scared of heights

Postby Lightning Hunter » Wed Mar 26, 2014 4:13 am

Hi Qbism, thank you for helping. :)

I modified the code you suggested, but the bots still seemed to fall to their deaths quite consistently in void maps. If you decide to modify the code further, I recommend you download this map:

If you add just one bot in Coagula2, it will rarely, if ever, fall in to the void. However, as soon as you add more than one bot, they jump to their deaths constantly while battling other bots. It's a good map to test any code changes you attempt. :)
User avatar
Lightning Hunter
 
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Coding Frikbots to be scared of heights

Postby qbism » Wed Mar 26, 2014 2:47 pm

Sorry that it didn't help. I'll look at it again with that void map when I get a chance. In dm4 I guessed (without looking at the waypoints) that bots were attempting to jump to catwalks but maybe just walking off ledges and sometimes getting lucky!

quake2 has an invisible 'nomonster' brush that is an obstacle to monsters. A 'nobot' brush might be nice for frikbot.
User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Re: Coding Frikbots to be scared of heights

Postby Lightning Hunter » Wed Mar 26, 2014 4:40 pm

User avatar
Lightning Hunter
 
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Coding Frikbots to be scared of heights

Postby qbism » Thu Mar 27, 2014 5:50 am

Can't judge this by the function name... frik_obstacles also looks for gaps and decides if they're jumpable. Obviously, though, just replacing the function is not enough to keep bots from backpedaling or strafing right over the furthest edge of the map.
User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Re: Coding Frikbots to be scared of heights

Postby qbism » Fri Mar 28, 2014 12:47 am

Last edited by qbism on Fri Mar 28, 2014 9:59 pm, edited 2 times in total.
User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Next

Return to Artificial Intelligence

Who is online

Users browsing this forum: No registered users and 1 guest