4
\$\begingroup\$

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.

\$\endgroup\$
0

1 Answer 1

2
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ So would you recommend creating one Activity to interact with Photon, plus my normal Gdx Application communicating back and forth with that Activity? \$\endgroup\$ Apr 6, 2012 at 3:53
  • \$\begingroup\$ @FreeLancer i've updated my answer to address this \$\endgroup\$
    – Chuck D
    Apr 6, 2012 at 15:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .