Re: Frikbot Item desirability
Posted: Thu Sep 11, 2014 2:26 am
WHAT ?! I am confiscating your nerd credentials, sir.Lightning Hunter wrote:Frag Machine, I'm not sure what that's from.
WHAT ?! I am confiscating your nerd credentials, sir.Lightning Hunter wrote:Frag Machine, I'm not sure what that's from.
Don't worry, we still have Quake. That's nerdish enough.frag.machine wrote:WHAT ?! I am confiscating your nerd credentials, sir.Lightning Hunter wrote:Frag Machine, I'm not sure what that's from.
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 600';
else if (wep == 32) // IT_ROCKET_LAUNCHER
returnvalue = '180 48 3000';
else if (wep == 64) // IT_LIGHTNING
returnvalue = '350 0 512';
return returnvalue;
};
Code: Select all
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 + mathlib_cos(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");
}
}
Yes, its no longer needed, grenade maxrange is 600qu. As is, that code wouldn't even properly work anymore.Lightning Hunter wrote:So all this stuff was removed from bot_fight?
Code: Select all
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 + mathlib_cos(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"); } }
Yeah, I see that. I've traced the problem down to them not setting their angle properly for some odd reason. It isn't a problem with the traceline checking code, somewhere the view just isn't being set like it should be. I'm still trying to figure out where its going wrong...Lightning Hunter wrote:Hey Shadowborg, I just noticed a critial bug that was introduced in your new code somehow. Bots no longer aim properly at shootable buttons. Instead, they fire off in some random direction that is not even close to the button (like at the sky or the floor). This was probably recently introduced with your aiming code!
I have a feeling if you fix it, you might also fix the problem with the bots shooting themselves randomly in Fragtown.Dr. Shadowborg wrote: Yeah, I see that. I've traced the problem down to them not setting their angle properly for some odd reason. It isn't a problem with the traceline checking code, somewhere the view just isn't being set like it should be. I'm still trying to figure out where its going wrong...
Code: Select all
.float dontshoot;
Code: Select all
// try to avoid shooting teammates
if (trace_ent.classname == "player")
if ((trace_ent.team == self.team && teamplay) || (coop))
return;
// DRS: If dontshoot is TRUE, that means we don't have a straight line shot
if(self.dontshoot == TRUE)
return;
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)
{
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
self.dontshoot = FALSE;
view = normalize(view - (self.origin + self.view_ofs));
}
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!
{
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);
}
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, FALSE, self);
if(vlen(view - trace_endpos) > 32)
view = oldview;
}
// DRS: Do a viability test on whether we actually should shoot or not
if(self.enemy.solid != SOLID_BSP)
{
traceline(self.origin+self.view_ofs, view, TRUE, self);
if(vlen(trace_endpos - (self.origin+self.view_ofs)) < (dist2 - 32))
self.dontshoot = TRUE;
else if(vlen(trace_endpos - (self.origin+self.view_ofs)) > (dist2 + 32))
self.dontshoot = TRUE;
else self.dontshoot = FALSE;
}
if(self.weapon != IT_GRENADE_LAUNCHER)
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;
self.dontshoot = TRUE;
}
else
{
self.b_angle_x = 0;
self.dontshoot = TRUE;
}
// 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)
{
if (self.b_angle_x < -180)
self.b_angle_x = self.b_angle_x + 360;
if (self.b_angle_x > 180)
self.b_angle_x = self.b_angle_x - 360;
self.keys = self.keys & 63;
self.v_angle = self.b_angle;
}
else if ((self.enemy == world || self.enemy.movetype == MOVETYPE_PUSH) && self.target1.classname != "player")
{
if (self.b_angle_x < -180)
self.b_angle_x = self.b_angle_x + 360;
if (self.b_angle_x > 180)
self.b_angle_x = self.b_angle_x - 360;
self.keys = self.keys & 63;
self.v_angle = self.b_angle;
}
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;
}
};
Dr. Shadowborg wrote: Fun fact: Use of fisible in bot_shoot() basically means they will shoot at players they can see the bounding box edges of. Fragtwn4's used car lot unfortunatly has walls that make it such that you may not be able to see players, but the bots CAN.
No I mean fisible. fisible() is all that stock frikbots have in the way of shot verification ability (it only checks to see if they can see a player), but it doesn't cause them to aim at the bounding boxes. They didn't even have lead aimpoint verification, which is why they blew themselves up on maps like the fragtown series so much. (thus they will shoot, shoot, shoot away, but never actually hit you.)Cobalt wrote:I think you mean the Realorigin () function in the FRikbot system?
I was experimenting one day on map DM2, and the bot was near the ssg where the teleporter and red armor and 200 health is near the lava. I entered via the stars heading toward the button, and the bot fired and never hit me....even if I stood still. This was because there is a BSP obstruction cutting off the view so that only partially I could be seen through the groove. I thought I altered the QC and got it working better but cant remember how. I first thought of doing (3) tracelines not just one. One for the head and one for the feet, but still not completely solving the problem.
Dr. Shadowborg wrote: Fun fact: Use of fisible in bot_shoot() basically means they will shoot at players they can see the bounding box edges of. Fragtwn4's used car lot unfortunatly has walls that make it such that you may not be able to see players, but the bots CAN.
-Teleporters are sometimes buggy with bots, but I'm not sure if this would be impossible to fix or not. Sometimes, bots will enter a teleporter, and somehow be on the wrong path and go back toward a waypoint they can't reach. It's hard to explain exactly what is happening, but they just don't seem to always register that they passed through a teleporter. This can be helped somewhat with the precision flag, but not always. There is a map I just waypointed recently that had a troublesome teleporter. The bots would pass through the teleporter, then run toward a waypoint on the other side of the map - colliding in to random walls along the way. I can upload that map if you want to look at this issue.
-Spawn Radius detection for bots:On the other hand, I was lucky enough to find a map that has the teleport bug almost 100% of the time. I'm sorry the map has to be so large (it has 6 waypoint files), but I helped you out by deleting ALL important items except a Quad damage that I added on the other side of the teleporter. you will likely see the bug within 15-30 seconds if you add a bot and follow it around using the chasecam. The bot might collect the Quad damage from the back way without teleporting, in which case you can restart the map or wait for the Quad to respawn. The teleporter that causes problems is right next to a pit of water. When bots go through this teleporter, they get confused and run to a different waypoint than the one they are supposed to. After teleporting, you will notice the bots run off a ledge, in to some water, and stare at a wall to reach a waypoint they can't get to. They do eventually reset the path, but only after they mess everything up first. I'm guessing something happens that makes them not register that they went through the teleporter, and makes them try to get to the wrong waypoint.
Download the map here:
http://fbe.am/u2b
-The navigation bug in which bots try to get to a previous waypoint after deathRandomized 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 (if possible).
-Precision mode not turning off sometimes, even though bots have passed the waypoint. I have seen it a few times in Fragtwn4, when the bots are trying to jump from one rooftop to another (I just saw it a few times watching your new aim code). The bots keep precision mode on and completely miss the jump from one rooftop to another, since their speed is too low.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.
Thanks.Dr. Shadowborg wrote:Glad to hear the new aim code is working out!
I'll take a look tomorrow to see if I can do anything about those last few bugs / features.