Testing Android controls on libGDX PC application using libGDX remote

When testing our games, sometimes we only need to test the game controls on the Android devices, not all the game, and deploying it on the device is always slower than running it on the PC.

The LibGDX library provides a way to send your Android device input data to through the network, one of the possible uses is to control your libGDX PC application with it.

Here is a demo video using the remote input, made by libGDX team:

(note: magic starts after minute 2)

In the case of Super Flying Thing, we need it when testing and debugging some controls that cannot be tested directly on PC like the TiltController for example (we need device orientation data). Recently, we starting using it also to test and customize other controls like the the ClassicController (despite it has a bit of lag in some cases).

Sadly, my camera is also my android phone so I can't make a video of how we are using it.

One interesting point of this is that we could use multiple android devices (and probably other devices like iPod/iPhone/iPad/others) to create multiple wireless controllers for PC, and that, for example, could be funny if we want to make a local multiplayer game.

Another interesting point is that you could implement your own remote input server to read the device input data sent by the GDX Remote Android Application, so you wouldn't be forced to use libGDX in your server application.

VN:F [1.9.22_1171]
Rating: 4.3/5 (7 votes cast)
Testing Android controls on libGDX PC application using libGDX remote, 4.3 out of 5 based on 7 ratings
  • Moustafa

    Thanks for the link.  The Gdx remote has been a life saver.  How would you implement something like two devices running the same Desktop game?  I might end up doing that for a small project of mine.

  • arielsan

    If I understood the problem, one option could be creating different RemoteInput using different ports and set them to each game controller in your desktop application, then in each android device you start LibGDX remote and you configure it for each port.

  • Moustafa

    You think I would be able to do that without changing the LibGDX source code?

    I mean, would you mind giving me a bit more detail on how I might implement this code wise?  Gdx.input can only be set to a single RemoteInput correct?

  • arielsan

    If I don't remember wrong, you can create a RemoteInput(port) and use that instance directly without having to set it to Gdx.input since it runs on its own thread (I don't know if it is synchronized). So, you can create two instances and use them to control each player. This pastebin is a really basic pseudo code.

  • Moustafa

    Just got it to work! Thanks so much for the help.  Can't believe no one ever thought of this.