Shooting non-stop in DM-Agony with a minigun

Discussions about Coding and Scripting
Post Reply
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Shooting non-stop in DM-Agony with a minigun

Post by PrinceOfFunky »

A bot called Archon, started shooting with a minigun today in DM-Agony and didn't stop until he picked up a new weapon!

Lol, I liked the idea of writing it like a newspaper article :D
Anyway, it rly happened today, I THINK the bot didn't even noticed me, I'm trying to figure out if it's cause of my mutator(which I believe it's the cause).
The mutator checks the aimed actor using this code:

Code: Select all

static function actor getAimedActor(Pawn pawn, Weapon weapon) {
	local vector HitLocation, HitNormal, StartTrace, EndTrace, X,Y,Z;
	local float Accuracy;
	
	local rotator AdjustedAim; //To not to affect the pawn.Weapon.AdjustedAim
	
	if ((pawn != None) && (weapon != None)) {
		Accuracy = 0.0;

		GetAxes(pawn.ViewRotation, X, Y, Z);
		StartTrace = pawn.Location + weapon.CalcDrawOffset() + weapon.FireOffset.X * X + weapon.FireOffset.Y * Y + weapon.FireOffset.Z * Z; 
		AdjustedAim = pawn.AdjustAim(1000000, StartTrace, 2*weapon.AimError, False, False);	
		EndTrace = StartTrace + Accuracy * (weapon.FRand() - 0.5 )* Y * 1000
			+ Accuracy * (weapon.FRand() - 0.5 ) * Z * 1000;
		X = vector(AdjustedAim);
		EndTrace += (10000 * X);
		
		return pawn.TraceShot(HitLocation, HitNormal, EndTrace, StartTrace);
	}
	
	return None;
}
That's a modified version of "TraceFire()" function from "Weapon" class.
Pawns always use this code when firing, so I don't see how it could let a bot shooting non-stop with a minigun.
"Your stuff is known to be buggy and unfinished/not properly tested"
User avatar
Barbie
Godlike
Posts: 2792
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Shooting non-stop in DM-Agony with a minigun

Post by Barbie »

I didn't dig deep into your code: I guess that you want to get a value (Actor) without changing the game's state outside your routine. But you are calling Actor's functions that might change the Actor's state ("state" in the sense of "Actor's variables have changed"). I'd try that with reading Actor's variables only (or using Actor's functions that do not change its state).
Sometimes it is hard to follow the chain of events a function call raises...
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Shooting non-stop in DM-Agony with a minigun

Post by sektor2111 »

Will pass some times until you'll figure why Higor did Botz and why I'm still working at MBot and why Minigun2 is no longer an item in my games :? .
Next items:
Probably you did not see yet (because you don't play UT with A.I.) some WeaponHolders aka stupid creatures firing forever whatever pulseGun with pink beam and Minigun2 in the same way killing other monsters without to have them as enemies just a lousy fire based on "coding" and "development" which i was tired to look at plus a default GameSpeed fired which is not helping these things at all, causing some double frames of executions or whatever code skating when pawns goes through states calling functions from a previous state (sorry for english but I cannot explain other way).
Pawns should stop fire if don't see enemy as a main wrapper of TacticalMove and if memory doesn't cheat me I think I have added sanity checks in function killed or nearest occurrences in order to enforce a "StopFiring" call because at a moment certain values seems not reset at state changes and pawn hangs attacking that guy called "None" (I gotta admit it is a loved one and very popular :ironic: ).
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Re: Shooting non-stop in DM-Agony with a minigun

Post by PrinceOfFunky »

sektor2111 wrote:Will pass some times until you'll figure why Higor did Botz and why I'm still working at MBot and why Minigun2 is no longer an item in my games :? .
Next items:
Probably you did not see yet (because you don't play UT with A.I.) some WeaponHolders aka stupid creatures firing forever whatever pulseGun with pink beam and Minigun2 in the same way killing other monsters without to have them as enemies just a lousy fire based on "coding" and "development" which i was tired to look at plus a default GameSpeed fired which is not helping these things at all, causing some double frames of executions or whatever code skating when pawns goes through states calling functions from a previous state (sorry for english but I cannot explain other way).
Pawns should stop fire if don't see enemy as a main wrapper of TacticalMove and if memory doesn't cheat me I think I have added sanity checks in function killed or nearest occurrences in order to enforce a "StopFiring" call because at a moment certain values seems not reset at state changes and pawn hangs attacking that guy called "None" (I gotta admit it is a loved one and very popular :ironic: ).
Well, in 10 years I never saw a bot doing it, maybe who made the code also never saw it and that could probably be the reason why they left the code like that, thinking it worked perfectly.
About the GameSpeed thing, I know what you mean, I noticed that when you set the game speed to a too fast speed, bots tend to tilt(like SilverSound said in this thread: https://www.ut99.org/viewtopic.php?t=6547)
I needed to be sure if it was a bug coming from my code or from the stock code, now I know it, ty :D
"Your stuff is known to be buggy and unfinished/not properly tested"
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Shooting non-stop in DM-Agony with a minigun

Post by sektor2111 »

The fact is that if you have a map consuming CPU resources and playing a game-type with slow codes things are going more nasty and unpredictable than expected - MH is an example of such, anybody using those "techs" in other game-types and/or mutators will head to the same result... First affected by a high load is A.I. which is step number 1, then... a crash is not that far.
User avatar
EvilGrins
Godlike
Posts: 9668
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA
Contact:

Re: Shooting non-stop in DM-Agony with a minigun

Post by EvilGrins »

I've seen this sorta thing happen before...
PrinceOfFunky wrote:A bot called Archon, started shooting with a minigun today in DM-Agony and didn't stop until he picked up a new weapon!
...although it can be a bit annoying after the weapon runs outta ammo yet the bot is locked into shooting-mode.

Can't imagine wanting to do that on purpose.

Only fix I've ever found was to kill the bot.
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
Smilies · viewtopic.php?f=8&t=13758
Post Reply