junkdog / artemis-odb

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

Problems when using Two instances of World #231

Closed jplorandi closed 9 years ago

jplorandi commented 9 years ago

I'm coding a client/server app with LibGdx and artemis-odb, where both client and server each keep an instance of World which is replicated/reconciliated between clients and server (server is authoritative). I'm completely unable to run an instance of each within the same JVM (for testing purposes) (the server version also runs with gdx-headless-backend). The appropiate stacktrace for trunk:

java.lang.NullPointerException
    at com.artemis.EntityManager.clean(EntityManager.java:245)
    at com.artemis.World.process(World.java:567)

This worries me to no end since I will want to run many such servers within a single JVM. Is this a known bug? I'll try to create a test case as soon as I can.

EDIT: basically the EntityManager's recyclingEntityFactory is null somehow.

jplorandi commented 9 years ago

Please Close, my mistake (I should have done the test case in the first place)

junkdog commented 9 years ago

Did you get it working? There should be nothing prohibiting multiple World instances to run within the same JVM. All static fields were removed some time ago.

jplorandi commented 9 years ago

Yes; unfortunately I refactored some things wrong when I migrated from 0.7.x to trunk in anticipation for 0.9.0 and some Exceptions weren't being printed. Can't waste a chance to make a fool of myself in public I guess :)

junkdog commented 9 years ago

You're in good company, we're all fools or somewhat crazy.

I just published the artifacts for 0.9.0 btw - they should be live within a couple of hours.

jplorandi commented 9 years ago

Brilliant. Is there anything needed to run the regular vs the fast version? Excuse my ignorance :$ (because the wiki page doesn't exist yet?)

junkdog commented 9 years ago

You can hook it into your buld process - check out Weave Automation.

Some more background: https://github.com/junkdog/artemis-odb/wiki/Hotspot-Optimization