Page 1 of 4

Bot Bug in firing

Posted: Sun Dec 11, 2016 11:24 am
by Gadavre
I ask to help to fix lack of firing at the player in my Mutator
-----------------------------------------------------
VIDEO
https://youtu.be/H7J4HTZFmXs
-----------------------------------------------------
In the original game, bots can not shoot at the player at a very large distance. I put this line in my Mutator and bot began to see the player! Now we see the animation of aiming. But we don't see the shot. What can prevent firing at a great distance? Please help to fix!

Code: Select all

function ModifyPlayer(Pawn Other)	// called by GameInfo.RestartPlayer()
{ 
        Bot(Other).BaseAlertness = 2.000000;

        if ( NextMutator != None )
	NextMutator.ModifyPlayer(Other); 
}

Re: Bot Bug in firing

Posted: Sun Dec 11, 2016 11:58 am
by sektor2111
Do you have a pain in wrapping your code ? If We all are players Will only spread Accessed Nones...

Code: Select all

if (Bot(Other) != None)
	Bot(Other).BaseAlertness = 2.000000;
else

Code: Select all

if (Other.IsA('Bot'))
	Bot(Other).BaseAlertness = 2.000000;
Because ModifyPlayer is NOT ONLY FOR BOT :loool: .
And then SightRadius goes at 5000 UU but... I cannot be sure if SeePlayer is being called at 100000 UU. When I was talking somewhere about an additional attached Bot Brain everybody doesn't have a clue why I was speaking about such things. Okay, keep going...

Re: Bot Bug in firing

Posted: Sun Dec 11, 2016 12:47 pm
by Gadavre
sektor2111
I tested your lines. They also don't work. I increased the variable Sight Radius to the value 10000 - 20000. It didn't help.
Increased visibility also did not help ( In original game by default 128).

Code: Select all

if (Other ! = None)
        Other.Visibility = 255;

Re: Bot Bug in firing

Posted: Sun Dec 11, 2016 2:01 pm
by sektor2111
Visibility has nothing to do with SightRadius, see wiki before wasting more time.

Else it's normal to not work, but nobody is getting hurt if you WRAP codes properly - even if are not useful for this job.

Engine will lag itself at testing huge ranges, definitely this is not an answer...

Like I SAID, A.I. AKA Artificial Intelligence (stupidity) AKA BOT uses SeePlayer for detecting enemies. That crap is called by LORD ENGINE who need your help because he is wacky and poor.

Re: Bot Bug in firing

Posted: Sun Dec 11, 2016 2:10 pm
by OjitroC
You could have a look at the code for the TWFSightRadius Version 3 mutator, as "it allows the bots to spot another player at infinite distance", and see if it would help you (I use it playing with bots on large sniper maps and it certainly seems to work well, enabling the bots to spot the player at very long range and take shots - it does, though, throw up quite a few script warnings).

Re: Bot Bug in firing

Posted: Sun Dec 11, 2016 2:58 pm
by Gadavre
OjitroC wrote:You could have a look at the code for the TWFSightRadius Version 3 mutator, as "it allows the bots to spot another player at infinite distance", and see if it would help you (I use it playing with bots on large sniper maps and it certainly seems to work well, enabling the bots to spot the player at very long range and take shots - it does, though, throw up quite a few script warnings).
I tested this Mutator (TWFSightRadius Version 3) with Mutator Sniper Arena. The Bot also couldn't shoot at the player who was on the top platform with a SniperRifle (see my video above).

Re: Bot Bug in firing

Posted: Sun Dec 11, 2016 4:48 pm
by OjitroC
So, as you say, the problem is not that the bot does not see the player but that the bot does not fire at the player. Does it happen with ALL/ANY bots on THIS map? Does it happen on other maps? Is it to do with the bot skills settings (skills, accuracy, combat style etc)?

Re: Bot Bug in firing

Posted: Sun Dec 11, 2016 5:17 pm
by Gadavre
OjitroC wrote:So, as you say, the problem is not that the bot does not see the player but that the bot does not fire at the player. Does it happen with ALL/ANY bots on THIS map? Does it happen on other maps? Is it to do with the bot skills settings (skills, accuracy, combat style etc)?
Right!

--- merged ---

I think the code of this function from original class"Bot" prevents the shoot at the player. What do you think?
Spoiler
function Killed(pawn Killer, pawn Other, name damageType)
{
local Pawn aPawn;

if ( Killer == self )
Other.Health = FMin(Other.Health, -11); // don't let other do stagger death

if ( Health <= 0 )
return;

if ( OldEnemy == Other )
OldEnemy = None;

if ( Enemy == Other )
{
bFire = 0;
bAltFire = 0;
bReadyToAttack = ( skill > 3 * FRand() );
EnemyDropped = Enemy.Weapon;
Enemy = None;
if ( (Killer == self) && (OldEnemy == None) )
{
for ( aPawn=Level.PawnList; aPawn!=None; aPawn=aPawn.nextPawn )
if ( aPawn.bIsPlayer && aPawn.bCollideActors
&& (VSize(Location - aPawn.Location) < 1600)
&& CanSee(aPawn) && SetEnemy(aPawn) )
{
GotoState('Attacking');
return;
}

MaybeTaunt(Other);
}
else
GotoState('Attacking');
}
else if ( Level.Game.bTeamGame && Other.bIsPlayer
&& (Other.PlayerReplicationInfo.Team == PlayerReplicationInfo.Team) )
{
if ( Other == Self )
return;
else
{
if ( (VSize(Location - Other.Location) < 1400)
&& LineOfSightTo(Other) )
SendTeamMessage(None, 'OTHER', 5, 10);
if ( (Orders == 'follow') && (Other == OrderObject) )
PointDied = Level.TimeSeconds;
}
}
}

Re: Bot Bug in firing

Posted: Sun Dec 11, 2016 5:36 pm
by sektor2111
I think default sniper rifle has 4096 range, the rest is a myth at this weapon regarding to 5000 Sight triggered by a DefencePoint, LOL.

Above code is for picking next enemy from a closer horde and not for tracing a 10000 UU sphere space.

And here you came at my point. I did not loved Bot, so I did MBot - now it's your turn to make your own Bots and leave alone EPIC because is a waste of time.

Re: Bot Bug in firing

Posted: Sun Dec 11, 2016 10:04 pm
by Chamberly
Now the question is, do you have the code to make the bot fire at target? Since if it only see you... there is no other command telling it to shoot?

Btw, I think you are coding into a custom sniper rifle?

Re: Bot Bug in firing

Posted: Sun Dec 11, 2016 11:19 pm
by Gadavre
Chamberly wrote:Now the question is, do you have the code to make the bot fire at target? Since if it only see you... there is no other command telling it to shoot?

Btw, I think you are coding into a custom sniper rifle?
I have no such code. The bot shoots as it is specified to him in the original game. yes, i m coding into a custom sniper rifle. But bots do not shoot at long range
with a standart sniperrifle.My SniperRifle does not affect the behavior of the bot.

I suggest community to fix it. I don't know what to do.

Re: Bot Bug in firing

Posted: Sun Dec 11, 2016 11:52 pm
by Chamberly
Gadavre wrote:I have no such code. The bot shoots as it is specified to him in the original game. yes, i m coding into a custom sniper rifle. But bots do not shoot at long range
with a standart sniperrifle.My SniperRifle does not affect the behavior of the bot.

I suggest community to fix it. I don't know what to do.
Funny that you suggested the community to fix it (like really? Not all of us can do it!). It's a lot more complicated than that. Coding is beyond the simplification of getting things up and running in easy mode, and, a lot of time to learn to learn to code properly and how to work on some progress to build up.
Just like planning a house, you'd need knowledge and specific requirements, the tools, and your own design in mind.

So to resume, I can tell that you're simply lying that you said you have no such code. The code you posted up there in beginning of the thread, IS part of a code...

Not sure what you rather wanting to do with the sniper, so we have no idea what's going on without the full context of details of what you are trying to do.

But there can be errors in the code you are trying to work on already so we don't know where to look if you modify something else already in full source.

So tbh, if you wanting to make your own sniper rifle in custom, look at some that are already made. No need to modify anything else to swap the engine into trouble and errors by modifying bots and everything else.

Just my 2 cent.

Re: Bot Bug in firing

Posted: Mon Dec 12, 2016 12:01 am
by EvilGrins
Gadavre wrote:In the original game, bots can not shoot at the player at a very large distance
That depends on your bot...
Image
...I was never a fan of the default settings.

If you hype up a bot's skill, alertness, & accuracy (not necessarily as high as that above but more than the medium) it will not only shoot at you from very far away, it will often kill you without you having a clue where it was.

I'm not a coder, I go with the initial basics and customize all my bots individually.

Re: Bot Bug in firing

Posted: Mon Dec 12, 2016 12:55 am
by OjitroC
I agree with EG - I think it could well be down to your bot skill settings (as EG indicates and as I suggested earlier) - I've certainly not had your problem with bots (I do use a lot of MBots, which you could try out to see if there is any difference in behaviour, and TSFSightRadius; I have not experienced any problems with bots not firing at long range). The bot in your video seems to avoid combat rather than seek it, as should be the case, so what combat style setting are you using for your bots and what base skill setting in the Start Practice Session menu?

Re: Bot Bug in firing

Posted: Mon Dec 12, 2016 4:29 am
by papercoffee
Weapon defines bot behaviour.