Skip to content

feat: implement tween continuous modes and texture offset - #946

Merged
kuruk-mm merged 31 commits into
mainfrom
feat/tween-continuous-modes
Dec 29, 2025
Merged

feat: implement tween continuous modes and texture offset#946
kuruk-mm merged 31 commits into
mainfrom
feat/tween-continuous-modes

Conversation

@kuruk-mm

@kuruk-mm kuruk-mm commented Dec 14, 2025

Copy link
Copy Markdown
Member

Summary

Implements the new continuous tween modes from protocol PR #313 and ADR #301:

  • MoveContinuous: Applies incremental position changes (direction * speed * delta_time) each frame
  • RotateContinuous: Applies incremental rotation using euler angles (direction_euler * speed * delta_time) each frame
  • TextureMoveContinuous: Applies incremental UV offset/tiling changes based on direction and speed
  • TextureMove: Interpolates UV offset/tiling between start and end values (standard tween)

Key changes:

  • Added last_update field to Tween struct for delta time calculation between frames
  • Added TextureAnimation state struct to store per-entity UV offset/scale
  • Continuous modes stay in TsActive state forever (never complete)
  • UV animation values are applied to materials via set_uv1_offset and set_uv1_scale
  • Proper cleanup of tween and texture animation state on entity deletion

Behavior table:

Mode Behavior
MoveContinuous Position += direction * speed * dt each frame
RotateContinuous Rotation += direction_euler * speed * dt each frame
TextureMoveContinuous (TMT_OFFSET) UV offset += direction * speed * dt each frame
TextureMoveContinuous (TMT_TILING) UV scale += direction * speed * dt each frame
TextureMove (standard) Interpolates UV between start and end based on progress

Test plan

  • Test MoveContinuous with a cube moving in a direction continuously
  • Test RotateContinuous with a cube rotating continuously
  • Test TextureMoveContinuous with a scrolling texture effect
  • Verify continuous tweens don't complete and keep animating
  • Verify pausing/resuming works for continuous tweens
  • Verify cleanup on entity deletion

- Change verbose INFO logs to DEBUG for TriggerArea CREATE/DELETE
- Fix clippy cloned_ref_to_slice_refs warnings using std::slice::from_ref
- Add #[allow(clippy::too_many_arguments)] to build_trigger_result
- Apply cargo fmt formatting
pool manager potential leak thread as an error
…ous, TextureMoveContinuous)

Add support for continuous tween modes that apply incremental changes each frame:
- MoveContinuous: position += direction * speed * delta_time
- RotateContinuous: rotation += direction_euler * speed * delta_time
- TextureMoveContinuous: UV offset/scale += direction * speed * delta_time
- TextureMove: interpolates UV between start and end values

Changes:
- Add last_update field to Tween struct for delta time calculation
- Add TextureAnimation state struct to scene.rs for UV animation
- Implement continuous modes that never complete (always TsActive)
- Apply UV offset/scale to materials via set_uv1_offset/set_uv1_scale
- Clean up tween and texture animation state on entity deletion
…angles

Euler angle approach caused gimbal lock and 'vibrating' effects.
Axis-angle extraction properly handles continuous rotation by:
1. Extracting axis and angle from direction quaternion
2. Scaling angle by speed * delta_time
3. Creating rotation step quaternion
4. Multiplying with current rotation
The SDK encodes the rotation axis in the quaternion's (x, y, z) components
with w=0, rather than as a proper quaternion. Speed is in degrees per second.
This fix extracts the axis directly and uses proper axis-angle rotation.
@github-actions

github-actions Bot commented Dec 15, 2025

Copy link
Copy Markdown
Contributor

📊 Benchmark Report

📊 Baseline: Comparing against main branch at commit f97a05c

Click to expand full benchmark report

Decentraland Godot Explorer - Benchmark Report

Generated: 2025-12-29_18-08-57

Total Tests: 5

📊 Comparison: vs main branch baseline

  • 🟢 = Improvement (better performance)
  • 🔴 = Regression (worse performance)
  • ⚪ = No significant change (<0.5%)

Table of Contents

  1. 1_Terms_and_Conditions
  2. 2_Lobby
  3. 3_Menu
  4. 4_Explorer_Goerli_Plaza
  5. 4_Explorer_Genesis_Plaza

Summary Overview

Memory Metrics

Test Process RSS (MiB) Godot Static (MiB) GPU VRAM (MiB) Rust Heap (MiB) Deno Total (MiB)
1_Terms_and_Conditions 388.24 82.36 24.55 0.99 -0.00
2_Lobby 487.57 112.96 45.51 2.13 🟢 (-0.9%) -0.00
3_Menu 1023.45 🔴 (+2.0%) 262.26 126.27 3.66 🔴 (+1.1%) -0.00
4_Explorer_Goerli_Plaza 1485.96 328.19 170.18 6.86 🔴 (+2.5%) 21.19 🟢 (-5.0%)
4_Explorer_Genesis_Plaza 3606.01 974.86 672.47 14.18 🔴 (+5.2%) 23.09 🔴 (+19.9%)

Object Counts

Test Total Objects Nodes Resources Orphan Nodes
1_Terms_and_Conditions 2366 127 583 12
2_Lobby 4574 804 768 44
3_Menu 12850 3873 1183 44
4_Explorer_Goerli_Plaza 19308 6340 🔴 (+0.5%) 1461 136
4_Explorer_Genesis_Plaza 46312 19835 3432 5029

Rendering Metrics

Test FPS Draw Calls Primitives Objects in Frame
1_Terms_and_Conditions 30.00 14 376 139
2_Lobby 30.00 15 644 218
3_Menu 18.00 🟢 (+12.5%) 95 4278 254
4_Explorer_Goerli_Plaza 4.00 🟢 (+33.3%) 425 159783 🟢 (-2.1%) 554
4_Explorer_Genesis_Plaza 2.00 🔴 (-33.3%) 1219 🟢 (-1.4%) 944636 🔴 (+0.6%) 1429 🟢 (-1.4%)

Resource Analysis

Test Meshes Materials Mesh RIDs Material RIDs Dedup Potential
1_Terms_and_Conditions 0 0 0 0 0
2_Lobby 0 0 0 0 0
3_Menu 0 0 0 0 0
4_Explorer_Goerli_Plaza 274 276 274 13 0
4_Explorer_Genesis_Plaza 1468 1931 591 476 0

Detailed Test Results

Test 1: 1_Terms_and_Conditions

Benchmark Report: 1_Terms_and_Conditions

Timestamp: 2025-12-29_18-06-30
Location: UI Scene


Memory Metrics

Metric Value
Process Memory Usage (RSS) 388.24 MiB
Godot Static Memory 82.36 MiB
Godot Peak Memory 87.68 MiB
GPU Video RAM 24.55 MiB
GPU Texture Memory 17.27 MiB
GPU Buffer Memory 7.28 MiB
Rust Heap Usage 0.99 MiB
Rust Total Allocated 2.27 MiB

Object Counts

Metric Count
Total Objects 2366
Resources 583
Nodes 127
Orphan Nodes 12

Rendering Metrics

Metric Value
FPS 30.00
Draw Calls per Frame 14
Primitives per Frame 376
Objects per Frame 139

Test 2: 2_Lobby

Benchmark Report: 2_Lobby

Timestamp: 2025-12-29_18-06-37
Location: UI Scene


Memory Metrics

Metric Value
Process Memory Usage (RSS) 487.57 MiB
Godot Static Memory 112.96 MiB
Godot Peak Memory 161.61 MiB
GPU Video RAM 45.51 MiB
GPU Texture Memory 37.45 MiB
GPU Buffer Memory 8.06 MiB
Rust Heap Usage 2.13 🟢 (-0.9%) MiB
Rust Total Allocated 20.09 🟢 (-0.9%) MiB

Object Counts

Metric Count
Total Objects 4574
Resources 768
Nodes 804
Orphan Nodes 44

Rendering Metrics

Metric Value
FPS 30.00
Draw Calls per Frame 15
Primitives per Frame 644
Objects per Frame 218

Test 3: 3_Menu

Benchmark Report: 3_Menu

Timestamp: 2025-12-29_18-06-44
Location: UI Scene


Memory Metrics

Metric Value
Process Memory Usage (RSS) 1023.45 🔴 (+2.0%) MiB
Godot Static Memory 262.26 MiB
Godot Peak Memory 271.27 MiB
GPU Video RAM 126.27 MiB
GPU Texture Memory 115.86 MiB
GPU Buffer Memory 10.41 MiB
Rust Heap Usage 3.66 🔴 (+1.1%) MiB
Rust Total Allocated 265.85 🔴 (+1.1%) MiB

Object Counts

Metric Count
Total Objects 12850
Resources 1183
Nodes 3873
Orphan Nodes 44

Rendering Metrics

Metric Value
FPS 18.00 🟢 (+12.5%)
Draw Calls per Frame 95
Primitives per Frame 4278
Objects per Frame 254

Test 4: 4_Explorer_Goerli_Plaza

Benchmark Report: 4_Explorer_Goerli_Plaza

Timestamp: 2025-12-29_18-07-15
Location: (72, -10)
Realm: https://sdk-team-cdn.decentraland.org/ipfs/goerli-plaza-main-latest


Memory Metrics

Metric Value
Process Memory Usage (RSS) 1485.96 MiB
Godot Static Memory 328.19 MiB
Godot Peak Memory 330.18 MiB
GPU Video RAM 170.18 MiB
GPU Texture Memory 153.98 MiB
GPU Buffer Memory 16.21 MiB
Rust Heap Usage 6.86 🔴 (+2.5%) MiB
Rust Total Allocated 339.71 🔴 (+1.1%) MiB
Deno/V8 Total Memory 21.19 🟢 (-5.0%) MiB
Deno Active Scenes 1
Deno Avg per Scene 21.19 🟢 (-5.0%) MiB

Object Counts

Metric Count
Total Objects 19308
Resources 1461
Nodes 6340 🔴 (+0.5%)
Orphan Nodes 136

Rendering Metrics

Metric Value
FPS 4.00 🟢 (+33.3%)
Draw Calls per Frame 425
Primitives per Frame 159783 🟢 (-2.1%)
Objects per Frame 554

Resource Analysis

Metric Value
Total Mesh References 274
Total Material References 276
Unique Mesh RIDs 274
Unique Material RIDs 13
Hashed Mesh Count 0
Potential Deduplication 0 (0.0% savings)

Test 5: 4_Explorer_Genesis_Plaza

Benchmark Report: 4_Explorer_Genesis_Plaza

Timestamp: 2025-12-29_18-08-44
Location: (-7, 0)
Realm: https://realm-provider-ea.decentraland.org/main


Memory Metrics

Metric Value
Process Memory Usage (RSS) 3606.01 MiB
Godot Static Memory 974.86 MiB
Godot Peak Memory 1178.39 MiB
GPU Video RAM 672.47 MiB
GPU Texture Memory 553.11 MiB
GPU Buffer Memory 119.36 MiB
Rust Heap Usage 14.18 🔴 (+5.2%) MiB
Rust Total Allocated 778.65 🟢 (-7.8%) MiB
Deno/V8 Total Memory 23.09 🔴 (+19.9%) MiB
Deno Active Scenes 1
Deno Avg per Scene 23.09 🔴 (+19.9%) MiB

Object Counts

Metric Count
Total Objects 46312
Resources 3432
Nodes 19835
Orphan Nodes 5029

Rendering Metrics

Metric Value
FPS 2.00 🔴 (-33.3%)
Draw Calls per Frame 1219 🟢 (-1.4%)
Primitives per Frame 944636 🔴 (+0.6%)
Objects per Frame 1429 🟢 (-1.4%)

Resource Analysis

Metric Value
Total Mesh References 1468
Total Material References 1931
Unique Mesh RIDs 591
Unique Material RIDs 476
Hashed Mesh Count 0
Potential Deduplication 0 (0.0% savings)


📋 Logs & Artifacts

  • 📊 CSV Data: benchmark_report.csv - Raw benchmark data in S3
  • 🔧 Full Logs: benchmark_run.log - Complete benchmark run output (build + execution)
  • 🌐 Workflow Run: View full logs
  • 📦 Download All: Get the benchmark-report artifact from the workflow run

🔄 Updated: 2025-12-29 18:09:03 UTC

@kuruk-mm kuruk-mm changed the title feat: implement tween continuous modes feat: implement tween continuous modes and texture offset Dec 15, 2025
- Add TriggerDetector collision to avatars for trigger area detection
- Track avatar entity IDs via metadata (dcl_entity_id, dcl_scene_id)
- Implement scene-awareness: only fire events for entities in active scene
- Separate physical state (entities_inside) from logical state (entities_entered)
- Generate synthetic ENTER/EXIT events when entities change scenes while
  physically inside trigger areas
- Query avatar current scene via metadata to handle remote avatar scene changes
- Cache avatar scene info in AvatarTriggerInfo struct to avoid per-frame metadata queries
- Batch metadata queries across all trigger areas (query each avatar once, not per-area)
- Only query metadata when cache indicates potential state change:
  - If cache says avatar in scene: query to verify they haven't left
  - If cache says avatar not in scene: query to check if they joined
  - Skip query entirely when cache matches expected state
…isable

Replace complex state tracking and per-frame polling with simple
physics enable/disable based on player scene.

When player leaves a parcel scene:
- Generate EXIT for all entities inside trigger areas
- Disable physics monitoring (area_set_monitor_callback invalid)

When player enters a parcel scene:
- Re-enable physics monitoring
- PhysicsServer3D auto-fires ENTERs for overlapping bodies

Removed (~460 lines):
- AvatarTriggerInfo struct with last_known_scene cache
- entities_entered HashSet (dual state tracking)
- sync_entity_states() function (~190 lines of polling)
- get_avatar_current_scene() metadata query function
- Scene-awareness checks in process_callback_events()
- _on_avatar_scene_changed callback in avatar.gd

Added (~186 lines):
- check_scene_active() function for enable/disable logic
- is_active flag on TriggerAreaInstance
- last_player_scene_id field on Scene

Result: ~26% code reduction, simpler mental model, no per-frame
metadata queries, more responsive scene transitions.
Base automatically changed from feat/trigger-area to main December 18, 2025 17:32
Resolve merge conflicts:
- Use main's trigger detection approach (single-param setup, remove for NPCs)
- Keep both UV offset/tiling and transparency handling in material.rs
- Add StuckDetector from main
- Keep TextureAnimation struct for tween feature
@kuruk-mm
kuruk-mm marked this pull request as ready for review December 23, 2025 19:26
@kuruk-mm
kuruk-mm requested a review from leanmendoza December 24, 2025 14:36
@github-actions

github-actions Bot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

📦 Build Report

🤖 Android

Artifact Status
APK 📱 Download APK
AAB 📦 Download AAB
Debug Symbols 🔧 Debug Symbols

Build Status: ✅ Success

🍏 iOS

iOS builds are triggered manually. Add the build-ios-internal label to trigger an iOS build.


🔗 Workflow Run: View logs

🔄 Updated: 2025-12-29 18:21:23 UTC

@kuruk-mm
kuruk-mm merged commit c849845 into main Dec 29, 2025
7 checks passed
@kuruk-mm
kuruk-mm deleted the feat/tween-continuous-modes branch December 29, 2025 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants