DaanVanYperen / artemis-odb-contrib

Drop-in extensions for artemis-odb. Prefab systems, components, networking, events!
MIT License
75 stars 20 forks source link

Feature: Debug long-term entity id issues. #125

Open DaanVanYperen opened 5 years ago

DaanVanYperen commented 5 years ago

Option to hold deleted entity ids for X seconds before allowing them to be reused. This helps debugging dangling references that get recycled.

Namek commented 5 years ago

So it would crash on getting an entity by (invalid) id? Have you tried it in practice with some plugin of yours, maybe?

Is this really a common problem? Just curious for the sake of my project, also I'm not making enough games lately.

DaanVanYperen commented 5 years ago

So it would crash on getting an entity by (invalid) id?

It would report illegally access to the deleted entity, and report the stack trace of wherever the entity was deleted. Much like the rest of the debug plugin https://github.com/DaanVanYperen/artemis-odb-contrib/wiki/Debugger-Plugin

It's caused by user error when referencing entity ids. @entityid should mitigate it in most cases (assuming https://github.com/junkdog/artemis-odb/issues/574 gets fixed). When it does happen, it can cause all sort of weird bugs and tracing the origin can be really hard.

I still run into it myself ever so often so for me its a worthwhile feature to add to the debug plugin.