Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Can anyone point me to a possible implementation of the Photon network engine along with LibGDX for Android? Or any multiplayer networking SDK for all that matters.

From reading source code it seems that Photon uses the native Android SDK heavily, like Intents and such, which are not provided through LibGDX.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You call out of libgdx into custom java methods. It would take some work but i'm sure it's possible. Take a look in the Android SDK in the demos folder for demo-realtime and hook up a way to call out of libgdx into the hosting android Activity. I posted some code here that you can use or any way you prefer. It looks like the Intents they are launching are just to show other views (Help, Options, etc) that you can definitely do if you want to jump to different Activities in your game.

If you need to call back into libgdx, use the Application.postRunnable method.

Edit: Yep, that's what I would do because every time you leave the gdx hosted Activity and return, it will cause the gl context to spin back up which may lead to a poor user experience. If you want to have different views/menus hosted in your Android app, use something that doesn't leave the current Activity like this:

BetterPopupWindow.java

This window can be launched from a method in your Activity class which you could call from libgdx and you won't lose the gl context in libgdx.

share|improve this answer
    
So would you recommend creating one Activity to interact with Photon, plus my normal Gdx Application communicating back and forth with that Activity? –  Free Lancer Apr 6 '12 at 3:53
    
@FreeLancer i've updated my answer to address this –  Rubber Mallet Apr 6 '12 at 15:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.