Frikbot Item desirability

Discuss Artificial Intelligence and Bot programming.
Post Reply
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Frikbot Item desirability

Post by Lightning Hunter »

Dr. Shadowborg wrote: Nothing indepth as yet, but cursory examination seems to indicate that B does not have frik_file support, C does, and fbx+ also has frik_file support. Igor9 appeared to have added randomized player spawns which go beyond the scope of the actual frikbot code itself.
That reminds me, I believe the map cycling feature was broken in Igor9's version of the Frikbots, but was fixed in my version (Map cycling meaning randomized maps that are picked at the end of each match using maps.cfg). Someone else fixed it, and I added the code - but I can't remember where the code was now (client.cfg maybe?). Could you make sure this fix is applied?

Also, randomized player spawning is a great feature that I believe should be kept - but I was wondering if it's at all difficult to add another feature that causes bots/players to spawn a certain distance away from other bots/players. This feature was added to NewDM, but unfortunately does not have a source code. This feature would prevent easy killing of bots that just spawned. It would also prevent the frustration of being spawn-killed by bots. The code should randomly choose a starting point, but skip any starts that are within a certain distance to bots or players.
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Re: Frikbot Item desirability

Post by Dr. Shadowborg »

Okay, that was a pain in the ass.

Also, it's not perfect, it smells of "I have almost no idea what I'm doing", but, try this:

At the very bottom of bot_misc.qc, add:

Code: Select all

/*
==============================================

DRS_GrenadeEnergy

Based off PM_GrenadeFly from Patrick Martin's CRANKED Mod
Returns z energy required to hit target using grenades

==============================================
*/

float(float dist) DRS_GrenadeEnergy =
{
        local   float   gravity;      // Gravity -- g = 1 is Earth gravity.
        local   float   basepower;   // This dictates how fast the projectile flys upward

//------------------------------------------------------//
//  800 is normal (Earth) gravity.  800 * 0.00125 = 1.  //
//------------------------------------------------------//
// DRS Fixme: Also check for self.gravity in mods.

        gravity = (cvar("sv_gravity")) * 0.00125;   // Find gravity in terms of g.

        if (dist > 900)       basepower = 200+((dist - (200 - (dist * 0.2)))*0.5);
        else if (dist > 700)  basepower = 200+((dist - (200 - (dist * 0.15)))*0.5);
        else if (dist > 500)  basepower = 200+((dist - (200 - (dist * 0.1)))*0.5);
        else if (dist > 350)  basepower = 200+((dist - 200)*0.5);
        else                  basepower = 0;
		
		return (basepower * gravity);
};
Next, in bot.qc, right above the // editor stuffs:

Code: Select all

// DRS: Extra shizz here
float(float dist) DRS_GrenadeEnergy;

// editor stuffs
Next, in bot_fight.qc, replace weapon_range with this:

Code: Select all

vector(float wep) weapon_range =
{
 local vector returnvalue, grendist;
 local float heightdiff;
 
	if (wep == 4096) // IT_AXE
	 returnvalue = '48 0 64';
	else if (wep == 1) // IT_SHOTGUN
	 returnvalue = '128 8 3000';
	else if (wep == 2) // IT_SUPER_SHOTGUN
	 returnvalue = '128 0 3000';
	else if (wep == 4) // IT_NAILGUN
	 returnvalue = '180 0 3000';
	else if (wep == 8) // IT_SUPER_NAILGUN
	 returnvalue = '180 0 3000';
	else if (wep == 16) // IT_GRENADE_LAUNCHER
	 {
	  returnvalue = '180 48 512';
	  
	  if(self.enemy != world)
	   {
	    heightdiff = self.origin_z - self.enemy.origin_z;
	    grendist = normalize(self.enemy.origin - self.origin);
		grendist = grendist * 600;
	    grendist_z = grendist_z + DRS_GrenadeEnergy(vlen(self.enemy.origin - self.origin));
	    if(vlen(grendist) > 600 && heightdiff > 0)
		 {
		  returnvalue_z = returnvalue_z + rint(heightdiff*2);

		  if(vlen(grendist) > 600)
		   returnvalue_z = 512;
		 }
		 dprint(ftos(rint(heightdiff)));
		 dprint(" heightdiff\n");
	   }
	 }
	else if (wep == 32) // IT_ROCKET_LAUNCHER
	 returnvalue = '180 48 3000';
	else if (wep == 64) // IT_LIGHTNING
	 returnvalue = '350 0 512';
  
  return returnvalue;
};
Lastly, in bot_ai.qc, replace your bot_angle_set with this:

Code: Select all

void() bot_angle_set =
{
	local float h;
	local vector view, voffset;
// DRS: Originally supa, tweaked again by me
    local vector offset;
    local float offset_amt;
	
	if (self.enemy)
	{
		if (self.enemy.items & 524288)
			if (random() > 0.01)
				return;
		if (self.missile_speed == 0)
			self.missile_speed = 10000;
		if (self.enemy.solid == SOLID_BSP)
		{
			view = (((self.enemy.absmin + self.enemy.absmax) * 0.5) - self.origin);
		}
		else
		{
		
			local float levels;
			
			levels = 3;
			
			view = self.enemy.origin;
			
			while (levels)
			{
				h = vlen(view - self.origin) / self.missile_speed;
				if (self.enemy.flags & FL_ONGROUND)
					view = self.enemy.velocity * h + '0 0 -20';
				else
					view = (self.enemy.velocity - (sv_gravity * '0 0 1') * h) * h;
				view = self.enemy.origin + view; 
				traceline(self.enemy.origin, view, FALSE, self);
				view = trace_endpos;
				levels = levels - 1;
			}

// Supa - really simple aim offset code here, thanks to Wazat for inspiration =)
			if(self.weapon == IT_SHOTGUN || self.weapon == IT_SUPER_SHOTGUN)
			 {
// DRS: I assume the below commented out thing is for rocketlauncher
// headshots O_o
//             if (self.weapon == 32) 
//               view = view - '0 0 22';

// DRS: offset wierdness with rocket launcher removed
// because it probably didn't do anything

             if(self.b_skill == 0) 
			   offset_amt = 55;  //110
             else if (self.b_skill == 1) 
			        offset_amt = 45;  //80
             else if (self.b_skill == 2)
			   offset_amt = 36; //60
             else if (self.b_skill == 3)
			   offset_amt = 15; //0

             offset_x = crandom() * offset_amt;
             offset_y = crandom() * offset_amt;
             offset_z = crandom() * offset_amt;

             view = normalize((view + offset) - self.origin);
// Supa end
			}
		   else if(self.weapon == IT_GRENADE_LAUNCHER && ((vlen(self.enemy.origin - self.origin) > 350) || ((self.origin_z - self.enemy.origin_z) < 0)))
		    {
			 local float maxgrenrange;
			 local vector grndir;
			 maxgrenrange = 512;

             grndir = normalize(view - self.origin);//normalize(self.enemy.origin - self.origin);
	    	 grndir = grndir * 600;
		     grndir_z = grndir_z + DRS_GrenadeEnergy(vlen(self.enemy.origin - self.origin));
		
		     view = normalize(grndir);
			}
            else view = normalize(view - self.origin);
		}
		view = vectoangles(view);
		view_x = view_x * -1;
		self.b_angle = view;		 
	}
	else if (self.target1)
	{
		view = realorigin(self.target1);
		if (self.target1.flags & FL_ITEM)
				view = view + '0 0 48';
		view = view - (self.origin + self.view_ofs);
		view = vectoangles(view);
		view_x = view_x * -1;
		self.b_angle = view;
	}
	else
		self.b_angle_x = 0;
	// HACK HACK HACK HACK
	// The bot falls off ledges a lot because of "turning around"
	// so let the bot use instant turn around when not hunting a player
	if (self.b_skill == 3)
	{
		self.keys = self.keys & 63;
		self.v_angle = self.b_angle;
		while (self.v_angle_x < -180)
			self.v_angle_x = self.v_angle_x + 360;
		while (self.v_angle_x > 180)
			self.v_angle_x = self.v_angle_x - 360;

	}
	else if ((self.enemy == world || self.enemy.movetype == MOVETYPE_PUSH) && self.target1.classname != "player")
	{
		self.keys = self.keys & 63;
		self.v_angle = self.b_angle;
		while (self.v_angle_x < -180)
			self.v_angle_x = self.v_angle_x + 360;
		while (self.v_angle_x > 180)
			self.v_angle_x = self.v_angle_x - 360;
	}
	else if (self.b_skill < 2) // skill 2 handled in bot_phys
	{
		if (self.b_angle_x > 180)
			self.b_angle_x = self.b_angle_x - 360;
		self.keys = self.keys & 63;

		if (angcomp(self.b_angle_y, self.v_angle_y) > 10)
			self.keys = self.keys | KEY_LOOKLEFT;
		else if (angcomp(self.b_angle_y, self.v_angle_y) < -10)
			self.keys = self.keys | KEY_LOOKRIGHT;
		if (angcomp(self.b_angle_x, self.v_angle_x) < -10)
			self.keys = self.keys | KEY_LOOKUP;
		else if (angcomp(self.b_angle_x, self.v_angle_x) > 10)
			self.keys = self.keys | KEY_LOOKDOWN;
	}
};
As I said, its not perfect, but it's better than what they started with.
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Frikbot Item desirability

Post by Lightning Hunter »

Holy moly! That's a lot of code for grenade launcher aiming. Now I can see what you mean when you said it would be difficult. :shock: Out of curiosity, did you change any other weapons for range, or just the grenade launcher?

Hopefully I added all the code corretly. Things do seem to be working much better. The bots indeed switch to a shotgun or something else when they are too far away. There are only two things I noticed after observing the bots for a bit:

-The range could be increased a bit more for the grenade launcher. I know you probably have the range set at the exact physical distance it can shoot, but I think the bots should switch to the grenade launcher a bit sooner when they are engaging in battle. Grenades also bounce, so there is a chance the first grenade might hit, even if they are slightly out of range.

-I'm not sure if you can fix this or not, but I noticed that once bots engage in a battle, they don't really switch their weapon until the battle is over. For example: Bot A spots Bot B across a large map. Bot A has a grenade launcher in his inventory, but is out of range of Bot B. Bot A switches to the standard shotgun since Bot B is out of range. However, as Bot A gets closer to Bot B, he continues using the shotgun instead of switching to the better choice of the grenade launcher. I think bots get "stuck" using whatever weapon they start with during a battle, and refuse to switch based on conditions (unless they pick up a weapon during a battle, which auto-switches for them). Bots don't use the grenade launcher often in a large open maps even if they get close enough to other bots, because they start the battle with some other weapon.

Otherwise, the code is indeed much better. :)
gnounc
Posts: 428
Joined: Mon Apr 06, 2009 6:26 am

Re: Frikbot Item desirability

Post by gnounc »

Time to code bots bouncing grenades off of walls as they bunnyhop by!
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Frikbot Item desirability

Post by Lightning Hunter »

Hey Shadowborg, I found a small map that often has the teleport bug AND the precision bug. I can't guarantee you will always see both bugs occur, but I saw one or the other happen quite a few times. Some of the teleporters have a waypoint before them with the "precision" flag enabled. The bots will often keep precision mode on, even after they have passed several waypoints that don't have the flag (as if they forget to turn it off).
http://fbe.am/u6o
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Frikbot Item desirability

Post by Lightning Hunter »

Shadowborg, if I haven't already scared you off with these requests, I have another small one that has to do with rocket launcher aiming (or lack thereof). I noticed that even on skill 3, the Frikbots kill themselves frequently with the rocket launcher (most of their suicides have to do with this). They will sometimes randomly point straight down at the ground and fire, taking away 75 health or so in the process if they aren't already dead. There seems to be no excuse for them to do so (no obstacles and no reason to shoot at the ground). It looks as if the bots are attempting to perform a rocket jump in the middle of a battle, but with no rocket jumps nearby. I'm pretty sure it is just faulty aim code with the RL. You can see this behavior consistently in the Fragtown series, which I uploaded for you here: http://fbe.am/u7v

By the way, if you ever get stuck on one of these requests (or if it's taking too long), feel free to move to another. I know that not all of this stuff will be able to be fixed. Any improvements at all will make for a better release. In fact, I've already noticed improvement with the z-axis traceline increase. I am currently going through all 700 maps that I've already waypointed, and am making sure all the lava-based maps work properly with this new update. I realized that not all the maps have blind flags turned on to allow bots to jump over lava pools from great heights. This prevented the bots from jumping off ledges. I really want this new code to stay in place, so I am updating all the lava maps (which might take several weeks).
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Re: Frikbot Item desirability

Post by Dr. Shadowborg »

Not scared off, just kinda busy in RL.

Took a quick look, found out skill 3 is br0ked. Actually, all skills except perhaps skill 0 are kinda br0ked by default. On skill 3, they *should* be using the same emulated mouse aiming code that skill 2 uses, but instead they use the "bad keyboarder" emulation to aim. (this is coming from me, a guy who actually plays ALL his FPS games as a keyboarder :wink: )

This also means that Supa's shotgun "aim jitter" doesn't actually work quite the way it should on any skill OTHER than 2.

Use this until I can post the "fixed aiming code for everything and all skills":

In bot_phys.qc, within CL_Keymove() replace this:

Code: Select all

if (self.b_skill != 2) // use mouse emulation
With this:

Code: Select all

if (self.b_skill < 2) // use mouse emulation
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Frikbot Item desirability

Post by Lightning Hunter »

Wow, I'm glad you are checking this stuff!

I replaced the code you mentioned just now, but did see the bots continue to shoot themselves with the RL on skill 3. It almost looks intentional at times, as if they are attempting a failed rocket jump mid-battle. I think of all the bugs we have discussed, the RL aim takes the top priority. I am looking forward to seeing what you do. :)
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Re: Frikbot Item desirability

Post by Dr. Shadowborg »

Lightning Hunter wrote:Wow, I'm glad you are checking this stuff!

I replaced the code you mentioned just now, but did see the bots continue to shoot themselves with the RL on skill 3. It almost looks intentional at times, as if they are attempting a failed rocket jump mid-battle. I think of all the bugs we have discussed, the RL aim takes the top priority. I am looking forward to seeing what you do. :)
Quick Update: This is proving to be a rather tough and vexing bug to squash. (Mostly because it doesn't happen near frequently enough to properly track down, but more than frequently enough to be quite broken) I've isolated it to the fact that they are allowed to cheat by "insta-looking" at their target / enemy. What I can't figure out is why the heck they sometimes get angle bugged and somehow think that their enemy is straight below them. Still debugging...

Heres something to make them weapon masters in the middle of fights:

In bot_fight.qc, within bot_fight_style(), place this right before if (foedist > v_y && foedist < v_z)

so that it looks like this:

Code: Select all

	// DRS: Select optimal weapon during fight
	bot_weapon_switch(foedist);

	if (foedist > v_y && foedist < v_z)
Instant Weapon Masters!

EDIT: Figured out what was causing it. Apparently, leading targets that are in the air and falling is whats doing it. Naturally, this is less of a problem on maps that don't have long distances and don't have particuarly high falling distances. (and also skill settings where bots cannot insta-look at targets.) Now to come up with a viable fix!
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Frikbot Item desirability

Post by Lightning Hunter »

Dr. Shadowborg wrote: Instant Weapon Masters!
I can confirm that this this code works well! I just watched the bots switch from the grenade launcher to the shotgun and back again all in one battle. Good job!

I did notice just now that the bots no longer lead the player with the grenades (so if you are strafing, they shoot where you are at, rather than where you will be). Also, the bots tend to aim a bit high in close range. This may be pinpoint accurate if you don't move at all - but if you move forward in the least bit, the grenade will go over your head. Perhaps the bots can have an aim offset of firing lower, even if it might not be pinpoint accurate at longer distances. They will hit more often at closer ranges this way.

But seriously though, if these things with the grenade launcher will take too long to fix, then don't worry about it. I think there are other, more important things. The range limit with the grenades is a huge improvement by itself!

Edit: I did notice your edit. Very interesting! So I guess they are predicting that the target will be below the floor, so they aim down and shoot themselves.

Edit #2: Btw, I uploaded a version of Fragtown 1 that has all grenade launchers (and a few shotguns), in case you need a good map to test the GL aiming.
http://filebeam.com/1667d32705c9530c3ea4f59ce364a3de
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Frikbot Item desirability

Post by Lightning Hunter »

Well, add another bug to your list Shadowborg... I noticed that sometimes when a bot dies, it will try to get to the waypoint it was aiming for before it died, rather than resetting its path when it respawns. I think this mostly happens when they are blown up (possibly when they die in the air). I'm mentioning this bug so you can see if you spot it while you are testing the bots with these other issues. Once again though, I think the aiming bugs and other such issues take the top priority. Just keep an eye out for this one in case it's an easy fix.
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Re: Frikbot Item desirability

Post by Dr. Shadowborg »

Oof, okay try this:

In bot.qc, replace this:

Code: Select all

// DRS: Extra shizz here
float(float dist) DRS_GrenadeEnergy;
with this:

Code: Select all

// DRS: Extra shizz here
float(float num) mathlib_cos;
Next, In bot_misc.qc, delete DRS_GrenadeEnergy. In it's place put this:

Code: Select all

/*
-----------------------------------------
cosine
-----------------------------------------
*/

float(float num) mathlib_cos =
{
	local vector ang,vf,vu,vr;
	
	vf = v_forward;
	vu = v_up;
	vr = v_right;
	
	ang = '0 1 0' * num;
	makevectors(ang);
	num = v_forward_x;
	
	v_forward = vf;
	v_up = vu;
	v_right = vr;
	
	return num;
};
Next in weapons.qc, within W_FireGrenade() change the if(self.v_angle_x) block to look like this:

Code: Select all

    self.missile_speed = 600;
	if (self.v_angle_x)
		missile.velocity = v_forward*600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
	else
	{
		missile.velocity = aim(self, 600);
		missile.velocity = missile.velocity * 600;
		missile.velocity_z = 200;
	}
Next, in bot_fight.qc, within weapon_range, change the else if (wep == 16) // IT_GRENADE_LAUNCHER block to look like this:

Code: Select all

else if (wep == 16) // IT_GRENADE_LAUNCHER
	  returnvalue = '180 48 600';
Next, in bot_ai.qc, replace the bot_angle_set function with this:

Code: Select all

void() bot_angle_set =
{
	local float h;
	local vector view, voffset;
    local vector offset, spot1, oldview;
    local float offset_amt, dist1, dist2;
	
	if (self.enemy && self.enemy != world)
	{
		if (self.enemy.items & 524288)
			if (random() > 0.01)
				return;
		if (self.missile_speed == 0)
			self.missile_speed = 10000;
		if (self.enemy.solid == SOLID_BSP)
		{
			view = (((self.enemy.absmin + self.enemy.absmax) * 0.5) - self.origin);
		}
		else
		{
			view = self.enemy.origin;

			 // find lead point on target
			 // then traceline to it, if blocked before full dist,
			 // set targetpoint to stopped origin
			 // then trace again to check if there's a clear path to
			 // target, if not, just target enemy.origin.
			 // also, check to see if trace endpoint is within 140 qu
			 // of the bot, if so, aim at the enemy.origin, because
			 // we are looking at a wall, and that could hurt if it's a rocketlauncher
				h = vlen(view - self.origin) / self.missile_speed; // need to get the speed of projectile
				if (self.enemy.flags & FL_ONGROUND)
					view = self.enemy.velocity * h; // Aim straight at enemy, not at his feet, that will be handled later
				else
					view = (self.enemy.velocity - (sv_gravity * '0 0 1') * h) * h; // hes in the air, lead accordingly
				view = self.enemy.origin + view; // set our leadpoint
				traceline(self.enemy.origin, view, FALSE, self); // trace from enemy.origin to lead aimpoint
				view = trace_endpos; // set view origin to lead aimpoint
				traceline(self.origin + self.view_ofs, view, FALSE, self); // do a trace to view from self.
				spot1 = trace_endpos; // get trace_endpos
				dist1 = vlen(spot1 - (self.origin + self.view_ofs)); // range from self to trace
				dist2 = vlen(view - (self.origin + self.view_ofs)); // range from self to aimpoint
				if((dist1 < 140) && (dist1 != dist2)) // too close, shoot at enemy.origin
				 view = self.enemy.origin;
				else if(vlen(view - spot1) > 32 && trace_ent.takedamage == DAMAGE_NO)
				 view = self.enemy.origin; // something that can't be damaged in the way, just shoot at enemy.origin.
				 dist2 = vlen(view - (self.origin+self.view_ofs));
		}

// DRS: Tweaked Supa Aimcode (wazat inspired) below
// DRS: FIXME: Change this so that it's not so consistent...
            if(self.weapon != IT_GRENADE_LAUNCHER) // Grenade Launcher should not jitter
			 {
             if(self.b_skill == 0) 
			   offset_amt = 55;  //110
             else if (self.b_skill == 1) 
			        offset_amt = 45;  //80
             else if (self.b_skill == 2)
			   offset_amt = 36; //60
             else if (self.b_skill == 3)
			   offset_amt = 15; //0

             offset_x = crandom() * offset_amt;
             offset_y = crandom() * offset_amt;
             offset_z = crandom() * offset_amt;
			}

		    if(self.weapon == IT_GRENADE_LAUNCHER) // using grenades? Aim properly then!
            {
			 oldview = view;

			   local float realrange, flitime;
			   local vector grndir;

			   grndir = normalize(view - (self.origin + self.view_ofs));//normalize(self.enemy.origin - self.origin);
			   realrange = dist2*mathlib_cos(grndir_x);
			   flitime = realrange / self.missile_speed;
			  
               view = view + '0 0 -20'; // aim at feet
			   grndir = normalize(view - (self.origin + self.view_ofs));//normalize(self.enemy.origin - self.origin);
	    	   grndir = grndir * 600;
			   grndir_z = grndir_z + (sv_gravity*flitime) * 0.3;
			   view = normalize(grndir);
			}
			else if(self.weapon == IT_ROCKET_LAUNCHER && (self.enemy.flags & FL_ONGROUND)) // Rocketlauncher?  Aim at feet if they're on the ground!
			{
			 oldview = view;
			 view = view + '0 0 -20'; // aim at feet
			 traceline(self.origin + self.view_ofs, view, TRUE, self);
			  if(vlen(view - trace_endpos) > 32)
			   view = oldview;
			 view = normalize((view + offset) - (self.origin + self.view_ofs));
			}
            else view = normalize((view + offset) - (self.origin + self.view_ofs));

		view = vectoangles(view);
		view_x = view_x * -1;
		self.b_angle = view;
	}
	else if (self.target1)
	{
		view = realorigin(self.target1);
		if (self.target1.flags & FL_ITEM)
				view = view + '0 0 48';
		view = view - (self.origin + self.view_ofs);
		view = vectoangles(view);
		view_x = view_x * -1;
		self.b_angle = view;
	}
	else
      self.b_angle_x = 0;

	// HACK HACK HACK HACK
	// The bot falls off ledges a lot because of "turning around"
	// so let the bot use instant turn around when not hunting a player
	if (self.b_skill == 3)
	{
		self.keys = self.keys & 63;	
		self.v_angle = self.b_angle;
		while (self.v_angle_x < -180)
			self.v_angle_x = self.v_angle_x + 360;
		while (self.v_angle_x > 180)
			self.v_angle_x = self.v_angle_x - 360;
	}
	else if ((self.enemy == world || self.enemy.movetype == MOVETYPE_PUSH) && self.target1.classname != "player")
	{
		self.keys = self.keys & 63;
		self.v_angle = self.b_angle;
		while (self.v_angle_x < -180)
			self.v_angle_x = self.v_angle_x + 360;
		while (self.v_angle_x > 180)
			self.v_angle_x = self.v_angle_x - 360;
	}
	else if (self.b_skill < 1) // skill 2 handled in bot_phys
	{
		if (self.b_angle_x > 180)
			self.b_angle_x = self.b_angle_x - 360;
		self.keys = self.keys & 63;

		if (angcomp(self.b_angle_y, self.v_angle_y) > 10)
			self.keys = self.keys | KEY_LOOKLEFT;
		else if (angcomp(self.b_angle_y, self.v_angle_y) < -10)
			self.keys = self.keys | KEY_LOOKRIGHT;
		if (angcomp(self.b_angle_x, self.v_angle_x) < -10)
			self.keys = self.keys | KEY_LOOKUP;
		else if (angcomp(self.b_angle_x, self.v_angle_x) > 10)
			self.keys = self.keys | KEY_LOOKDOWN;
	}
};
This should fix most aiming problems, bots should also lead players / bots with grenades now.

The only real problem with this code is that they seem to be a little too deadly now. :shock:
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: Frikbot Item desirability

Post by frag.machine »

Lightning Hunter wrote:Well, add another bug to your list Shadowborg... I noticed that sometimes when a bot dies, it will try to get to the waypoint it was aiming for before it died, rather than resetting its path when it respawns.
Robots that keep memories from their earlier lifes... where did I hear about that before ? Oh yeah...
Image
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Re: Frikbot Item desirability

Post by Lightning Hunter »

Hey Shadowborg, is something missing from the instructions for bot_fight? I got a compile error for line 242: Unknown value "DRS_GrenadeEnergy".

Frag Machine, I'm not sure what that's from. :P

Edit: I got it to compile by changing "DRS_GrenadeEnergy" in bot_fight to "mathlib_cos". Shadowborg, can you make sure I didn't mess anything up in any of my modified qc files? After so much copying and pasting, I want to make sure everything is up to date the way it should be. This is my current source folder for the Frikbots based on your modificaitons:
http://fbe.am/uc1

I did notice huge improvements with the grenade launcher. So far, it seems perfect! As for the Rocket Launcher, the bots don't seem to fire at the ground anymore, but I did just now see a bot try to shoot another bot through a building in Fragtown3. He shot twice at the building point blank range, killing himself in the process. I think the other bot was on the other side of the building, and completely obstructed. I do want you to double check that I changed all the code correctly, however.
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Re: Frikbot Item desirability

Post by Dr. Shadowborg »

Only differences I see in there are an extra unneeded if (self.angle_x) in the W_FireGrenade() code (just take out the if(self.angle_x) right before self.missile_speed = 600;) and the weapon_range() step wasn't implimented.

They're trying to shoot through the building?

/me sighs

I'll take a look and see if I can't improve it a little bit, though it may mean more tracelines...
Post Reply