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

Getting the D2k damage model in line with the original Dune 2000 #17972

Closed
4 tasks done
penev92 opened this issue Apr 23, 2020 · 6 comments
Closed
4 tasks done

Getting the D2k damage model in line with the original Dune 2000 #17972

penev92 opened this issue Apr 23, 2020 · 6 comments

Comments

@penev92
Copy link
Member

penev92 commented Apr 23, 2020

I was recently inspired by a discussion on Discord involving #14692 and the future of the D2k mod to dig into the original Dune 2000 in order to figure out how its damage system works so we can mimic it and move forward.
So after getting the Gruntmods Edition and TibEd (linking in case anyone wants to verify what I have to say below) I spent a significant amount of time running various in-game tests of simply making units fire at other units or at the ground, tweaking values in TibEd and observing. After a lot of testing and a thorough discussion with @pchote (for better or worse in private, so I can't link) I can safely state the following as facts (people are free to verify for themselves; testing is pretty easy with the latest version of the Gruntmods Edition):

DUNE 2000

  • Weapons in Dune 2000 have inaccuracy and you can't turn it off. All weapons in Dune 2000 have some inherent inaccuracy. That is true even when the "Inaccurate" flag, as shown by TibEd, is False. That means that either there is a hardcoded inaccuracy, or TibEd is showing the wrong thing.
  • Inaccuracy increases with range. Weapons are pretty accurate at close range (starting from pinpoint accurate at 1 cell away for some) and go wildly inaccurate a few cells away (combat tanks have a half cell radius of their hit area when firing at full range!). Trivial to observe by force-firing on the ground from different distances for long enough.
    EDIT: After further testing it seems that inaccuracy scales ROUGHLY from 0 at 1 cell away to 0c512 at 5 cells away to 1c0 at 9 cells away. This may not be 100% accurate, but it seems like a pretty good approximation to me.
  • Weapons in Dune 2000 deal AoE/splash damage. The splash radius is actually configurable with TibEd. It is a property on the Warhead and is named "WHLong12", under "Unknown". (Yes, that took a while to figure out. Also note that a value of 32 world distance units is 1 cell in Dune 2000.)
  • Damage dealt does NOT change with the distance between the attacker and the victim. It was noted in Messy d2k building armor types #14681 and Add distance dependent damage to d2k #14692 that there likely is such a correlation. And I see where it might have come from - based on the above points, the damage dealt would depend on the accuracy of each shot, which greatly depends on the distance to the target. But I assure you there is no other correlation there. Not so trivial to prove, though, other than monitoring hundreds of shells being fired and noting the impact position and the damage dealt.
  • Splash damage drops linearly the further the target is from the impact. While weapons can do 100% damage on direct hit, they can deal next to 0 when the target is far away and the splash area is big enough or when the impact is inside the target's cell, selection bounds and even sprite, but is by not really "accurate" and the splash area is relatively small.
  • Damage is calculated at the target's center. For targets that occupy a single cell, damage is calculated according to the splash damage in the center of that cell. For buildings it's most likely the center of the cell that is being attacked. This is simple enough to test - set the splash area to 1 and you'll notice damage is ONLY being dealt on 100% accurate hits.
  • Buildings are targeted on their closest to the attacker cell. I am adding this because this used to be an important point of contest a while back.

Example: a tank dealing 2000 damage shooting at a tank with 2000 HP in a neighboring cell. Splash area is set to 320 (10 cells). Although not clearly visible, after some closer analysis this proves that the splash damage falloff is linear from the center to the edge, dealing 0 damage at the edge.
image
You can find screenshots of my earlier (and quite inconclusive because I was only firing at max range) tests on Discord shortly after the message linked above.

OpenRA

Now, with the facts about the original game out of the way, let's see what needs to be done in OpenRA and what we can currently do to approximate the system outlined above.

  • Weapons in OpenRA can have inaccuracy and it increases with range up to a set maximum. Just like described above. That is a 1:1 match with the original. Values may need to be tweaked, though, as it seems the original game has more generous inaccuracy than the D2k mod.
    EDIT: Since it seems that Dune 2000 doesn't have an upper limit to inaccuracy, the initial assumption here was wrong. We instead need a new setting on Inaccuracy.
  • Weapons in OpenRA do splash damage. Literally everything that shoots in all 4 official OpenRA mods uses the SplashDamageWarhead to this day. That also matches the original. Values may need to be tweaked, as it seems the original has smaller splash areas that the D2k mod.
  • Splash damage can already be linear from 100 to 0. While SplashDamageWarhead defaults to an exponential falloff (as explained by @pchote), and while that is even overriden on the D2k weapons to something else, it could easily be changed to the desired value to mimic the original game. So we have a complete match on this as well. Values for falloff will have to be tweaked.
  • Damage for our warheads is calculated based on closest HitShape edge. Unlike the center-based calculations of the original. This is where we have a potentially significant difference. Using the updated inaccuracy and splash values in OpenRA, this can easily result in a 50% damage difference to the original on a single inaccurate hit. The solution here would be to add a flag to SpreadDamageWarhead (how about also TargetDamageWarhead, meaning directly to the base DamageWarhead?) calculate the damage based on the target's CenterPosition (actually best to do it by closest TargetablePosition, which for the general case with the current D2k setup would be identical, but more flexible overall; or just add both as options).
  • Buildings are being targeted on their closest TargetablePosition. It seems that if there used to be an issue with this it was resolved when TargetablePositions were added. So we have a match with the original here as well. It seems that TargetablePositions are properly set too, so there is probably nothing needing to be done here unless I missed a building to check. Also this likely means that dealing damage at the TargetablePosition instead of the CenterPosition is maybe preferable.

I am writing this in the hopes that it is enough to finally put an end to all the "but we don't do damage like the original because of X or Y" arguments that have been getting in the way for the past few years. One of the goals is to close #14692 as #notAnIssue. Then a dedicated issue should be opened for the feature request about the TS/RA2 "Degenerates" thing.
As for the D2k mod, this is a summary of what needs to change so we can call the damage model "finished" as in "mimicking the original":

  • Tweak weapon (projectile) Inaccuracy values. This may need further testing in the original to see what those are, but the weapons I've tested so far would have a max inaccuracy of 0c512 WDist in OpenRA terms.
    Add an option to projectiles to use a InaccuracyStep property with no upper limit (and rename the current Inaccuracy property to MaxInaccuracy if I'm understanding it correctly).
    Add a flag to projectiles to denote whether the Inaccuracy property should be used as a maximum inaccuracy at max range or as an inaccuracy step per cell. (And then use that to adjust the inaccuracy for D2k weapons.) [D2k inaccuracy #18009]
  • Tweak weapon (warhead) Spread values. These can easily be taken from TibEd with the understanding that 32 world distance units in Dune 2000 are one cell, which is 1c0 or 1024 WDist in OpenRA. [D2k weapon damage spread and falloff #18010]
  • Tweak weapon (warhead) Falloff values. With the above reasonings we can conclude these should all be Falloff: 100, 0 for the D2k mod (except some potential special edge cases maybe??). [D2k weapon damage spread and falloff #18010]
  • Add a flag to DamageWarhead to define whether the current warhead should deal damage based on distance to HitShapes (current), CenterPosition or closest TargetablePosition and add the corresponding calculations. (Who knows, some community mod might even like this as a feature.) [D2k damage calculations #18023]

With the 4 admittedly simple changes outlined above I believe we can finally get our D2k's damage model to completely match the original game and finally get the ball rolling on "finishing" and then "reimagining" the game (I am pretty sure the Wiki says somewhere the repository readme says that our mods are "reimaginings" of the original games, while the website says we focus on providing "authentic experience" for D2k - we should really fix those statements, by the way).
As a side bonus of all of this, the different damage model is another step away from "RA with sand" which is a positive direction to move D2k into.
Also keep in mind that until we do all of the outlined changes, the damage model will be significantly different than the original, but that shouldn't force it all to be done in a single PR (or even in a single release cycle, if things drag on).
Of course this doesn't include unit/building armor types, weapon raw damage and weapon effectiveness against different armor types, as those are presumed to be done. If those should be tweaked further they could be included in this ticket so that at the end of it we have a complete match to the original game.
EDIT: @MustaphaTR has confirmed that actor HP and weapon damage have already been set to original values x10 a while back, armor types are as in the original and damage % vs armor types is set like in the original. That means there are no additional points that need to be looked into.

Since they are three of the people responsible for bringing this up, I would like to ping @MustaphaTR, @CH4Code and @Orb370 here.

@penev92
Copy link
Member Author

penev92 commented Apr 23, 2020

Updated the info about inaccuracy - I did some tests with turning up weapon ranges to very high values for a bunch of different weapons and the results are the same - at very long ranges accuracy is pretty much non-existent. I noticed inaccuracy seems to scale linearly with range and there doesn't seem to be a limit, so I updated the list of things that need to be done as well.

@pchote
Copy link
Member

pchote commented Apr 23, 2020

Rather than renaming Inaccuracy and adding a second type (what happens if both are defined?) it would be better to add a flag to set whether the single Inaccuracy field is interpreted as being at the max range or at 1 cell.... or implement a d2k-specific spread warhead subclass that hardcodes the hitshape and spread differences.

@penev92
Copy link
Member Author

penev92 commented Apr 23, 2020

Having a flag defining the meaning of Inaccuracy sounds reasonable. I don't particularly like the idea of making d2k-specific warheads/projectiles for logic that sounds like generic weapon logic. Updated the related task in the original post.

@penev92 penev92 mentioned this issue Apr 23, 2020
45 tasks
@reaperrr
Copy link
Contributor

reaperrr commented Apr 26, 2020

Add a flag to DamageWarhead to define whether the current warhead should deal damage based on distance to HitShapes (current), CenterPosition or closest TargetablePosition and add the corresponding calculations. (Who knows, some community mod might even like this as a feature.)

Buildings with >1 cell footprint might be a different story, but at least for 1-cell buildings and all units we could simply shrink the circle shape to a 32 WDist radius (or even just 16?).

We might still want that feature for downstream mods anyway, of course.

@penev92
Copy link
Member Author

penev92 commented Apr 29, 2020

I don't know if any downstream mods would want this (it is a pretty basic engine thing that RA does in one way and D2k does in another way, with neither of them being particularly "better").
But since we're going for full authenticity for D2k (for the moment), we should do it like it did rather than putting arbitrarily low values that I had an argument against but forgot; also covering the case for buildings is rather important ;)

@penev92
Copy link
Member Author

penev92 commented Jul 5, 2020

I believe this should be now done.

@penev92 penev92 closed this as completed Jul 5, 2020
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Jul 21, 2022
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Dec 15, 2023
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Dec 18, 2023
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Dec 20, 2023
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Jan 4, 2024
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Jan 4, 2024
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Jan 4, 2024
This reverts commit d46e72e.

basic map

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Jan 5, 2024
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Jan 5, 2024
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Jan 8, 2024
This reverts commit d46e72e.

basic map

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Jan 8, 2024
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Jan 17, 2024
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Jan 24, 2024
This reverts commit d46e72e.

basic map

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Jan 24, 2024
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Jan 24, 2024
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 1, 2024
This reverts commit d46e72e.

basic map

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 1, 2024
This reverts commit d46e72e.

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 1, 2024
This reverts commit d46e72e.

basic map

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 1, 2024
This reverts commit d46e72e.

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 1, 2024
This reverts commit d46e72e.

basic map

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 1, 2024
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 2, 2024
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 2, 2024
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 4, 2024
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 5, 2024
This reverts commit d46e72e.

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 5, 2024
This reverts commit d46e72e.

basic map

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 12, 2024
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 12, 2024
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 21, 2024
This reverts commit d46e72e.

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 21, 2024
This reverts commit d46e72e.

basic map

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 26, 2024
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 26, 2024
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Feb 26, 2024
Based on OpenRA#20021 . Changes are inline with OpenRA#17972

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Mar 8, 2024
This reverts commit d46e72e.

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Mar 8, 2024
This reverts commit d46e72e.

basic map

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Mar 13, 2024
This reverts commit d46e72e.

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Mar 13, 2024
This reverts commit d46e72e.

basic map

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Mar 13, 2024
Based on OpenRA#20021 . Changes are inline with OpenRA#17972

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

Revert "Align D2k weapons to better match original"

This reverts commit 0b224d3.
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Mar 13, 2024
Based on OpenRA#20021 . Changes are inline with OpenRA#17972

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

Revert "Align D2k weapons to better match original"

This reverts commit 0b224d3.
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Mar 19, 2024
This reverts commit d46e72e.

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Porenutak added a commit to Porenutak/OpenRA that referenced this issue Mar 19, 2024
This reverts commit d46e72e.

basic map

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972

Revert "Align D2k weapons to better match original"

This reverts commit d46e72e.

fix Ornithopter is not targetable

Make Ornithopter targetable by ani-air units.

Align D2k weapons to better match original

Based on OpenRA#20021 . Changes are inline with OpenRA#17972
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants