TheSuperHackers / GeneralsGamePatch

Community Patch to fix and improve original Generals Zero Hour 1.04
Other
55 stars 19 forks source link

China Nuke Cannon needs to have better deployment handling #337

Open xezon opened 3 years ago

xezon commented 3 years ago

Discuss if Nuke Cannon needs to have better deployment handling. Nuke Cannon can deploy in Guard Mode, but will not work well because it may try to chase units poorly instead of staying deployed. Investigate if this can be improved.

xezon commented 3 years ago

Maybe a simple fix here would be to adjust Guard Mode range to Firing range.

commy2 commented 3 years ago

This fix https://github.com/xezon/GeneralsGamePatch/pull/269 already is a huge help.

ZekeDlyoung commented 3 years ago

Maybe a simple fix here would be to adjust Guard Mode range to Firing range.

If you mean make the guard range the same as its weapon range, that is a bad idea. There is a bug in ZH where artillery can auto acquire units inside fog of war, if the Nuke Cannon's guard range is extended, people can guard into the fog and attack targets even if they can't see them

xezon commented 3 years ago

Oh I thought Guard range is larger than Firing range, and that is why they undeploy, to move closer to the target and shoot. Right now Nuke Cannons will not wait for enemy units to come close, but instead try to move to enemy units for a kill, which is bad given the time it requires to deploy.

commy2 commented 3 years ago

1.04

Attack range: 150 - 350 Guard radius: 180 Shroud clearing range: 350

So guard range already is much smaller than attack range.

Stubbjax commented 3 years ago

Here is a demonstration of the unnecessary undeploy / redeploy behaviour after a target is killed.

https://user-images.githubusercontent.com/11547761/133054117-e407aafc-0ff4-433f-a103-0a2dc4563630.mp4

Also shows some funky retaliation behaviour on the Laser Crusader.

xezon commented 3 years ago

Ok judging by that video it looks like a clear bug.

xezon commented 3 years ago

Zeke:

You either:

  1. Allow it to auto attack, which let's it guard at full range without weird redeploy bug, at the cost of it wasting shots and blowing up your own troops due to reinforcement GPs
  2. Make it need to manually change modes using switch weapon/bike logic, which makes it cumbersome to use, and bike logic makes it instantly die from neutron and pilot kill
  3. Keep it the way it is and just don't use guard mode with it, just make it deploy with force fire and just manually attack the stuff you want
ZekeDlyoung commented 3 years ago

There's another method I forgot, Option 1 but with hold fire button, basically a weapon switch to a dummy weapon to stop it from firing.

But yeah, this bug is technically unfixable

MTKing4 commented 3 years ago

here's a demonstration for the hold fire button from SHW mod

https://user-images.githubusercontent.com/83613147/133074364-1c87891e-fee1-462f-a651-4a7bea51a82b.mp4

Pros:

Cons:

ZekeDlyoung commented 3 years ago

The hold fire button isn't meant to fix the redeploy bug, the redeploy bug is unfixable, it simple stops the nuke cannon from firing if you don't want it to, which is the problem with giving it auto attack

MTKing4 commented 3 years ago

Given this information is correct

1.04 Attack range: 150 - 350 Guard radius: 180 Shroud clearing range: 350 So guard range already is much smaller than attack range.

Then this statement is inaccurate

If you mean make the guard range the same as its weapon range, that is a bad idea. There is a bug in ZH where artillery can auto acquire units inside fog of war, if the Nuke Cannon's guard range is extended, people can guard into the fog and attack targets even if they can't see them

How is it supposed to aquire something it can't see if its vision equals its range? Meaning you're always able to see what you're shooting at, but if you mean it aquires them before reaching destination then this shouldn't be a problem since it will see them eventually anyway, and it's the same as the terrorist guard bug.

Also

Maybe a simple fix here would be to adjust Guard Mode range to Firing range.

1.Allow it to auto attack, which let's it guard at full range without weird redeploy bug, at the cost of it wasting shots and blowing up your own troops due to reinforcement GPs

I'd like to see this idea implemented for testing, and if what you said was true, then we just implement this and hold fire button so it doesn't waste shots?

Also i don't understand why would it blow up my own troops and what does GPs have anything to do with it, can you explain?

ZekeDlyoung commented 3 years ago

How is it supposed to aquire something it can't see if its vision equals its range?

Unknown, probably a game engine thing. I experimented with it with my mod before. Or maybe I'm remembering wrong, and I'm remembering the results of having equal weapon and vision range but smaller shroud clearing range 🤷 Though ShockWave once had larger guard range for Artillery, but it made them derpy (artillery would constantly go in front of defences, move closer towards enemy units before actually firing), so they got changed back.

Also i don't understand why would it blow up my own troops and what does GPs have anything to do with it, can you explain?

Imagine you have a bunch of nuke cannons in your base, then someone drops a paradrop or rebel ambush inside your base within range of your nuke cannons. If you're not there to notice and stop them, the nuke cannons will fire at the enemy units accidentally blowing up parts of your base

ZekeDlyoung commented 3 years ago

Another scenario, you have 2 nuke cannons blocking a choke point, one on each side, the AI paradrops infantry directly ontop of one of your nuke cannons (which it sometimes does for some reason), so your second nuke cannon will fire on the infantry, destroying your other nuke cannon and other defenders in the area

MTKing4 commented 3 years ago

Imagine you have a bunch of nuke cannons in your base, then someone drops a paradrop or rebel ambush inside your base within range of your nuke cannons. If you're not there to notice and stop them, the nuke cannons will fire at the enemy units accidentally blowing up parts of your base

Nuke cannon shots don't destroy buildings from the first shot, and all units with guard mode will cause the same issue anyway so i don't that as an issue

Another scenario, you have 2 nuke cannons blocking a choke point, one on each side, the AI paradrops infantry directly ontop of one of your nuke cannons (which it sometimes does for some reason), so your second nuke cannon will fire on the infantry, destroying your other nuke cannon and other defenders in the area

This can happen even without the fix, so it shouldn't be a deterrent for us to apply the fixes

ImTimK commented 3 years ago

Is there a way to make it so that the nuke cannon first moves to the guard area center, then deploys and then shoots?

Plus extending the radius to 350?

I guess that's a sort of auto-defense feature, but isn't guard mode supposed to be that? It works like that for any unit but artillery ones (still works fine for inferno's, tommies and scuds because they don't have this awfully slow animation).

ZekeDlyoung commented 3 years ago

1.04

Attack range: 150 - 350 Guard radius: 180 Shroud clearing range: 350

Actually for the Nuke Cannon it's:

Attack Range: 400 Guard Range/Vision Range: 180 Shroud Clearing Range: 350

So I guess just extending guard range to 350 is an option. It will still do the "deploy dance", but I don't think it affects reload time that much tbh

Strange, I always thought that artillery had less shroud clearing than normal units, but actually it has more than most 🤔

commy2 commented 3 years ago

Actually for the Nuke Cannon it's: Attack Range: 400

https://github.com/TheSuperHackers/GeneralsGamePatch/blob/main/Patch104pZH/GameFilesOriginalZH/Data/INI/Weapon.ini#L3789-L3790

ZekeDlyoung commented 3 years ago

Actually for the Nuke Cannon it's: Attack Range: 400

https://github.com/TheSuperHackers/GeneralsGamePatch/blob/main/Patch104pZH/GameFilesOriginalZH/Data/INI/Weapon.ini#L3789-L3790

You said 104, not 104p, I extracted my ini files from my ZH 104 big files

EDIT: Never mind, it's my files that are wrong 🙃

ZekeDlyoung commented 3 years ago

Ok after more research, it seems extending guard range is a valid solution, but the issue is, vision/guard range uses different units from weapon/shroud clearing range. So say you set vision range to 350, same as weapon/shroud clearing, Nuke Cannon will still detect units much farther than 350 which will cause them to leave their position and move ahead to attack those units, instead of staying put and attacking units as they come into range.

So we need to figure out more or less how much longer the vision range is compared to weapon range to adjust it.

EDIT: Would be nice of someone can test this to confirm

MTKing4 commented 3 years ago

Guard Range/Vision Range: 180 Shroud Clearing Range: 350

What is the difference between Vision range and shroud clearing range?

Think I'll make some tests today Fun fact I've done some tests the other day and it turns out that when nuke cannon packs up to kill the next unit it actually just gets closer, unpacks then do nothing at all :D

commy2 commented 3 years ago

What is the difference between Vision range and shroud clearing range?

VisionRange = radius of Guard mode (and a few other minor things like the default detection radius) ShroudClearingRange = how far the unit reveals the fog of war

MTKing4 commented 3 years ago

Ok, so basically if we increase the Guard range to 350 it will use its maximum attack range all the time without needing to manually attack?

commy2 commented 3 years ago

Yeah. Wouldn't fix any of the glitches though. And the Guard radius decal would look really ugly since you're blowing up the texture by factor roughly (2x2)²=16.

ZekeDlyoung commented 3 years ago

Ok, so basically if we increase the Guard range to 350 it will use its maximum attack range all the time without needing to manually attack?

In theory yes, but as I mentioned since vision range units are longer than shroud clearing range units, even of you use the same value for both, vision range will still be longer, which will allow it to engage units inside shroud, and also make it move out of its spot to engage targets further ahead, something you don't want a guarding artillery unit to do. Currently we estimate that vision range units are 1.2x longer than shroud clearing units

MTKing4 commented 3 years ago

Yeah. Wouldn't fix any of the glitches though. And the Guard radius decal would look really ugly since you're blowing up the texture by factor roughly (2x2)²=16.

Hmm maybe we can make a new Art for the Guard mode? Or just enhance and upscale it

In theory yes, but as I mentioned since vision range units are longer than shroud clearing range units, even of you use the same value for both, vision range will still be longer, which will allow it to engage units inside shroud, and also make it move out of its spot to engage targets further ahead, something you don't want a guarding artillery unit to do. Currently we estimate that vision range units are 1.2x longer than shroud clearing units

Ok then we just make it a little bit smaller than Shroud Clearing range, that should help i think

MTKing4 commented 3 years ago

ok so nuke cannons will redeploy anyway even when it has units in range

https://user-images.githubusercontent.com/83613147/133425864-dcca226e-9537-46ae-8787-6fcda63575e2.mp4

MTKing4 commented 2 years ago

Zeke

Also test the nuke cannon jusy staying still guarding and have units come towards it and see how it acts

https://user-images.githubusercontent.com/83613147/133617352-19090f26-dee1-4d56-81b0-4d8d39139bc9.mp4

ImTimK commented 2 years ago

Zeke

Also test the nuke cannon jusy staying still guarding and have units come towards it and see how it acts

NukeCannonStationary_1.mp4

Yea that's just so awful and it's not even a 'retreat' mechanic, it just tries to get to the minimum range of the first unit in sight right?

It shouldn't act like that, it should engage those in the back that already are within it's engagement range.

Actually, would it be possible to make the Nuke cannon 'blind' within the minimum engagement range?

MTKing4 commented 2 years ago

Yea that's just so awful and it's not even a 'retreat' mechanic, it just tries to get to the minimum range of the first unit in sight right?

it seems like that yeah and i agree, it should engage the further units whom are still in range and not the closest one

xezon commented 2 years ago

This issue eventually can go into a survey question if we talk about deploy buttons.

RisingZH commented 2 years ago

Not sure I like a deploy button (it’s not a trebuchet) and definitely don’t like a hold fire button.

I think ideal behaviour would be that it just deploys in the middle of guard mode circle, shoots whatever comes into range, and never moves unless told to.

Not sure I see the fact it would shoot stuff in shroud a massive issue, isn’t this just how units in guard mode work in zh? Does a scud launcher fire at stuff under fog?

ZekeDlyoung commented 2 years ago

There's no way to make the nuke cannon engage further targets first sadly.

I don't think this issue requires a survey, we just need to find the ideal vision range is so that it can use guard mode at max range without moving away from its spot while guarding.

From our own past experiments it seems that, even if they have the same value, vision range is 1.2x larger than shroud clearing range. So maybe try testing it with 280 or 300 as vision range.

As for the reload animation bug, can you try replacing the nuke cannons's art module with this and see if it makes it better?

  Draw = W3DTankDraw DrawTag_Main ; Cleaned up art codes to hopefully reduce Nuke Cannon dancing

    InitialRecoilSpeed = 120
    MaxRecoilDistance  = 8
    RecoilSettleSpeed  = 6

    OkToChangeModelColor = Yes

    ;ExtraPublicBone = Turret01

    DefaultConditionState
      Model = NVNukeCn
      Animation = NVNukeCn.NVNukeCn
      AnimationMode = MANUAL
      Flags = START_FRAME_FIRST
      WeaponLaunchBone = PRIMARY Muzzle
      WeaponMuzzleFlash = PRIMARY MuzzleFX
      WeaponFireFXBone = PRIMARY Muzzle
      WeaponRecoilBone = PRIMARY Barrel
      WeaponLaunchBone = SECONDARY Muzzle
      WeaponMuzzleFlash = SECONDARY MuzzleFX
      WeaponFireFXBone = SECONDARY Muzzle
      WeaponRecoilBone = SECONDARY Barrel
      HideSubObject = TURRET01 ; Hide controlled turret
      ShowSubObject = TURRETFRONT TURRETBACK ; Show pack/unpack animated turret
      Turret = Turret01
      TurretPitch = TurretEL
    End

    ConditionState = REALLYDAMAGED
      Model = NVNukeCn_D
    End

    ; *** UNPACKING STATE -- preparing to fire ***
    ConditionState = UNPACKING
      AnimationMode = ONCE
    End

    ConditionState = UNPACKING REALLYDAMAGED
      Model = NVNukeCn_D
      Animation = NVNukeCn_D.NVNukeCn_D
      AnimationMode = ONCE
    End

    ;*** PACKING STATE -- preparing to move ***
    ConditionState = PACKING
      AnimationMode = ONCE_BACKWARDS
      Flags = START_FRAME_LAST
    End

    ConditionState = PACKING REALLYDAMAGED
      Model = NVNukeCn_D
      Animation = NVNukeCn_D.NVNukeCn_D
      AnimationMode = ONCE_BACKWARDS
      Flags = START_FRAME_LAST
    End

    ;*** DEPLOYED STATE -- ready to fire ***
    ConditionState  = DEPLOYED 
      Flags = START_FRAME_LAST
      HideSubObject = TURRETFRONT TURRETBACK ; Hide pack/unpack animated turret
      ShowSubObject = TURRET01 ; Show controlled turret
    End

    ConditionState  = DEPLOYED REALLYDAMAGED
      Model = NVNukeCn_D
      Animation = NVNukeCn_D.NVNukeCn_D
      Flags = START_FRAME_LAST
      HideSubObject = TURRETFRONT TURRETBACK ; Hide pack/unpack animated turret
      ShowSubObject = TURRET01 ; Show controlled turret
    End

    TrackMarks = EXTnkTrack.tga
    TreadAnimationRate = 4.0 ; amount of tread texture to move per second
  End
ImTimK commented 2 years ago

It's not possible to make the nuke cannon 'blind' within the minimum engagement range?

Cause this will atleast prevent the behavior of trying to move back and redeploy if a unit comes too close, this is undesired and pointless behavior.

ZekeDlyoung commented 2 years ago

The Nuke Cannon needs some distance to not blow itself up 😛

Its minimum range could be shortened, but that's about it. It's the player's job to make sure the enemy doesn't get too close anyway

EDIT: If it can engage targets farther, having the enemies close in would be less of a problem anyway

ImTimK commented 2 years ago

The Nuke Cannon needs some distance to not blow itself up 😛

Its minimum range could be shortened, but that's about it. It's the player's job to make sure the enemy doesn't get too close anyway

EDIT: If it can engage targets farther, having the enemies close in would be less of a problem anyway

So what I mean is to have a minimum vision range just like you have a minimum weapon range. If you match both (to be 150-350) then in theory the nuke cannon should ignore enemies within 150. But probably not possible.

ZekeDlyoung commented 2 years ago

Nope, not possible

xezon commented 2 years ago

Zeke:

Theoretically, if you make the view range/guard radius, exactly the same as its weapon range, the Nuke cannon shouldn't have to move before firing while guarding, this is already how it acts in VZH, albeit with reduced range.

The problem is the measurement units used by view range is not the same as the units used by weapon range, view range units are a bit bigger, so even if you set both to the same value, the view range will be bigger and the Nuke Cannon will move to attack targets outside of its weapon range

All that needs to be done to fix this is to find the exact difference between the view range units and the weapon range units, and equalize them

xezon commented 2 years ago

Nuke Cannon on Guard with Attack Range 100
Lotus Vehicle Hack Range 100

Nuke Cannon VisionRange 50 = not shooting
Nuke Cannon VisionRange 60 = not shooting
Nuke Cannon VisionRange 70 = not shooting
Nuke Cannon VisionRange 80 = SHOOTS
Nuke Cannon VisionRange 75 = not shooting
Nuke Cannon VisionRange 77 = not shooting
Nuke Cannon VisionRange 78 = SHOOTS
Nuke Cannon VisionRange 77.5 = SHOOTS
Nuke Cannon VisionRange 77.498 = not shooting
Nuke Cannon VisionRange 77.499 = SHOOTS

Magic VisionRange is 77.499
Factor is 1,290339230183615

Nuke Cannon on Guard with Attack Range 200
Lotus Vehicle Hack Range 200

Nuke Cannon VisionRange 150 = SHOOTS
Nuke Cannon VisionRange 140 = SHOOTS
Nuke Cannon VisionRange 130 = not shooting
Nuke Cannon VisionRange 135 = SHOOTS
Nuke Cannon VisionRange 132 = not shooting
Nuke Cannon VisionRange 133 = not shooting
Nuke Cannon VisionRange 134 = SHOOTS
Nuke Cannon VisionRange 133.5 = SHOOTS
Nuke Cannon VisionRange 133.498 = SHOOTS
Nuke Cannon VisionRange 133.425 = SHOOTS
Nuke Cannon VisionRange 133.25 = not shooting
Nuke Cannon VisionRange 133.33 = SHOOTS
Nuke Cannon VisionRange 133.30 = SHOOTS
Nuke Cannon VisionRange 133.29 = SHOOTS
Nuke Cannon VisionRange 133.27 = SHOOTS
Nuke Cannon VisionRange 133.26 = SHOOTS
Nuke Cannon VisionRange 133.259 = SHOOTS
Nuke Cannon VisionRange 133.255 = not shooting
Nuke Cannon VisionRange 133.257 = SHOOTS
Nuke Cannon VisionRange 133.256 = SHOOTS

Magic VisionRange is 133.256
Factor is 1,500870504892838

Nuke Cannon on Guard with Attack Range 250
Lotus Vehicle Hack Range 250

Nuke Cannon VisionRange 154 = not shooting
Nuke Cannon VisionRange 155 = not shooting
Nuke Cannon VisionRange 160 = not shooting
Nuke Cannon VisionRange 180 = SHOOTS
Nuke Cannon VisionRange 170 = SHOOTS
Nuke Cannon VisionRange 165 = SHOOTS
Nuke Cannon VisionRange 162 = SHOOTS
Nuke Cannon VisionRange 161 = SHOOTS
Nuke Cannon VisionRange 160.999 = SHOOTS
Nuke Cannon VisionRange 160.5 = SHOOTS
Nuke Cannon VisionRange 160.25 = not shooting
Nuke Cannon VisionRange 160.499 = SHOOTS
Nuke Cannon VisionRange 160.4 = not shooting
Nuke Cannon VisionRange 160.45 = not shooting
Nuke Cannon VisionRange 160.475 = not shooting
Nuke Cannon VisionRange 160.483 = not shooting
Nuke Cannon VisionRange 160.490 = not shooting
Nuke Cannon VisionRange 160.498 = not shooting

Magic VisionRange is 160.499
Factor is 1,55764210368912

Nuke Cannon on Guard with Attack Range 350
Lotus Vehicle Hack Range 350

Nuke Cannon VisionRange 350 = SHOOTS
Nuke Cannon VisionRange 300 = SHOOTS
Nuke Cannon VisionRange 250 = SHOOTS
Nuke Cannon VisionRange 200 = not shooting
Nuke Cannon VisionRange 225 = SHOOTS
Nuke Cannon VisionRange 210 = not shooting
Nuke Cannon VisionRange 220 = SHOOTS
Nuke Cannon VisionRange 215 = not shooting
Nuke Cannon VisionRange 219 = SHOOTS
Nuke Cannon VisionRange 217 = SHOOTS
Nuke Cannon VisionRange 216 = SHOOTS
Nuke Cannon VisionRange 215.1 = not shooting
Nuke Cannon VisionRange 215.5 = not shooting
Nuke Cannon VisionRange 215.9 = not shooting
Nuke Cannon VisionRange 215.999 = not shooting

Magic VisionRange is 216
Factor is 1,62037037037037
xezon commented 2 years ago

Growth is not linear

curve

xezon commented 2 years ago

Actually, might be linear :P

curve2

xezon commented 2 years ago

The best I can come up with now, but it produced inaccurate results

21.742 + AttackRange × 0.55757

21.742 + 200 × 0.55757 = 133.256 21.742 + 250 × 0.55757 = 161.1345 (expected 160.499) 21.742 + 350 × 0.55757 = 216.8915 (expected 216)

commy2 commented 2 years ago

Not sure what the axes are, but the intersection may represent the size of the unit.

commy2 commented 2 years ago

All that needs to be done to fix this is to find the exact difference between the view range units and the weapon range units, and equalize them

I doubt it is that simple. The repacking happens even when both targets where in range of both the guard radius and the attacking range.

xezon commented 2 years ago

Not sure what the axes are, but the intersection may represent the size of the unit.

X = AttackRange Y = VisionRange to match AttackRange

xezon commented 2 years ago

X1 = 100 Y1 = 77.499

X2 = 200 Y2 = 133.256

X3 = 250 Y3 = 160.499

X4 = 350 X4 = 216.000

ZekeDlyoung commented 2 years ago

I'll make my own experiments and post my own videos this weekend

xezon commented 2 years ago

Exile:

So this is the order at which the nuke cannon will target the units, unless another shoots at the nuke cannon, then it retaliates.

unknown

Now retaliation is going to happen in this situation because when it drives to get in range of target 2, target 3 will fire. If you place guard mode on top of your Nuke cannon this whole same idea applies, targetting based on vision doesn't apply here. How it should work ideally, is that it drives towards the center first, then deploys and then targets. Another super annoying thing is how the Nuke Cannon attempts to target a unit that comes too close, it does the same as a RPG, where it walks back to get minimum range, then shoots. The Nuke Cannon is just too slow to make this kind of behaviour useful. This also needs fixing, it should ignore units too close, but yea, it's just part of how Guard Mode works. Is there a way to copy behaviour of a Firebase? Then instead of the Guard Mode mechanic we replace that with an ability that behaves like a Firebase.

xezon commented 2 years ago

Zeke

Some mods have tried in the past to just make its vison range the same as its attack range because they believed that would make it so that the Nuke Cannon will auto attack based on its max attack range.

It did work somewhat, but, as Xezon's test showed, because vision range has some kind of factor that increases it over the attack range, what happens is the Nuke Cannon will now guard the area outside of its attack range, meaning it will undeploy and move to attack targets at the very edge of its guard range, something that you don't want the Nuke Cannon to be doing exactly because it is slow and cumbersome, this is the bug I am trying to fix with my proposal

xezon commented 2 years ago

Zeke

To add to the other topic though, there are several other things to take note of:

  1. There is a difference between commanding a unit to guard towards an area (press guard button, then press target area), and using double-click guard (enabled in options, double click the target area to activate)

Double-click guard is a combination of attack move and guard, so if you use double click guard, the unit will first use attack move until it gets to the target location and then it will guard, afaik this difference in behavior is not explained anywhere, I only ever found it in an unused tactical analysis string within the game files (can't remember if this was actually mentioned in the manual)

  1. You can turn retaliation on and off in the settings, this also changes unit behavior, in that they will no longer retaliate when fired upon, allow you better control over your units, at the cost of them acting a bit dumber

  2. There is an unused version of the guard command (or perhaps the patch has already added this idk) where the unit guards, but it does not retaliate. It is assumed that this command was meant to be used for artillery, however when the game was released it was changed so that every unit had the same guard command. But the command still works and a lot of mods use that

guardcommand

If you add NEED_TARGET_OBJECT to either guard button, you can make it so that you can target specific units as guard targets as it says in the notes Example:

  1. Select Comanche
  2. Press guard, target Crusader
  3. Comanche will now follow Crusader and attack units that get close

Guarding Terrain also still works.

PredatoR

do not add NEED_TARGET_OBJECT, it introduces a new crash