-
Notifications
You must be signed in to change notification settings - Fork 31
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
Laser patriot shoots at units outside of its range #370
Comments
I am impressed that we did not track this earlier. After all it is one of the popular bugs. |
It happens with all patriot systems, the laser one is with the furthest reach, thats why its so noticeable. |
What about the lag the assist system produced, is it tracked? |
We have reduced the lag with data changes, but perhaps there is more we can do in code. |
So I think I understand what is happening. In the INIZH the assist behaviour states:
When asked for assistance, it will shoot an This also explains the self-damage bug range in issue 27 in the game patch issue tracker. The patriot that is shooting at the damaged patriot is also requesting assistance from that same patriot. The damaged patriot hence switches to its secondary -long range - weapon but cannot fire its projectiles, because it is prohibited to shoot itself. It then uses the range finding of the secondary weapon to find another target and shoot it. It is more obvious for laser patriots, because they fire instant. Due to the slow speed, it is more likely that a normal patriot fires all four projectiles from its secondary weapon before the target is destroyed. I'm not very familiar with all the INI stuff and what logic is and is not in there, but I think @xezon is right that the assistance logic may be handled in the code. I'll see if I can dig into it more. |
Logging my search When an assist request comes in and the turret is free, the AssistingWeaponSlot (secondary weapon on patriots) is temporary locked, giving it preference over its primary weapon. According to the comment it lasts one clip size or until the target is destroyed. There are edge cases where I can think of this not working. Such as a manual stop command before a clip is fired, or if the target is the assisting turret. The temporary lock is released at some point. Investigating when this is and should be called. Partial fix
Here the assisting turret is called upon to fire on the target. However it is possible that the target (victim) is the same as the assisting turret being called upon. If the assisting turret is also the victim, it should not go into assist mode. This can be resolved by adding the following code // Don't ask ourselves (can't believe I forgot this one)
if( requestOf == requestData->m_requestingObject )
return;
// -- NEW CODE TO BE ADDED
// Don't ask ourselves if we are the target (community fix)
if( requestOf == requestData->m_victimObject )
return; Once we have a compiling version I can test this and then create a PR Still to figure out:
|
@xezon @DevGeniusCode This is definitely an executable issue. Could you change the label from maybe to definite? And can you elaborate on the lag? Is it a performance issue, or is it delay until the assist is requested? |
If the target is destroyed, make sure all assisting turrets reset their weapon to primary A fix for this is likely to be found in AIUpdate.cpp here GeneralsGameCode/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp Line 3278 in 0a05454
and here GeneralsGameCode/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp Line 3304 in 0a05454
In both routines nothing happens if the victim is no longer there. But if the victim is gone, a weapons lock reset is required to ensure the turret switches from secondary (extended range) to primary weapon Proposal is to change in both routines if (!victim)
{
// Hard to kill em if they're already dead. jba
return;
} to if (!victim)
{
// Reset weapons lock to fix patriot turret extended range bug (community fix)
getObject()->releaseWeaponLock(LOCKED_TEMPORARILY);
// Hard to kill em if they're already dead. jba
return;
} |
Good luck :-) |
If a stop command is given, make sure the turret switches to its primary weapon If the player keeps spamming the stop command for the turret, while it receives an assist request, it will not fire at the target at all. But it will remain in the secondary weapon state. I'm not sure if a reset is needed, or that the AIUpdate code is run anyways and will releases the weapon lock (after the above patch) because the victim is death. This will require testing of the above patch. In case a weapon lock release is required at stop command it probably goes here:
|
This comment has been minimized.
This comment has been minimized.
A reminder for myself (and others): Fixing this will break compatibility with non-patched versions. |
Laser patriots sometimes shoot at a unit, far beyond its range. May be an issue with patriot target communication.
Example:
Could be related to issue #110
The text was updated successfully, but these errors were encountered: