real_tabasco_sauce Posted November 3 Report Share Posted November 3 (edited) A problem 0ad has faced for a long time is that of overshooting. Since the range of a unit's target is checked after attack completion, as long as the target was in range then, ANY attack afterwards will work. This is not so noticeable in many cases, but for slow attacking units in particular, enemy units can travel a long way in that time, leading to things like this: Untitled video - Made with Clipchamp (3).mp4 Also, this problem is very clear with siege units, which have a slow fire rate, and crossbow units. In @ValihrAnt's recent video, you can see that ram ships are annoyingly able to damage units that are far away, resulting in chaotic and unpredictable gameplay. What I propose to fix this is 2 additional range checks that occur during the unit's repeat time. https://gitea.wildfiregames.com/0ad/0ad/pulls/7178 This doesn't completely solve the problem, but it greatly reduces it to where it is basically unnoticeable for pikemen: 20241103-1845-03.6204650.mp4 The additional range checks do slightly impact performance, but its actually less than I expected: After the recent improvements to performance, I think we can "spend" some performance cost for nice things like this. Players, would you accept a small performance cost like this in order to get more responsive and intuitive gameplay? If not, I could limit this to slow-firing units which are the biggest offenders. However, I do think faster firing units stand to gain from this even if the problems are not as noticeable for these units. Edited November 3 by real_tabasco_sauce 3 1 Quote Link to comment Share on other sites More sharing options...
BreakfastBurrito_007 Posted November 3 Report Share Posted November 3 Aye Quote Link to comment Share on other sites More sharing options...
Lion.Kanzen Posted November 3 Report Share Posted November 3 I thought they were heart attacks. ---joke--- So a unit with a slow attack and range could kill you at meters? Quote Link to comment Share on other sites More sharing options...
real_tabasco_sauce Posted November 3 Author Report Share Posted November 3 8 minutes ago, Lion.Kanzen said: So a unit with a slow attack and range could kill you at meters? Yep. As long as you were near that unit immediately after you first got attacked. Quote Link to comment Share on other sites More sharing options...
real_tabasco_sauce Posted November 4 Author Report Share Posted November 4 NoOvershoot.zip A mod for a27. You can apply this if you get the nightly build. 1 Quote Link to comment Share on other sites More sharing options...
real_tabasco_sauce Posted Thursday at 22:53 Author Report Share Posted Thursday at 22:53 (edited) I just had a question about how this affects unit chasing when cavalry are chasing infantry. It turns out the difference is pretty minimal and is hard to capture on video. The concern was that the range checks during the repeat time would cancel a jav cav's attack, making chasing buggy and ineffective. So, i did a quick test: 5 mercenary skirm cavalry chasing 20 regular skirmishers. with the change, it took 1:46.65 to kill all the units and without, it took 1:56.49. I don't think there is a mechanism for interrupting the jav cav's attack: once the cav can attack an enemy unit, the attack will take place. What this approach eliminates is the case where a cav can launch 2 projectiles from the same spot in a chasing scenario, with the second one being substantially farther than the unit's range. Edited Thursday at 22:53 by real_tabasco_sauce 1 Quote Link to comment Share on other sites More sharing options...
Atrik Posted Thursday at 23:39 Report Share Posted Thursday at 23:39 45 minutes ago, real_tabasco_sauce said: I don't think there is a mechanism for interrupting the jav cav's attack Interesting but If attacks aren't interrupted when a unit get out of range, what exactly prevent overshooting? 1 Quote Link to comment Share on other sites More sharing options...
Atrik Posted Thursday at 23:55 Report Share Posted Thursday at 23:55 Anyways, I think overshooting is a necessary evil to make the game playable. I though we already discussed this @real_tabasco_sauce. If the range check was done prior to the exact time where attack start to repeat, you fixed a great bug! But it's not changing overshooting, witch is also good. (Haven't checked your patch, just making assumptions based on what you write above). 1 Quote Link to comment Share on other sites More sharing options...
real_tabasco_sauce Posted Thursday at 23:57 Author Report Share Posted Thursday at 23:57 Well it’s not prevented 100% it’s just that there is less time for the unit to travel past the max range and therefore it’s not so egregious. ie overshoot by 0.5 sec isn’t as bad as overshoot by 1.5 sec. For bolts, it’s overshoot by 1 sec versus 6. 2 Quote Link to comment Share on other sites More sharing options...
Lion.Kanzen Posted Friday at 00:59 Report Share Posted Friday at 00:59 1 hour ago, real_tabasco_sauce said: Well it’s not prevented 100% it’s just that there is less time for the unit to travel past the max range and therefore it’s not so egregious. ie overshoot by 0.5 sec isn’t as bad as overshoot by 1.5 sec. For bolts, it’s overshoot by 1 sec versus 6. Do you think it could be optional?  1 Quote Link to comment Share on other sites More sharing options...
real_tabasco_sauce Posted Sunday at 05:15 Author Report Share Posted Sunday at 05:15 overshootFix_v2.zipThis new version based off of the com mod version 13 includes range checks during the leftover repeat time after a new target is acquired. 1 Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted Monday at 13:46 Report Share Posted Monday at 13:46 On 07/11/2024 at 7:59 PM, Lion.Kanzen said: Do you think it could be optional? Any reason why something fundamental like this should be optional? It's like making ballistic projectile movement optional... Quote Link to comment Share on other sites More sharing options...
Lion.Kanzen Posted Monday at 16:31 Report Share Posted Monday at 16:31 2 hours ago, wowgetoffyourcellphone said: Any reason why something fundamental like this should be optional? It's like making ballistic projectile movement optional... If it affects optimization I don't think it should be forced for now. Quote Link to comment Share on other sites More sharing options...
real_tabasco_sauce Posted Monday at 17:04 Author Report Share Posted Monday at 17:04 (edited) 33 minutes ago, Lion.Kanzen said: If it affects optimization I don't think it should be forced for now. Its more about making sure that units obey their designed ranges. Edited Monday at 17:04 by real_tabasco_sauce 1 Quote Link to comment Share on other sites More sharing options...
Atrik Posted Monday at 17:52 Report Share Posted Monday at 17:52 1 hour ago, Lion.Kanzen said: If it affects optimization I don't think it should be forced for now I guess it's not going to kill performances but since most players agree performances is the priority, I guess @real_tabasco_sauce should not add it to community mod. It's only making any differences for bolts and catas. For all others units, there isn't anything changed about overshooting (witch is also good for playability). Part of the overshooting was due to unit taking into account target movement and will still be added to unit range, therefor extending overall max range. This is unaffected by the patch. The other part of when unit is targeting a unit moving away and getting out of range is also, from my tests, unchanged. Only bolts and catas might interrupt their attack if the target move away early enough. Quote Link to comment Share on other sites More sharing options...
Philip the Swaggerless Posted Monday at 19:04 Report Share Posted Monday at 19:04 The distant overshoot attacks are ugly to look at for sure. Interestingly, it's already the case that something weird happens with sword cav pursuing enemies. The animation is canceled but the damage is still done. Looks very bad but not having the damage done would be more frustrating. The challenge is that all units except towers and boats units are stationary when they attack. On 03/11/2024 at 12:51 PM, real_tabasco_sauce said: After the recent improvements to performance, I think we can "spend" some performance cost for nice things like this. Players, would you accept a small performance cost like this in order to get more responsive and intuitive gameplay? Additional performance cost means the game will be LESS responsive, right? But sure, intuitive because the unit would not die when visibly out of range. Did you do this performance test with a large p3 4v4 online battle? If so an additional 0.7 ms per frame doesn't seem too bad. Otherwise I'm weary about it. On 03/11/2024 at 12:51 PM, real_tabasco_sauce said: Since the range of a unit's target is checked after attack completion, as long as the target was in range then, ANY attack afterwards will work. Help me understand the current sequence of things. So I know there is "prepare time" and "repeat time": Does "prepare time" represent the time spent in attack animation before either melee damage is dealt or a projectile is launched? By "after attack completion" do you mean after "prepare time?" Is "repeat time" is the duration immediately following "prepare time", during which the attack animation is completing and it's weapon is being brought back? And then does "prepare time" again immediately follow "repeat time" If the answer is yes to those questions, why 2 additional range checks? Why not 1 additional check at the end of repeat time? Or even better, why not get rid of the check at the end of "prepare time" and just have one range check at the end of "repeat time"? If the answer is no to those questions, instead of additional range checks could the animations be adjusted to represent what is happening better? For non-siege/boat attacks, could the animations be sped up at the beginning, perhaps with a slight pause at completion and then slowed during the reset? (Overshoot issue aside, striking animations tend to look better that way anyways.) 1 Quote Link to comment Share on other sites More sharing options...
Lion.Kanzen Posted Monday at 19:15 Report Share Posted Monday at 19:15 How much does it affect performance and in what cases? Quote Link to comment Share on other sites More sharing options...
real_tabasco_sauce Posted Monday at 19:36 Author Report Share Posted Monday at 19:36 (edited) 1 hour ago, Atrik said: I guess it's not going to kill performances but since most players agree performances is the priority, I guess @real_tabasco_sauce should not add it to community mod. It's only making any differences for bolts and catas. For all others units, there isn't anything changed about overshooting (witch is also good for playability). Part of the overshooting was due to unit taking into account target movement and will still be added to unit range, therefor extending overall max range. This is unaffected by the patch. The other part of when unit is targeting a unit moving away and getting out of range is also, from my tests, unchanged. Only bolts and catas might interrupt their attack if the target move away early enough. well, too late on the first part XD. I can't say definitely what the effect on performance is. https://gitea.wildfiregames.com/0ad/0ad/pulls/7178 In here you can see the profile of the more recent version and it appears to be a net improvement for some reason. This performance test is based on the "combat demo huge" which is 630 units vs 630 units all fighting at the same time. If the affect isn't detrimental to a27, i would hope its not terrible in a26, but we will find out. It is indeed making a major difference for bolts and catas, and my suspicion is it will make bolts much weaker and less frustrating to play against. However, you are wrong in thinking other units are unchanged. Certainly it is more noticeable for low fire rate units, but pikemen, crossbows, and in particular ram ships will be noticeably less able to attack beyond their intended range. I will be curious to learn if retreating in general will become less punishing because of this change. 32 minutes ago, Philip the Swaggerless said: Interestingly, it's already the case that something weird happens with sword cav pursuing enemies. This patch increases these situations a bit, with animations and sound being cut short when chasing. I will need to find a solution for this in the long run. 32 minutes ago, Philip the Swaggerless said: Does "prepare time" represent the time spent in attack animation before either melee damage is dealt or a projectile is launched? By "after attack completion" do you mean after "prepare time?" Is "repeat time" is the duration immediately following "prepare time", during which the attack animation is completing and it's weapon is being brought back? And then does "prepare time" again immediately follow "repeat time" yes and yes. Good questions. Actually part of question 2 is no: prepare time is only involved for the first attack. If the last repeat time is unfinished when a new order comes along and the remaining repeat time is longer than the prepare time, the remaining repeat time is used. 32 minutes ago, Philip the Swaggerless said: If the answer is yes to those questions, why 2 additional range checks? I did 2 as a test, but the current version adds as many checks as the number of seconds in the repeat time rounded up. So 1 for swords, 2 for slings, 3 for crossbows, 6 for bolt shooters. 32 minutes ago, Philip the Swaggerless said: Why not 1 additional check at the end of repeat time? In this case, you would often have a unit trying to shoot something, only for it to realize right before attacking that it needs to instead move closer to the target. 32 minutes ago, Philip the Swaggerless said: Or even better, why not get rid of the check at the end of "prepare time" and just have one range check at the end of "repeat time"? If you just get rid of the first one, the unit won't know that they need to chase the target until it is time to attack again. 32 minutes ago, Philip the Swaggerless said: If the answer is no to those questions, instead of additional range checks could the animations be adjusted to represent what is happening better? For non-siege/boat attacks, could the animations be sped up at the beginning, perhaps with a slight pause at completion and then slowed during the reset? Well, the animations don't cause the prepare and repeat time, the animations are adjusted to keep in sync with what the unit is doing. What happens here is that the animation and sound is longer than the prepare time, and since a unit might decide to move before the animation plays in full, the animation is cut short. Edited Monday at 19:37 by real_tabasco_sauce 2 Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted Monday at 19:37 Report Share Posted Monday at 19:37 Ideally, we need move-attack (not attack-move, a totally different thing). Essentially, units need the ability to attack while moving. Take melee cavalry for example, chasing down a fleeing enemy soldier. But until we have something like that, there needs to be ways to mitigate ugliness and not displaying strange things to the player. @real_tabasco_sauce is attempting to do that very thing. 2 Quote Link to comment Share on other sites More sharing options...
real_tabasco_sauce Posted Monday at 19:45 Author Report Share Posted Monday at 19:45 3 minutes ago, wowgetoffyourcellphone said: Ideally, we need move-attack (not attack-move, a totally different thing). Essentially, units need the ability to attack while moving. Take melee cavalry for example, chasing down a fleeing enemy soldier. But until we have something like that, there needs to be ways to mitigate ugliness and not displaying strange things to the player. @real_tabasco_sauce is attempting to do that very thing. It might be a nice capability to have, but I don't think its necessary in general. Units stopping to attack is important for gameplay. When is the last time animation ppl have helped out? I think the right thing is to do a little work in the animations and sound department: with more brief animations and sounds, things would look and feel smoother. Its similar to https://gitea.wildfiregames.com/0ad/0ad/issues/7113. Since swordcav already have their animation cut short when chasing sometimes, it seems this problem is only made more frequent by this patch, not caused by the patch. Quote Link to comment Share on other sites More sharing options...
Philip the Swaggerless Posted Monday at 19:54 Report Share Posted Monday at 19:54 (edited) 19 minutes ago, real_tabasco_sauce said: yes and yes. Good questions. Actually part of question 2 is no: prepare time is only involved for the first attack. If the last repeat time is unfinished when a new order comes along and the remaining repeat time is longer than the prepare time, the remaining repeat time is used. 19 minutes ago, real_tabasco_sauce said: 50 minutes ago, Philip the Swaggerless said: Why not 1 additional check at the end of repeat time? In this case, you would often have a unit trying to shoot something, only for it to realize right before attacking that it needs to instead move closer to the target. Thanks for the response. I'm still confused about when the vanilla distance check takes place. Is it after the entire attack animation completes or at the instant of melee impact? Is your update to do the distance check again while the attack is underway, (the animation has already begun) and then based on the distance checks occurring once per second of pre-impact animation cancel or continue the attack? Edited Monday at 19:55 by Philip the Swaggerless typo Quote Link to comment Share on other sites More sharing options...
real_tabasco_sauce Posted Monday at 20:08 Author Report Share Posted Monday at 20:08 (edited) 15 minutes ago, Philip the Swaggerless said: Thanks for the response. I'm still confused about when the vanilla distance check takes place. Is it after the entire attack animation completes or at the instant of melee impact? Is your update to do the distance check again while the attack is underway, (the animation has already begun) and then based on the distance checks occurring once per second of pre-impact animation cancel or continue the attack? The range check is done in vanilla immediately after an attack, so right before the repeat time takes place. The consequence is that the unit can go anywhere during that repeat time and the attack still goes through. ..... = prepare time ---- = repeat time | = attack O = check if the target is in range  vanilla: ..........|O-----------------------------------|O-----------------------------------|O With patch (ie pikeman): ..........|O-------O-----------------O---------|O--------O---------------O----------|O Edited Monday at 20:11 by real_tabasco_sauce Quote Link to comment Share on other sites More sharing options...
Atrik Posted Monday at 20:09 Report Share Posted Monday at 20:09 23 minutes ago, real_tabasco_sauce said: Certainly it is more noticeable for low fire rate units, but pikemen, crossbows I've tested for pikemen and crossbows and both overshoot cav running away. Pikes still hit in the wind and the cav far away takes the hit. Again not complaining about it, this is better then if the pike would never land a hit, but if your patch impact performance for no effects, then I don't understand the point. Maybe limit the range check for only the units that have the slowest attacking units (crossbow and pikes aren't included). Quote Link to comment Share on other sites More sharing options...
real_tabasco_sauce Posted Monday at 20:13 Author Report Share Posted Monday at 20:13 (edited) 7 minutes ago, Atrik said: I've tested for pikemen and crossbows and both overshoot cav running away. Pikes still hit in the wind and the cav far away takes the hit. Again not complaining about it, this is better then if the pike would never land a hit, but if your patch impact performance for no effects, then I don't understand the point. Maybe limit the range check for only the units that have the slowest attacking units (crossbow and pikes aren't included). You might be observing overshoot in the prepare time. Pikes take i think a second to prepare. I intentionally avoided checks during the prepare time because if the unit entered the attack range, it should be attacked. If you add checks to the prepare time, you could have attacks get canceled before they happen, which is not possible in the current setup. Also, are you testing the new version or the one in the com mod? The first version had a means for units to overshoot if they kill the unit they originally targeted. This was fixed in the later versions. Edited Monday at 20:17 by real_tabasco_sauce 1 Quote Link to comment Share on other sites More sharing options...
Atrik Posted Monday at 20:20 Report Share Posted Monday at 20:20 5 minutes ago, real_tabasco_sauce said: You might be observing overshoot in the prepare time. If the prepare time is reset every time a unit receive a order like halt, target, or move by itself, as I I think it is, then it's the main delay during witch overshoots occurs. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.