Range orders and accuracy

Discuss the future of Warzone 2100 with us.
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Range orders and accuracy

Post by Berserk Cyborg »

So like the secondary order restoration, I am attempting to bring back the optimum/short/long range feature. Thought I would share this in its own topic.

Here is my github branch based off my secondary orders restoration branch. Currently, it may or may not work. My previous tests seemed a little buggy due to shortHit, shortRange, and longHit changes, or the lack of them. So... I needed to bring all those values back. I made a Python3 script to pull all the necessary values from the CSV files into the current weapon JSON files (excuse how crude it is! :oops: ).

At this point it's more of a rebalance project. All the shortHit, shortRange, longHit, and longRange values need to be edited but, ultimately, I believe this fixes the last two major complaints from the 3.1 community: missing range feature, and accuracy.

range.zip
User avatar
Prot
Trained
Trained
Posts: 242
Joined: 29 Nov 2010, 12:41

Re: Range orders and accuracy

Post by Prot »

It's seems only shortHit stat is sets:
https://www.youtube.com/watch?v=_ZUUYBu7qT8

What i did, i set rocket longHit to 100 and shortHit to 0 and all distance the rocket pod is missed.
Then i set vice versa, and rocket are 100% chance hit in any distance.
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Range orders and accuracy

Post by Berserk Cyborg »

No, it is setting them correctly. See the Stats array in any of the script contexts in the debug window.

After some experiments I found it to be an older issue with guard (present in 3.2.3 but was masked by a future commit in master). There is a brief moment when a guarding unit, whose target moves out of range, stops attacking and returns to its guard position. Once it reaches that position this bug can happen. It's easier to observe if the guarding unit needs to rotate its weapon to face "forward" during this event.

If something moves into the guarding unit's weapon range during that exact moment then it won't attack anything unless given a new order, explicitly. Kind of hard to reproduce. Fortunately, this bug is much easier to notice now when using my weaponRangeRestore branch. I'll definitely look into this.
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Range orders and accuracy

Post by Berserk Cyborg »

Fixed that guard issue... maybe. In any case it is worth putting into the secondary orders restoration pull request. Anyway, I ran a few tests using a mini-rocket pod unit attacking a truck. Below is the current behavior that can be observed using the current patches in my branch.

Code: Select all

longRange: 1088
longHit: 10
shortRange: 512
shortHit 100
minRange: 128 (will not fire at something unless it is at least 1 tile from it)
Optimum range: The rocket-pod would try to get within shortRange before firing at the target (did not fire at long range distance).
Short range: Same as optimum.
Long range: The rocket-pod would fire at longRange, and if it gets within short range to the target, its accuracy used the shortHit value.

Then I swapped shortHit and longHit.

Code: Select all

longRange: 1088
longHit: 100
shortRange: 512
shortHit 10
minRange: 128
Optimum range: The rocket-pod would fire at the target as soon as it got within long range. If the target got within short range, the shortHit accuracy was used (did not move away to make its accuracy better).
Short range: The rocket-pod would only fire at the target if in shortRange distance.
Long range: Same as optimum

I tested a commander to check if range orders work on the units it is commanding. Seems to work.

Also, shortRange and longRange should never be the same value if shortHit and longHit are different. If they are, short range will take precedence and the weapon will use short range accuracy. Additionally, we wouldn't want shortRange to bigger than longRange's value, for sanity reasons.

What to do:
1. longhit, longRange, shortHit, and shortRange need to be tweaked for every weapon.
2. Optimum range needs to be improved so units move to the best accuracy range.
3. Stat checks for shortRange and longRange need to be implemented.
4. Optionally, make long range the default to keep with the "minimal impact" aspect.
User avatar
alfred007
Regular
Regular
Posts: 619
Joined: 31 Jul 2016, 06:25
Location: Stuttgart, Germany

Re: Range orders and accuracy

Post by alfred007 »

Berserk Cyborg wrote:What to do:
1. longhit, longRange, shortHit, and shortRange need to be tweaked for every weapon.
2. Optimum range needs to be improved so units move to the best accuracy range.
3. Stat checks for shortRange and longRange need to be implemented.
4. Optionally, make long range the default to keep with the "minimal impact" aspect.
Can I help you somehow?
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Range orders and accuracy

Post by Berserk Cyborg »

alfred007 wrote: 20 Mar 2019, 23:45 Can I help you somehow?
Not much at the moment.

Edit:
-Checks if the value for shortRange is bigger than longRange. Logs an error if any weapon does this.
-Added shortRange and shortHit to all weapons in campaign and multiplayer. As of right now, there is no distinction.
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Range orders and accuracy

Post by Berserk Cyborg »

Units set on Optimum range will fire their weapon while moving closer to enemies if the short range accuracy is better than long accuracy.

@Prot, are the current patches in my branch sufficient enough (for unit behavior)?
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Range orders and accuracy

Post by Berserk Cyborg »

PR at https://github.com/Warzone2100/warzone2100/pull/314. Windows users can click on the little yellow dot by the latest commit and choose the AppVeyor link, then select artifacts tab to get the latest builds.

There is also a secondary branch I'll be using to put none code related changes so as not to create too much noise on the official pull request.
alfred007 wrote: 20 Mar 2019, 23:45 Can I help you somehow?
Guess we can now discuss what should be what for the campaign weapons. Most of my current stats related commits are experimental to see if everything is working as it should. Included in the below mod is a helpful text file to summarize what I did for each weapon family.

I shied away from making differing accuracy/range changes for weapons that have projectiles with a potentially substantial arc, like mortars and howitzers, or impractical for it to change based on range, such as lasers and electronic weapons. Not that don't have to. Just making the case that not everything has to change depending on the range.
User avatar
alfred007
Regular
Regular
Posts: 619
Joined: 31 Jul 2016, 06:25
Location: Stuttgart, Germany

Re: Range orders and accuracy

Post by alfred007 »

@Berserk Cyborg

On the whole, I agree with your suggested values for shortRange, shortHit, and longHit. With a few exceptions which I found below:

I'm of the opinion that for all direct firing weapons longHit shouldn't be higher than shortHit. Therefore I disagree with the values for rockets and slow rockets. For missiles it's ok, I also think they need some space to correct the flight direction so longHit can be higher than shortHit. For lasers, it also makes no sense in my eyes to have a difference between shortHit and longHit. I think for all not guided indirect firing weapons like mortars, howitzers, etc we can have a difference between shortHit and longHit. Here also longHit can be higher than shortHit because those weapons are constructed to hit on long distances.

I also suggest we should set a minRange for all weapons, at the moment it's set for only 32 weapons. For direct firing weapons one tile (for short ranged weapons like flamers a half tile), for cyborgs and scavengers a half tile. For indirect firing weapons depending on the range. The first suggestion from me is 10% of longRange but I'm open for other opinions.
User avatar
Berg
Regular
Regular
Posts: 2204
Joined: 02 Sep 2007, 23:25
Location: Australia

Re: Range orders and accuracy

Post by Berg »

long range less accurate its logical.
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Range orders and accuracy

Post by Berserk Cyborg »

alfred007 wrote: 27 Apr 2019, 23:17 I'm of the opinion that for all direct firing weapons longHit shouldn't be higher than shortHit. Therefore I disagree with the values for rockets and slow rockets.
I reversed the longHit and shortHit values for rockets/slow-rockets so that they will follow the pattern of other direct weapons now.
alfred007 wrote: 27 Apr 2019, 23:17 I think for all not guided indirect firing weapons like mortars, howitzers, etc we can have a difference between shortHit and longHit. Here also longHit can be higher than shortHit because those weapons are constructed to hit on long distances.
How about this?

Code: Select all

Mortars

shortRange = longRange / 3 = 6 tiles
shortHit = longHit - 9 = 41%

Howitzers

shortRange = longRange / 4 = about 10 to 20 tiles
shortHit = longHit - 9 = 41%
Generally these weapons aren't supposed to be super close to targets (at least for campaign). If they are it usually means a gross tactical error on the player's part which can easily lead to the death of those units.
alfred007 wrote: 27 Apr 2019, 23:17 I also suggest we should set a minRange for all weapons, at the moment it's set for only 32 weapons. For direct firing weapons one tile (for short ranged weapons like flamers a half tile), for cyborgs and scavengers a half tile. For indirect firing weapons depending on the range. The first suggestion from me is 10% of longRange but I'm open for other opinions.
This to me is a completely different topic. Weapons which don't define minRange default to zero meaning
they can shoot at any range from their target. Which I think is ok. The weapons that define minRange originate from the rocket, missile, artillery, and flamer weapon lines. A lot of them can deal splash damage so minRange is probably used to prevent harming your own or allied stuff too much at close range, or, because it makes the weapon more realistic when shooting at something. However, I think 1/2 tile for cyborgs and scavengers and 1 tile for most everything else could work.
User avatar
alfred007
Regular
Regular
Posts: 619
Joined: 31 Jul 2016, 06:25
Location: Stuttgart, Germany

Re: Range orders and accuracy

Post by alfred007 »

Berserk Cyborg wrote:How about this?

Code: Select all

Mortars

shortRange = longRange / 3 = 6 tiles
shortHit = longHit - 9 = 41%

Howitzers

shortRange = longRange / 4 = about 10 to 20 tiles
shortHit = longHit - 9 = 41%
Looks good to me. I think you should also change the values for Ripple Rockets, Angel Missile, and Archangel Missile the same way.


Berserk Cyborg wrote:This to me is a completely different topic. Weapons which don't define minRange default to zero meaning
they can shoot at any range from their target. Which I think is ok. The weapons that define minRange originate from the rocket, missile, artillery, and flamer weapon lines. A lot of them can deal splash damage so minRange is probably used to prevent harming your own or allied stuff too much at close range, or, because it makes the weapon more realistic when shooting at something. However, I think 1/2 tile for cyborgs and scavengers and 1 tile for most everything else could work.
Yeah, it's a different topic but I think it can be seen as a part of accuracy. The reason why I'm thinking about it is that I noticed several times the situation that two units standing very close to each other, the firing animation was working but they didn't fire. Looked very weird. I hope we can prevent this by using minRange.
I looked again into weapons.json and couldn't understand why one weapon has a minRange and the other not. If I understand it right splash damage is defined by the values radius and radiusDamage. Some weapons with radiusDamage have no minRange and some weapons without radiusDamage have a minRange. I think for consistency we should either define a minRange for all weapons (maybe without weapons on VTOLs) or set minRange only for weapons with radiusDamage and Flamers. But the current system makes no sense in my eyes.
User avatar
Berserk Cyborg
Code contributor
Code contributor
Posts: 938
Joined: 26 Sep 2016, 19:56

Re: Range orders and accuracy

Post by Berserk Cyborg »

alfred007 wrote: 04 May 2019, 21:20 Looks good to me. I think you should also change the values for Ripple Rockets, Angel Missile, and Archangel Missile the same way.
Ah, good catch. Made them follow the same convention as I did with mortars and howitzers. There is also the mini-rocket artillery. Given its already small value for longRange compared to other artillery weapons I ended up making it follow the other direct rocket weapons for its shortHit and shortRange values.

And that should be everything for the initial campaign stuff.

camWeaponRanges.wz
User avatar
Iluvalar
Regular
Regular
Posts: 1828
Joined: 02 Oct 2010, 18:44

Re: Range orders and accuracy

Post by Iluvalar »

Hi, you do this for nothing, the accuracy is bugged since the 3.0 branch, the value in the weapon stat does not reflect the accuracy of a weapon.

Having the AI use the range as if it was meaningful will just further more obfuscate the bug.
Heretic 2.3 improver and proud of it.
User avatar
alfred007
Regular
Regular
Posts: 619
Joined: 31 Jul 2016, 06:25
Location: Stuttgart, Germany

Re: Range orders and accuracy

Post by alfred007 »

Iluvalar wrote: 05 May 2019, 02:07 Hi, you do this for nothing, the accuracy is bugged since the 3.0 branch, the value in the weapon stat does not reflect the accuracy of a weapon.

Having the AI use the range as if it was meaningful will just further more obfuscate the bug.
If you think so please open an issue in the master repository at GitHub and show us what you exactly mean.
Post Reply