Page MenuHomeWildfire Games

Fix target height computation when launching projectiles.
ClosedPublic

Authored by wraitii on Jan 19 2021, 5:37 PM.

Details

Summary

The Y coordinate at which to fire a projectile is currently assumed to be the target's current Y position, which is incorrect if the target is moving on a slope.
This fixes that.

I'm wondering if we shouldn't actually fire a little above, just to make sure we don't hit the ground. The collision code doesn't really care (I do think we should probably rewrite it).

As noted by bb in rP24701

Test Plan

Review the change, notice that it indeed fixes things, note that firing projectiles still works in general.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

wraitii created this revision.Jan 19 2021, 5:37 PM
wraitii updated this revision to Diff 15531.Jan 19 2021, 5:40 PM

Fix tests

Build has FAILED

builderr-debug-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libsimulation2_dbg.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgraphics_dbg.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libatlas_dbg.a(precompiled.o) has no symbols
ld: warning: text-based stub file /System/Library/Frameworks//CoreAudio.framework/CoreAudio.tbd and library file /System/Library/Frameworks//CoreAudio.framework/CoreAudio are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox.tbd and library file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox are out of sync. Falling back to library

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/2971/display/redirect
See console output for more information: https://jenkins.wildfiregames.com/job/macos-differential/2971/display/redirectconsole

Build is green

builderr-debug-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libsimulation2_dbg.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgraphics_dbg.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libatlas_dbg.a(precompiled.o) has no symbols
ld: warning: text-based stub file /System/Library/Frameworks//CoreAudio.framework/CoreAudio.tbd and library file /System/Library/Frameworks//CoreAudio.framework/CoreAudio are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox.tbd and library file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox are out of sync. Falling back to library

See https://jenkins.wildfiregames.com/job/macos-differential/2972/display/redirect for more details.

wraitii requested review of this revision.Jan 19 2021, 6:01 PM
wraitii updated the Trac tickets for this revision.Jan 19 2021, 8:16 PM

I haven't followed the discussion, but this patch seems like a correct one to me.

source/simulation2/components/ICmpPosition.h
130 ↗(On Diff #15531)

The big question for me is whether we should target "position + 1" or something like that instead of position. It seems hacky, but it might actually help in a few cases.

Otherwise this can be merged relatively straighforwardly imo

Stan added a subscriber: Stan.Jan 21 2021, 1:06 PM

Could you make a comparative video between position and position +1 ?

source/simulation2/components/CCmpPosition.cpp
36–37 ↗(On Diff #15531)

(std::max)

Stan added a comment.Jan 22 2021, 12:44 AM

Might want to use the same function name in JS for consistency.

binaries/data/mods/public/simulation/components/Attack.js
561 ↗(On Diff #15531)
binaries/data/mods/public/simulation/components/tests/test_Damage.js
98 ↗(On Diff #15531)
source/simulation2/components/ICmpPosition.cpp
35 ↗(On Diff #15531)
wraitii updated this revision to Diff 15625.Jan 22 2021, 4:02 PM

I actually renamed the C++ to "GetHeightAtFixed", which makes more sense.

wraitii added a comment.EditedJan 22 2021, 4:05 PM

Height difference (__A is SVN).



TBH at the moment it looks pretty bad because the projectile doesn't disappear on hit...

Build is green

builderr-debug-macos.txt
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libsimulation2_dbg.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libgraphics_dbg.a(precompiled.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../binaries/system/libatlas_dbg.a(precompiled.o) has no symbols
ld: warning: text-based stub file /System/Library/Frameworks//CoreAudio.framework/CoreAudio.tbd and library file /System/Library/Frameworks//CoreAudio.framework/CoreAudio are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox.tbd and library file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox are out of sync. Falling back to library

See https://jenkins.wildfiregames.com/job/macos-differential/3019/display/redirect for more details.

This revision was not accepted when it landed; it landed in state Needs Review.Jan 22 2021, 7:16 PM
This revision was automatically updated to reflect the committed changes.