Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Game Networking Framework  (Read 2389 times)
0 Members and 1 Guest are viewing this topic.
Offline RedXVIII

Junior Newbie

« Posted 2014-04-07 18:30:14 »

So I have an issue with working with UDP Socketing. The problem is in my Game Engine, I send over information about a Game Object from the Server to the Client, and if that Game Object doesn't exist, I would create one, but the problem is that every class is different, and has a different constructor, so creating a new object would be difficult. how would I fix this problem?  Undecided
Offline Opiop
« Reply #1 - Posted 2014-04-07 18:42:11 »

So... Why don't you send over the constructor's parameters?
Offline RedXVIII

Junior Newbie

« Reply #2 - Posted 2014-04-07 18:48:04 »

Would you give an example please?   Shocked
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline SilverTiger

JGO Coder

Medals: 40
Exp: 3 years


« Reply #3 - Posted 2014-04-07 19:12:58 »

Well when I worked with a Client-Server-System the Server send messages in some pseudo XML, something like this:
length: 3

So let's assume you have a Player class with an ID, x, y, hp and mp. Your server messages could look like this:

After that you could parse that messages, possibly with a recursive descent parser.
You could also send a message "Player(1234,5,8,321,234)", you just have to know how to parse your message for the constructor.

Does that help? Smiley

Offline matheus23

JGO Kernel

Medals: 138
Projects: 3

You think about my Avatar right now!

« Reply #4 - Posted 2014-04-07 19:24:36 »

I highly suggest to use Kryonet. It allows sending java objects over the internet via TCP / UDP with a lot of useful optimizations. It's pretty much the fastest Serialization library (Kryo) together with a very fast network implementation.

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline RedXVIII

Junior Newbie

« Reply #5 - Posted 2014-04-07 20:35:18 »

I'm going to keep doing my own socketing so that I can use it at it's fullest. @Silver Tiger, sadly that did not help, I had something similar to that already setup. Please read the main topic more.

P.S. Not trying to be a dick, I appreciate your time, and effort.
Offline ctomni231

JGO Wizard

Medals: 99
Projects: 1
Exp: 7 years

Not a glitch. Just have a lil' pixelexia...

« Reply #6 - Posted 2014-04-07 20:48:55 »

So, basically, you want to send Objects over to the server regardless of the structure, store them, and be able to read them back with no questions asked. Maybe some more information about these Objects would help people a little more. Try answering these questions...

1) Do these Objects have a maximum size?
2) Does data loss of these objects matter?

To be honest, the request sounds unreasonable for UDP. I believe researching how to use Kyronet would be the correct solution as you are heavily hinting at serialization and storage. At least, in this case, you'd be able to handle new requests client side. The server can care less what data is stored, it is just up to the client to keep track on where to look for data when it is on the server.

Pages: [1]
  ignore  |  Print  

EgonOlsen (58 views)
2018-06-10 19:43:48

EgonOlsen (40 views)
2018-06-10 19:43:44

EgonOlsen (60 views)
2018-06-10 19:43:20

DesertCoockie (225 views)
2018-05-13 18:23:11

nelsongames (141 views)
2018-04-24 18:15:36

nelsongames (140 views)
2018-04-24 18:14:32

ivj94 (882 views)
2018-03-24 14:47:39

ivj94 (143 views)
2018-03-24 14:46:31

ivj94 (794 views)
2018-03-24 14:43:53

Solater (158 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!