Kryonet on robovm

Anything libgdx related goes here!

Kryonet on robovm

Postby ben » Wed Jan 15, 2020 2:00 am

Hi When I tried kryonet with the robovm, I got the following error?
Anybody used the Kryonet over robovm can help?
Or did it still work?
Thanks in advance
[WARN] java.lang.Class: Class.forName() failed to load 'android.os.Process'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>android.os.Process</pattern></forceLinkClasses> to your robovm.xml file to link it in.
java.lang.IllegalArgumentException: Unable to create serializer "com.esotericsoftware.kryo.serializers.FieldSerializer" for class: com.esotericsoftware.kryonet.FrameworkMessage$RegisterTCP
ben
 
Posts: 163
Joined: Fri Mar 30, 2012 1:48 am

Re: Kryonet on robovm

Postby ben » Wed Jan 15, 2020 2:05 am

And the sugestion in the error message will not work.
I have tried it.
"add <forceLinkClasses><pattern>android.os.Process</pattern></forceLinkClasses> to your robovm.xml file to link it in"
ben
 
Posts: 163
Joined: Fri Mar 30, 2012 1:48 am

Re: Kryonet on robovm

Postby shatterblast » Wed Jan 15, 2020 6:52 am

Kryonet is incredibly old, and I suggest not using it. Besides that, one Kryonet client will only work with another and no other client types. It's also inefficient, which you absolutely don't want on Mobile.
shatterblast
 
Posts: 620
Joined: Sun Jul 06, 2014 1:14 pm

Re: Kryonet on robovm

Postby ben » Wed Jan 15, 2020 7:36 am

So what' s your suggestion for a Java network framework?
the Kryonet API is simple and now works well from my test in Android.
I used it to add P2P for casual game.
ben
 
Posts: 163
Joined: Fri Mar 30, 2012 1:48 am

Re: Kryonet on robovm

Postby tomski » Wed Jan 15, 2020 7:47 am

Where are you getting that info from? Kryonet is very efficient. Ben you should have some more to that error, I suggest coming into the gitter channel so we can help you there. https://gitter.im/MobiVM/robovm
tomski
 
Posts: 913
Joined: Wed Jun 26, 2013 6:06 pm

Re: Kryonet on robovm

Postby shatterblast » Wed Jan 15, 2020 12:37 pm

tomski wrote:Where are you getting that info from? Kryonet is very efficient. Ben you should have some more to that error, I suggest coming into the gitter channel so we can help you there. https://gitter.im/MobiVM/robovm

Because it uses stateful networking instead of stateless. Stateful performs well on wired networking. Otherwise, you primarily introduce a lot of potential lag. I have other opinions about it, but I don't care to discuss those. If it runs well, then great!

Stateful networking is not optimal on wireless connections. MMOs for instance only run well with stateful on wired networking. I won't go out and compare various game titles, but MMO games that rely on Mobile mostly prefer stateless. Kryonet is stateful.

You can compare the success of old-breed games if you want, but most of those came out before Mobile.

It's not a comparison of TCP versus UDP either. Both stateful and stateless prefer TCP for reliability. Wireless connections prefer TCP over UDP. Typically, UDP does better with wired networking as well for the same reason.

Stateless is a more efficient form of TCP, making it even better than UDP. This can not be argued, although you are welcome to try. However as usual, I will not argue with you.

Again, if it works for you, then great! You can also use the wrong tool to hammer in a nail, and it will still work. It may not be the best tool, but if it's what you have available, then go for it. The same would apply here.
shatterblast
 
Posts: 620
Joined: Sun Jul 06, 2014 1:14 pm

Re: Kryonet on robovm

Postby shatterblast » Wed Jan 15, 2020 1:17 pm

ben wrote:So what' s your suggestion for a Java network framework?
the Kryonet API is simple and now works well from my test in Android.
I used it to add P2P for casual game.

Peer to Peer gaming is very viable, but unfortunately for Mobile devices, you have un-avoidably un-predictable lag at times. For now, I can only point you at looking towards maybe using Bluetooth for local networking. It shares the same strength as Wi-Fi over all, but you will still need to approach from the stateless perspective. The best way includes JSON data and the Google HTTP Client. I am sorry to say that I don't know of any pre-existing architecture meant for Mobile that works well for Bluetooth. However, peer to peer connections through Mobile would work well best through Bluetooth. This means you will have a limit of only you and one other person at any given time.

Apart from Bluetooth for Mobile devices, you need a client and server architecture. Google Cloud offers both Open Match and Firebase. The two are meant to work together, and I think you can start with them for free. You really need to start with that first.

I know it can be slightly a bit difficult to understand, but the Google HTTP Client is very awesome. Link 1) points to that. Link 2) is a generic guide for Google and real-time multi-player. Links 3) and 4) go to Open Match and Firebase respectively. While they are not the only solutions, they are probably the best for beginners in this area.

1) https://github.com/googleapis/google-http-java-client
2) https://developers.google.com/games/ser ... ultiplayer
3) https://cloud.google.com/blog/products/ ... -for-games
4) https://firebase.google.com/docs/database
shatterblast
 
Posts: 620
Joined: Sun Jul 06, 2014 1:14 pm

Re: Kryonet on robovm

Postby ben » Thu Jan 16, 2020 1:38 am

I have solved it with an old answer in google group.
I pasted it here so it maybe useful for later users.
Adding this one in robovm.xml looks a manitory step for Kryonet over Robovm working.
<forceLinkClasses><pattern>com.esotericsoftware.kryo.**</pattern></forceLinkClasses>

Thanks all you guys.
ben
 
Posts: 163
Joined: Fri Mar 30, 2012 1:48 am

Re: Kryonet on robovm

Postby ben » Thu Jan 16, 2020 1:53 am

shatterblast wrote:
ben wrote:So what' s your suggestion for a Java network framework?
the Kryonet API is simple and now works well from my test in Android.
I used it to add P2P for casual game.

Peer to Peer gaming is very viable, but unfortunately for Mobile devices, you have un-avoidably un-predictable lag at times. For now, I can only point you at looking towards maybe using Bluetooth for local networking. It shares the same strength as Wi-Fi over all, but you will still need to approach from the stateless perspective. The best way includes JSON data and the Google HTTP Client. I am sorry to say that I don't know of any pre-existing architecture meant for Mobile that works well for Bluetooth. However, peer to peer connections through Mobile would work well best through Bluetooth. This means you will have a limit of only you and one other person at any given time.

Apart from Bluetooth for Mobile devices, you need a client and server architecture. Google Cloud offers both Open Match and Firebase. The two are meant to work together, and I think you can start with them for free. You really need to start with that first.

I know it can be slightly a bit difficult to understand, but the Google HTTP Client is very awesome. Link 1) points to that. Link 2) is a generic guide for Google and real-time multi-player. Links 3) and 4) go to Open Match and Firebase respectively. While they are not the only solutions, they are probably the best for beginners in this area.

1) https://github.com/googleapis/google-http-java-client
2) https://developers.google.com/games/ser ... ultiplayer
3) https://cloud.google.com/blog/products/ ... -for-games
4) https://firebase.google.com/docs/database


Thanks for your detailed suggestion.
My game still doesn't go that far. It's just a simple casual game, single player mode for years. What I added recently is WIFI LAN P2P with limited interaction between the players.
As a first try, Kryonet is enough for me. I still remember years ago when I tried with raw socket and come up with lots of bugs and finnally gave up.
But what you said about the short coming of the Kryonet, they maybe exist. I can not say more because I am not an expert on it myself but I do find even in LAN from time to time the game got disconnected callback.
---
For HTTP client to work, you need a dedicated server which is not a first step try for beginners
Google play game serverice was once an option in my mind but when I saw it said the service will end soon, I gave up it..
ben
 
Posts: 163
Joined: Fri Mar 30, 2012 1:48 am

Re: Kryonet on robovm

Postby shatterblast » Thu Jan 16, 2020 4:29 am

Yeah. I admit Spring Boot was a pain, but its annotations made it much easier to learn. You're not wrong.

The Google HTTP Client is probably one of the better web clients out there if you want to learn for yourself. It essentially works with anything.

I don't really have anything else to offer at the moment. If you ever want to learn Spring, then the below link leads to one of the best courses. You just have to time it where the price is very cheap. My gpgs-libgdx code in the future should help connect with it just fine, since it already does in practice. My original Spring Boot code is based off the teacher's skeleton project for it with heavy modifications on my own side.

For my own efforts, I use Spring REST. It defines stateless TCP. That would probably be the best alternate route to take. Just make sure to learn the annotations of Spring Boot first. The teacher does a pretty good job at explaining the essentials.

1) https://www.udemy.com/course/spring-hibernate-tutorial/
shatterblast
 
Posts: 620
Joined: Sun Jul 06, 2014 1:14 pm


Return to Libgdx

Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest