Skip to content

Destroy Game Piece When Falling of Map [SYNTH-216]#1404

Draft
AlexD717 wants to merge 1 commit into
devfrom
alexey/216/gampiece-falling
Draft

Destroy Game Piece When Falling of Map [SYNTH-216]#1404
AlexD717 wants to merge 1 commit into
devfrom
alexey/216/gampiece-falling

Conversation

@AlexD717

@AlexD717 AlexD717 commented Jul 10, 2026

Copy link
Copy Markdown
Member

Task

SYNTH-216

Symptom

Currently game pieces can be thrown out of the field and they will fall forever (which also breaks the camera if you are focused on a field).

Solution

Destroy game pieces when their y level is below a certain amount.

Verification

  • Dropping a game piece of the map (ex, using drag mode or ejecting it) results in it despawning
  • Robots still spawn back at their starting point (if they are holding a game piece it will respawn with them)

Before merging, ensure the following criteria are met:

  • All acceptance criteria outlined in the ticket are met.
  • Necessary test cases have been added and updated.
  • A feature toggle or safe disable path has been added (if applicable).
  • User-facing polish:
    • Ask: "Is this ready-looking?"
  • Cross-linking between Jira and GitHub:
    • PR links to the relevant Jira issue.
    • Jira ticket has a comment referencing this PR.

@AlexD717 AlexD717 self-assigned this Jul 10, 2026
@AlexD717
AlexD717 marked this pull request as ready for review July 10, 2026 22:33
@AlexD717
AlexD717 requested review from a team as code owners July 10, 2026 22:33

@PepperLola PepperLola left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't robots respawning with the gamepiece they're holding be dependent on both the update order of their respective position trackers and whether the root node of the robot was above or below the gamepiece?

Also, gamepiece body IDs never get removed from the field's mechanism's nodeToBody map, meaning anything that would need to reference that later would end up with a bad body ID. It's also used a lot in multiplayer code, which means you could probably end up with ghost gamepieces. I think we should go back over a lot the spawning/configuring/destroying stuff we have and make sure it would all work in multiplayer if we end up deciding to pursue that again.

const zones = World.sceneRenderer.filterSceneObjects(
(x): x is ScoringZoneSceneObject => x instanceof ScoringZoneSceneObject
)
zones.forEach(zone => ScoringZoneSceneObject.removeGamepiece(zone, bodyId))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removeGamepiece currently only actually removes a gamepiece from the scoring zone if !shouldPointsAccumulate meaning otherwise the gamepiece body ID would stay referenced even after it's been removed from the scene.

@AlexD717

Copy link
Copy Markdown
Member Author

Also, gamepiece body IDs never get removed from the field's mechanism's nodeToBody map, meaning anything that would need to reference that later would end up with a bad body ID. It's also used a lot in multiplayer code, which means you could probably end up with ghost gamepieces. I think we should go back over a lot the spawning/configuring/destroying stuff we have and make sure it would all work in multiplayer if we end up deciding to pursue that again.

There isn't really any easy and clean way to destroy game pieces right now, sync with multiplayer. Removing it from the nodeToBody map causes errors. Rather than doing a scuffed implementation, I am going to hold off until PR #1393 (Game piece asset support) gets merged, which will make this easy and clean to implement.

@AlexD717
AlexD717 marked this pull request as draft July 13, 2026 15:01
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.

2 participants