Java libgdx(desktop/android) multiplayer game how to
Asked Answered
B

3

6

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.

Bronk answered 23/5, 2013 at 17:38 Comment(2)
Have you looked at LibGDX with KryoNet?Josphinejoss
Not yet, but ill look into it.Bronk
M
5

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

Manicotti answered 24/5, 2013 at 19:24 Comment(1)
Can WebSockets not be used with html5?Walking
X
4

For those who don't read comments, but still looking for tcp client.

You can use KryoNet which supports Desktop and Android https://github.com/EsotericSoftware/kryonet

Xylidine answered 16/7, 2013 at 10:28 Comment(0)
A
2

Have you guys looked at the multiplayer super jumper tutorial? Its written using AppWarp and is being actively used in the libgdx community as well.

Arevalo answered 20/2, 2014 at 9:7 Comment(1)
Thx dude! This seems to be exactly what I am looking for!Bandung

© 2022 - 2024 — McMap. All rights reserved.