Group Admins

  • Avatar Image

Development Discussion (jME3)

Public Group active 6 hours, 21 minutes ago

Issues concerning Javadoc, core features, scope etc.

Multithreaded loading (5 posts / 0 Voices)

← Group Forum   Group Forum Directory
  • Avatar Image Empire Phoenix said 7 months, 1 week ago:

    Well as the comparision says, JME3 is able to load models in a sepreate thread, so my main question is what do I have to take care of when doing it this way?

    My idea is just that I have some kinda  of background loader that I can pass a modelname + a node that should it be attached. Then the game continues while the Background loads the model, once finished it should be added to the node passed.

    Possible problems I see
    1. Loading textures/shaders for the model might result in problems (at least it did in JME2 it should work now i guess)
    2. Attaching the child out of another Thread directly into the node might cause problems if it is rendering at the smae time?
    3. The first frame the model appears a lag happens when the textures are uploaded to the opengl vram.

    Any tips, ideas would be appreciated

  • Avatar Image normen (Developer) said 7 months, 1 week ago:

    I was able to load models with textures etc. on a different thread in jme2 already.. The attaching to the scenegraph might be something you want to do on the OpenGL thread, but loading, I think its no problem at all..

  • Avatar Image Momoko_Fan (Developer) said 7 months, 1 week ago:

    I was able to load models with textures etc. on a different thread in jme2 already..

    You can load textures from another thread, but you can't load them from multiple threads simultaneously, since TextureManager is not thread-safe in jME2.
    I have recently commented out the multithreaded-based loading in jME3, it became incompatible to the many changes that happened with asset handling. The best way to do it is probably to have a preload list, that tells all resources that shall be loaded, then these resources are loaded in multiple threads depending on how many cores the machine has, you would then receive notifications in the OpenGL thread telling you that a resource has finished loading and needs handling.

  • Avatar Image MikOfClassX said 7 months, 1 week ago:

    Yep, the TextureManager is one of the problems in my multi-displaysystem jme2 implementation (which is running btw, but still has a bunch of potential thread-safety issues due to statics everywhere).

    I think that one way to solve the problem is to use threadlocals inside the TextureManager, or use one TextureManager for each DisplaySystem.

    I would really like to switch all my current JME2 based work (3D broadcast video engine) to JME3 but I feel it's a bit too fresh. I don't know.

  • Avatar Image normen (Developer) said 7 months, 1 week ago:

    MikOfClassX said:
    I would really like to switch all my current JME2 based work (3D broadcast video engine) to JME3 but I feel it's a bit too fresh. I don't know.

    Yes, jme3's structure is still not set in stone, so basing a project on it right now is not really recommended. But if you try around with it.. any feedback is very welcome and will help get jme3 out sooner.