#769 closed defect (fixed)
[PATCH] Projectiles occasionally bounce
Reported by: | Philip Taylor | Owned by: | Markus |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Alpha 14 |
Component: | Core engine | Keywords: | patch |
Cc: | Patch: |
Description
It looks like projectiles randomly sometimes bounce when landing, which they're not meant to do. (Presumably some precision bug in the projectile motion code.)
Attachments (1)
Change History (13)
comment:1 by , 13 years ago
Milestone: | Alpha 5 → Backlog |
---|
comment:3 by , 11 years ago
In a recent match with Alpha 13 from the debian repos, my bolt shooters were shooting up in the air when asked to attack a building (they were shooting properly at units when auto defending a zone, but I haven't investigated further). It could be related, as the missiles go upwards like when they bounce, but they do it when they're launched. The target wasn't impacted, so the bug is not only graphical.
See screenshot : https://www.rhizogen.es/~ac/vrac/boltshooterbug06.png
comment:4 by , 11 years ago
The quoted formular above will not converge correctly for bigger dt. (The lags (and so dt) can get near the time of the whole flight.)
The more correct solution seems to always calculate the "whole flight" and not incrementally. The other problem is if dt is too big, the projectile is in one step in front of the target and in the next step already behind/below it.
by , 11 years ago
Attachment: | new-projectile-calculation.patch added |
---|
comment:5 by , 11 years ago
Keywords: | patch review added |
---|---|
Summary: | Projectiles occasionally bounce → [PATCH] Projectiles occasionally bounce |
The new calculation should prevent bounces or wrong positions during flight due to big lags.
The damage is done with a timer. It should work regardless of the lag or graphical calculation. (I only noticed a time difference between the hit and the damage is taken. That will let the projectile fly through the target and then suddenly vanish behind it. This behaviour already existed before.)
comment:6 by , 11 years ago
Milestone: | Backlog → Alpha 14 |
---|
comment:7 by , 11 years ago
Did you test if this fixes the originally reported bug? If so, is there an easy way to test that? :)
comment:8 by , 11 years ago
I had no test, just played and havent noticed it anymore.
(The problem zweigousefen reported is easily reproduced in a game with a big lag, the cosmetic part is fixed.)
comment:9 by , 11 years ago
Owner: | set to |
---|
comment:11 by , 11 years ago
Keywords: | review removed |
---|
In CCmpProjectileManager.cpp:212 (CCmpProjectileManager::AdvanceProjectile) we decrease timeLeft from a positive value over zero to a negative value. And we divide by it in line 234 :
If projectile.timeLeft is reasonable small (negative and close to zero) vh will first bounce up again.
This problem can also corrupt the x and z coordinates.
One simple solution could be to set the projectiles postion to the targets position for a small timeLeft. (The flight would not continue as no delta could be calculated.)