Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LibGDX - Connecting cross-platform clients to a server (HTML5/GWT, iOS, Android and Desktop)

Over the weekend I set up all the networking for a game I was making. I was basing it off this tutorial: GamesFromScratch.com Basic LibGDX Networking. It said that it only supported TCP but I was okay with that since I could figure something out and there was a bunch of material online on how to make real time games without UDP. After I finished, I tested it on desktop, android and then on HTML5/GWT. Desktop and android worked but GWT didn't. I did some research and found that Gdx.net does not support GWT, the article didn't warn me :/ Basically now I am trying to find an alternative solution that will work with ALL libgdx platforms.

I looked into Websockets with Socket IO. Here are the Java libraries I found for the: Client and Server. The server library says it works well with the client one which is reassuring. It seems like a good solution but I have a few questions:

- Would the client library work on all platforms? It seems that it would work on android and desktop since they don't have to convert to another language but what about GWT and iOS? And not only just work, but also be able to connect to the server using the server library.

- Is there anything I need to watch out for when using websockets?

Thanks.

EDIT: I did a little bit more research and I found Jetty. I looked around and it seems to be GWT compatible, I just need to know if it is also iOS compatible. And could I use Jetty as my server api also?

like image 598
vedi0boy Avatar asked Oct 31 '22 15:10

vedi0boy


1 Answers

I did it. I did a lot of research in the past few days and I finally found this post on stackoverflow.com that told me about 2 great libraries including one I could use with the client that supports GWT.

It works great, the only thing is that I will have to use 2 WebSocket libraries for the client, one on html and another for all the other platforms but that's okay, at least it works.

The libraries are: Client and Server.

like image 141
vedi0boy Avatar answered Nov 15 '22 04:11

vedi0boy