Best practice for despawning entities #2658
-
I am new to game developing, especially ECS. I wonder what's the best practice of despawning objects. Say I want to make a simple space shooter, there are two ways an entities should be despawned:
So basically, I have two systems:
These two systems, IMHO, should be independent. But they both need to despwan the objects. However, if How I currently deal with it is to add a I searched the internet but couldn't find a satisfactory solution to it. So I'm looking to be imparted some insights from you veteran game developers :) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
That's a good question, I'm also new, but I can think in a simple, but maybe naive solution: 1- In other words, move the despawning to it's own system, based on the shared data between those systems. |
Beta Was this translation helpful? Give feedback.
-
This is very late, but I'd like to suggest an alternative. You can first create a |
Beta Was this translation helpful? Give feedback.
That's a good question, I'm also new, but I can think in a simple, but maybe naive solution:
1-
out_of_bounds
system, where you check if the object is out of bounds and despawn it;2-
remove_dead
system, where you just check if hp is zero and remove enemies;In other words, move the despawning to it's own system, based on the shared data between those systems.