A question about StandardGame and threading

Hi everyone,

  I'm Scott Fleckenstein, and I'm new here.  First of all before I get to my question I'd first like to thank all the contributors to JME, you guys have really done a great job with this.  It is very approachable, which I think is a very important goal for any open source game engine.  I've been lurking around the forums for the past couple weeks and I'd also like to say I admire the community you all have built;  it has personality and use. All of the senior members seem very helpful and friendly.  Kudos.

 

  So, on to my question.  I'm curious about the free threading you get with StandardGame.  Specifically with regards to tasks that need to be dispatched on the OpenGL thread.  In the articles that I have read so far, none of them go into any greater detail that "Some ops need to be on the OpenGL thread, such as locking boxes", and was wondering if there was any additionally articles I could read or source that I could peruse to get a deeper understanding of what code I need to dispatch on the opengl thread.

 

  I'm concerned that as I am learning this framework I'll run into weird bugs that I won't recognize as threading issues because of my inexperience, and I would like to alleviate that problem as much as possible.  In that regard, I'd love to hear from someone who has experienced these issues in the past, and what they did to recognize the issue and any hurdles they had to jump to solve the issue beyond what is covered in the basic StandardGame article

 

  Any help is greatly appreciated.

 

-Scott

You mean I missed covering something in my article?  :-o



Just kidding…you are welcome to add to that article if you find other relevant information to add that would be useful to people getting started with it.



There is no definitive list at this point but hopefully will be addressed and not have to be handled this way in the future.  We just haven't had the time to develop that solution as of yet.  For my own development I find myself finding these things out through trial and error mostly.  I know that's not really the answer you were probably looking for, but unfortunately that's the case.  I often will see a GL exception or the VM will crash if I'm trying to do something outside of the GL thread that I'm not supposed to.  I simply change my code to pass it via GameTaskQueue and see if that fixes it.  Generally that problem gets solved that way.  There are some circumstances where I've had issues that were not quite so apparent and has taken some effort to debug, but again I typically will throw things into the GameTaskQueue and see if that resolves the issue.



You're welcome to start a list of these things in the wiki if you have the time to do so.



Welcome to the forum. :wink:

Thanks for the quick response.



I'll definitely keep notes and share them as I find things, thanks for the diagnosis tips.



-Scott