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

feat: arrow entity handling and damage. #772

Merged
merged 33 commits into from
Jan 18, 2025
Merged

feat: arrow entity handling and damage. #772

merged 33 commits into from
Jan 18, 2025

Conversation

andrewgazelka
Copy link
Collaborator

Arrow Entity handling and damage.

Arrow hitting blocks and damaging entities

Despawn Arrow and clamp velocity properly :)

hand animations 👍

fix bow?

first_collision rewrite. somewhat fixed arrow through floor

Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@andrewgazelka
Copy link
Collaborator Author

So I have a couple thoughts. Mainly, if the ray code doesn't have an issue right now, let's not change it. Or let's try to at least move it to a separate PR if you think it's an optimization and won't break anything. I don't want to have this PR have too many separate changes in it.

I also added benchmarking (#781). So if you're making a change like this, beyond the test passing, we should also see a big change in how long it takes to run the benchmarks, the micro benchmarks. Which will be pretty interesting.

Also, okay, I suppose you can move spatial in, but in the future let's try to make modules separate. We should put some effort to making them separate in the future.

@andrewgazelka andrewgazelka changed the title Arrow Entity handling and damage. feat: arrow entity handling and damage. Dec 22, 2024
@github-actions github-actions bot added the feat label Dec 22, 2024
crates/hyperion/tests/collision.rs Outdated Show resolved Hide resolved
crates/hyperion/tests/entity.rs Show resolved Hide resolved
@Tebarem Tebarem marked this pull request as ready for review January 2, 2025 10:44
Copy link

Benchmark Results for general

ray_intersection/aabb_size_0.1                     [  22.2 ns ...  25.5 ns ]     +14.81%*
ray_intersection/aabb_size_1                       [  22.4 ns ...  25.1 ns ]     +12.05%*
ray_intersection/aabb_size_10                      [  23.5 ns ...  22.7 ns ]      -3.09%
ray_intersection/ray_distance_1                    [   5.1 ns ...   5.1 ns ]      -0.14%
ray_intersection/ray_distance_5                    [   9.6 ns ...   9.1 ns ]      -4.88%
ray_intersection/ray_distance_20                   [   9.6 ns ...   9.1 ns ]      -5.00%
overlap/no_overlap                                 [  30.4 ns ...  31.3 ns ]      +2.77%
overlap/partial_overlap                            [  30.5 ns ...  31.3 ns ]      +2.49%
overlap/full_containment                           [  23.0 ns ...  23.0 ns ]      -0.01%
point_containment/inside                           [   5.9 ns ...   5.9 ns ]      +0.01%
point_containment/outside                          [   5.3 ns ...   5.3 ns ]      -0.07%
point_containment/boundary                         [   5.8 ns ...   5.8 ns ]      -0.10%

Comparing to d0838c5

@andrewgazelka
Copy link
Collaborator Author

🎯 Bounty Added!

Bounty Amount

This issue is now tracked by BountyBot. View and manage this bounty at:
http://localhost:3000/github/hyperion-mc/hyperion/issues/772

  • 3% weekly decay applies
  • Funds are held in escrow
  • 14-day review period after completion

Happy coding! 🚀

Copy link

Benchmark Results for general

ray_intersection/aabb_size_0.1                     [  22.2 ns ...  23.7 ns ]      +7.05%*
ray_intersection/aabb_size_1                       [  22.3 ns ...  23.6 ns ]      +5.59%*
ray_intersection/aabb_size_10                      [  23.1 ns ...  22.5 ns ]      -2.86%
ray_intersection/ray_distance_1                    [   5.1 ns ...   5.1 ns ]      +0.07%
ray_intersection/ray_distance_5                    [   9.6 ns ...   9.4 ns ]      -2.28%
ray_intersection/ray_distance_20                   [   9.6 ns ...   9.4 ns ]      -2.34%
overlap/no_overlap                                 [  30.5 ns ...  31.1 ns ]      +2.24%
overlap/partial_overlap                            [  30.2 ns ...  31.1 ns ]      +2.99%
overlap/full_containment                           [  22.9 ns ...  22.9 ns ]      +0.08%
point_containment/inside                           [   5.9 ns ...   5.9 ns ]      -0.05%
point_containment/outside                          [   5.3 ns ...   5.3 ns ]      -0.13%
point_containment/boundary                         [   5.8 ns ...   5.8 ns ]      +0.30%

Comparing to d0838c5

Copy link

Benchmark Results for general

ray_intersection/aabb_size_0.1                     [  22.1 ns ...  23.8 ns ]      +7.46%*
ray_intersection/aabb_size_1                       [  23.3 ns ...  24.8 ns ]      +6.14%*
ray_intersection/aabb_size_10                      [  23.3 ns ...  22.6 ns ]      -3.03%
ray_intersection/ray_distance_1                    [   5.1 ns ...   5.1 ns ]      +0.10%
ray_intersection/ray_distance_5                    [   9.6 ns ...   9.4 ns ]      -2.17%
ray_intersection/ray_distance_20                   [   9.6 ns ...   9.4 ns ]      -2.11%
overlap/no_overlap                                 [  31.2 ns ...  31.2 ns ]      -0.00%
overlap/partial_overlap                            [  31.0 ns ...  31.1 ns ]      +0.06%
overlap/full_containment                           [  23.8 ns ...  23.8 ns ]      +0.00%
point_containment/inside                           [   5.9 ns ...   5.9 ns ]      -0.13%
point_containment/outside                          [   5.3 ns ...   5.3 ns ]      -0.11%
point_containment/boundary                         [   5.8 ns ...   5.8 ns ]      +0.06%

Comparing to d0838c5

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

Attention: Patch coverage is 20.82192% with 289 lines in your changes missing coverage. Please review.

Project coverage is 24.62%. Comparing base (856ead9) to head (7197728).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
events/tag/src/module/bow.rs 0.00% 161 Missing ⚠️
crates/hyperion/src/egress/sync_entity_state.rs 24.54% 82 Missing and 1 partial ⚠️
crates/hyperion/src/simulation/blocks/mod.rs 20.00% 19 Missing and 1 partial ⚠️
crates/geometry/src/aabb.rs 69.23% 1 Missing and 7 partials ⚠️
crates/hyperion/src/simulation/handlers.rs 0.00% 8 Missing ⚠️
crates/geometry/src/ray.rs 72.72% 2 Missing and 4 partials ⚠️
crates/hyperion/src/simulation/mod.rs 66.66% 2 Missing ⚠️
events/tag/src/command/raycast.rs 0.00% 1 Missing ⚠️
@@            Coverage Diff             @@
##             main     #772      +/-   ##
==========================================
+ Coverage   23.50%   24.62%   +1.12%     
==========================================
  Files         160      159       -1     
  Lines       15829    15905      +76     
  Branches      374      362      -12     
==========================================
+ Hits         3720     3917     +197     
+ Misses      12011    11887     -124     
- Partials       98      101       +3     
Files with missing lines Coverage Δ
crates/hyperion/src/lib.rs 84.36% <ø> (ø)
crates/hyperion/src/simulation/animation.rs 0.00% <ø> (ø)
crates/hyperion/src/simulation/event.rs 0.00% <ø> (ø)
crates/hyperion/src/spatial/mod.rs 83.18% <100.00%> (ø)
crates/hyperion/src/storage/event/queue/mod.rs 90.62% <100.00%> (+0.62%) ⬆️
events/tag/src/lib.rs 0.00% <ø> (ø)
events/tag/src/command/raycast.rs 0.00% <0.00%> (ø)
crates/hyperion/src/simulation/mod.rs 35.06% <66.66%> (+0.06%) ⬆️
crates/geometry/src/ray.rs 77.08% <72.72%> (+21.26%) ⬆️
crates/geometry/src/aabb.rs 67.41% <69.23%> (+0.10%) ⬆️
... and 4 more

... and 7 files with indirect coverage changes

Copy link

Benchmark Results for general

ray_intersection/aabb_size_0.1                     [  22.1 ns ...  23.7 ns ]      +7.22%*
ray_intersection/aabb_size_1                       [  22.3 ns ...  23.7 ns ]      +5.89%*
ray_intersection/aabb_size_10                      [  23.5 ns ...  22.5 ns ]      -4.10%
ray_intersection/ray_distance_1                    [   5.1 ns ...   5.1 ns ]      +0.29%
ray_intersection/ray_distance_5                    [   9.8 ns ...   9.6 ns ]      -2.14%
ray_intersection/ray_distance_20                   [   9.6 ns ...   9.4 ns ]      -2.22%
overlap/no_overlap                                 [  31.1 ns ...  31.1 ns ]      -0.06%
overlap/partial_overlap                            [  31.1 ns ...  31.0 ns ]      -0.11%
overlap/full_containment                           [  23.8 ns ...  23.8 ns ]      +0.05%
point_containment/inside                           [   5.8 ns ...   5.8 ns ]      -0.06%
point_containment/outside                          [   5.3 ns ...   5.3 ns ]      +0.10%
point_containment/boundary                         [   5.8 ns ...   5.8 ns ]      -0.07%

Comparing to 856ead9

@Tebarem
Copy link
Collaborator

Tebarem commented Jan 18, 2025

@andrewgazelka ready 4 merge

@andrewgazelka andrewgazelka added this pull request to the merge queue Jan 18, 2025
Merged via the queue into main with commit a1bb588 Jan 18, 2025
12 checks passed
@andrewgazelka andrewgazelka deleted the arrows branch January 18, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants