Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Fix removeEntity bug #4337

Merged
merged 6 commits into from
Dec 7, 2021
Merged

Fix removeEntity bug #4337

merged 6 commits into from
Dec 7, 2021

Conversation

speigg
Copy link
Member

@speigg speigg commented Nov 30, 2021

If the same entity is removed twice, the ECS currently enters an invalid state.

ALSO, due to the design entity recycling in bitECS, there is no guarantee that an Entity won't be recycled before it appears in an exit query, meaning any getComponent calls in exit queries are potentially invalid.

This PR fixes these issues, mainly by adding an EntityRemovedComponent (and updating exit queries to respond to this) and deferring actual entity removal until the end of the frame.

Summary

A summary of changes being made in this PR

Checklist

  • Pre-push checks pass npm run check
    • Linter passing via npm run lint
    • Unit & Integration tests passing via npm run test:packages
    • Docker build process passing via npm run build-client
  • If this PR is still a WIP, convert to a draft
  • When this PR is ready, mark it as "Ready for review"
  • Changes have been manually QA'd
  • Changes reviewed by at least 2 approved reviewers

References

References to pertaining issue(s)

QA Steps

  1. git checkout pr_branch_name
  2. npm install
  3. npm run dev-reinit
  4. npm run dev

List any additional steps required to QA the changes of this PR, as well as any supplemental images or videos.

Reviewers

@HexaField @speigg @NateTheGreatt

If the same entity is removed twice, the ECS enters an invalid state. This fixes that.
@HexaField HexaField marked this pull request as draft December 3, 2021 02:35
@speigg speigg marked this pull request as ready for review December 6, 2021 23:29
@speigg speigg merged commit e4ac83b into dev Dec 7, 2021
@HexaField HexaField deleted the fix-remove-entity branch December 13, 2021 11:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants