junkdog / artemis-odb

A continuation of the popular Artemis ECS framework
BSD 2-Clause "Simplified" License
776 stars 111 forks source link

artemis-odb-debug - guard against common programmer errors #269

Closed junkdog closed 9 years ago

junkdog commented 9 years ago

EntitySystems' flyweight entity instance must never be stored in a collection, but it's easy to add them by mistake (the proper way is to resolve the actual entity instance with world.getEntity(int entityId) or just persisting the entity id.

adds some overhead; meant for resolving entity identity errors, not release builds.

DaanVanYperen commented 9 years ago

Might consider a debug build perhaps? If there is an elegant way to do such a thing. where's mah '#ifdef'!

junkdog commented 9 years ago

a pre-processor would rock - even if they're evil.

I want something similar to:

<dependency>
    <groupId>net.onedaybeard.artemis</groupId>
    <artifactId>artemis-odb</artifactId>
    <version>0.11.0</version>
    <classifier>debug</classifier>
</dependency>

The dep would prob be handled by a profile: if default profile, go with standard artifact - otherwise use the debug-classified (!) artifact.

junkdog commented 9 years ago

Ideally, it could be automated somehow - I've seen a few projects which do some fancy things to ones projects, just using referenced pom:s. Can't remember which however...

DaanVanYperen commented 9 years ago

It probably ties in closely to @Namek's efforts at tooling the engine. Especially with your world-io efforts making snapshots in a profiling setting an option.

junkdog commented 9 years ago

doesn't pre-allocate pool, can add it later - i think just checking for flyweights gone astray will intercept the majority of bugs. feel free to re-open ticket though, or a new one.