Communication between Box2D and libGDX Stage (Scene2D) running in separate threads
        Posted  
        
            by 
                atok
            
        on Game Development
        
        See other posts from Game Development
        
            or by atok
        
        
        
        Published on 2013-12-30T23:09:06Z
        Indexed on 
            2014/05/31
            16:07 UTC
        
        
        Read the original article
        Hit count: 254
        
I'm making a physics based 2D game using libGDX and Box2D. I want to move the execution of the simulation out of render thread. I use immutable messages and the BlockingQueue to pass the information about player actions. The Box2D applies forces and runs a frame of simulation. In the next step I would like to sync back the changes and update Scene2D Actors accordingly. Making an immutable copy of the state of the game world and sending it back using Gdx.app.postRunnable() is one option but it seems inefficient.
Is there any other option?
© Game Development or respective owner