Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java libgdx(desktop/android) multiplayer game how to

I have a game called wizard wars that I have been working on. This game needs to allow 2 players to play at one time, and would need a TCP connection to communicate spell creation/destruction ect., and a UDP connection to handle locations ect. It would have a client and a host side. That being said my program is designed to run on Android. All of the tutorials/information I have found online has been for JApplets or something like that. So what I would like is some help with ever short code examples of how to set up/use connections, or just a link to some sufficiently helpfull information on how to set up the actual connections.

like image 435
csga5000 Avatar asked May 23 '13 17:05

csga5000


1 Answers

The best approach (or at least 1 approach) would be to use normal HTTP requests : http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/Net.html

You create a webservice implementing REST and create calls for both updating and consuming data.

Alternatively, if you're just going to use Android and Desktop you may also use WebSockets : https://github.com/pepedeab/libGDX-Net

like image 85
pedronveloso Avatar answered Oct 06 '22 14:10

pedronveloso