Skip to content

Reuse thick branch and trunk shell shapes - #1231

Open
BonsUnleashed wants to merge 1 commit into
DynamicTreesTeam:release/1.20.1from
BonsUnleashed:bons-furious/dynamictrees-thick-shape-memo
Open

BonsUnleashed wants to merge 1 commit into
DynamicTreesTeam:release/1.20.1from
BonsUnleashed:bons-furious/dynamictrees-thick-shape-memo

Conversation

@BonsUnleashed

Copy link
Copy Markdown

Thick branch collision shapes are determined by radius, but the same boxes are rebuilt each time the shape is requested. Trunk shells then build another box translated from that shape.

This creates the sixteen thick-branch shapes once and reuses them for radii 9 through 24. Shells reuse precomputed translated boxes when their muse returns one of those exact shapes and the offset is within the supported horizontal range. Custom muse shapes, larger offsets and unusual radii still use the original calculation. Muse lookup and its update scheduling run on every request as before.

The corresponding optimization is included in the upcoming Bons and Furious 1.0.30. This direct version shares immutable shapes across branch instances and never caches a world, position or mutable block lookup result.

compileJava passed against the current release/1.20.1 branch on Java 17.

Source-extracted shape methods passed checks for radii 1 through 32 and 3,528 offsets, including custom-shape, vertical and out-of-range fallbacks. Those checks use geometry stubs; I have not run an in-game collision or tree-generation check of this PR build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant