Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HLT(Warden) shake issue, causing slower firerate #3590

Open
MeSaber opened this issue Aug 13, 2024 · 5 comments
Open

HLT(Warden) shake issue, causing slower firerate #3590

MeSaber opened this issue Aug 13, 2024 · 5 comments
Labels
Bug Something isn't working Script / Animation Units scripts, both BOS and LUS

Comments

@MeSaber
Copy link

MeSaber commented Aug 13, 2024

Description

https://www.twitch.tv/videos/2227792317

Maybe related to its lagginess in turn rate?

Expected Behaviour

No shake

Actual Behaviour

Shake.

Reproduction steps

No response

Other

No response

@MeSaber MeSaber added the Bug Something isn't working label Aug 13, 2024
@SethDGamre
Copy link
Collaborator

this looks like a signal error with the animation script allowing multiple aim commands simultaneously. Might not be. That's my first impression.

@SethDGamre
Copy link
Collaborator

I was wrong. It's actually due to something in this wall of text:

`#define MAX_AIMY1_VELOCITY <9.00>
#define AIMY1_ACCELERATION <0.2>
#define AIMY1_JERK <1.0>
#define AIMY1_PRECISION <1.2>
static-var aimy1delta, timetozero, deceleratethreshold, gameFrame;

AimWeapon1(heading, pitch)
{

signal SIG_AIM;
set-signal-mask SIG_AIM;
//We can do this any time
turn turret to x-axis <0.000000> - pitch speed <45.000000>;

aimy1target = heading;
aimy1delta = aimy1position - aimy1target;
	
while( ( get ABS(aimy1delta) > AIMY1_PRECISION ) OR (get ABS(aimy1velocity) > AIMY1_JERK)){
	if (gameFrame != get(GAME_FRAME)){ //this is to make sure we dont get double-called, as previous aimweapon thread runs before new aimweaponthread can signal-kill previous one 
		gameFrame = get(GAME_FRAME);

		//Clamp aimy1position and aimy1delta between <-180>;<180>
		while (aimy1position >  <180>) aimy1position = aimy1position - <360>;
		while (aimy1position < <-180>) aimy1position = aimy1position + <360>;
		while (aimy1delta >  <180>) aimy1delta = aimy1delta - <360>;
		while (aimy1delta < <-180>) aimy1delta = aimy1delta + <360>;
	
		//number of frames required to decelerate to 0
		timetozero = get ABS(aimy1velocity) / AIMY1_ACCELERATION;
		
		//distance from target where we should start decelerating, always 'positive'
		//pos = t * v - (t*(t-1)*a/2)
		deceleratethreshold = timetozero * (get ABS(aimy1velocity)) - (timetozero * (timetozero - 1) * AIMY1_ACCELERATION / 2); 
		
		//get PRINT ( aimy1delta , deceleratethreshold, aimy1velocity, timetozero );
		
		if (get ABS(aimy1delta) <= deceleratethreshold){ //we need to decelerate
			if (aimy1velocity > 0) aimy1velocity = aimy1velocity - AIMY1_ACCELERATION;
			else 				   aimy1velocity = aimy1velocity + AIMY1_ACCELERATION;
		}	
		else //we need to accelerate
		{
			if (aimy1delta > 0) aimy1velocity = get MIN(       MAX_AIMY1_VELOCITY, aimy1velocity + AIMY1_ACCELERATION); 
			else                aimy1velocity = get MAX((-1) * MAX_AIMY1_VELOCITY, aimy1velocity - AIMY1_ACCELERATION);
		}
		
		//Apply jerk at very low velocities
		if (get ABS(aimy1velocity) < AIMY1_JERK){
			if ((aimy1delta >        AIMY1_JERK)) aimy1velocity =        AIMY1_JERK;
			if ((aimy1delta < (-1) * AIMY1_JERK)) aimy1velocity = (-1) * AIMY1_JERK;
		}
		
		aimy1position = aimy1position + aimy1velocity; 
		turn turret to y-axis aimy1position now;
		aimy1delta = aimy1target - aimy1position ; 	
		if ((aimy1delta < <7>) AND (aimy1delta > <-7>)){
			return (1);
		}
	}
	sleep 30;
}
aimy1velocity = 0;
return (1);

}`

@SethDGamre
Copy link
Collaborator

@Beherith i checked blame history and looks like you wrote this part of the script 4 years ago. Armada HLT has simple aiming function. What's the purpose of the accelleration thingy? What do you make of the aim jitter that seems to get worse the closer the aim target gets?

@SethDGamre SethDGamre added the Script / Animation Units scripts, both BOS and LUS label Oct 11, 2024
@SethDGamre
Copy link
Collaborator

I think I understand what's going on here.

The constant acceleration aiming method that is employed here has a little bit of overshooting that's allowed as it turns. So what's going on is the warden is aiming towards the target, overshooting it, now it's facing slightly past it to the left, so the next time it aims it turns the other direction slightly overshooting it, repeat

I don't think this usually affects the fire rain except for when it's super super close I remember that there is a certain amount of misalignment that is allowed when returning true in the aim weapon call in

@SethDGamre
Copy link
Collaborator

The solution is to either reduce the amount of overshooting that is allowed, or have a small Dead zone where re-aiming isn't allowed because it is "close enough"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Script / Animation Units scripts, both BOS and LUS
Projects
None yet
Development

No branches or pull requests

2 participants