I am currently working on a multiplayer game. The game itself (single player) already works perfectly fine and so does the chat. The only thing that is really missing is the multiplayer part.Sadly I am absolutely clueless on where to start with that. I roughly know that I will have to work with packages, and I also know many things about streaming etc (chat is already working). My problem is that I can't find any resources on how to do this. A tutorial would be perfect, alternatively a good example of an open source client/server (in Java of course) would be fine.If you feel like doing something helpful I'd also really appreciate someone "privately" teaching me via PM's or some chat program

Oracles tutorials ( and the hundreds on the web ) usually talk about how to set up a Client Server networking relationship with the help of the java.net package. Delegating a single thread on the server for every connection.

This approach is easy to understand and quite straightforward, I suggest you start there.

If you're looking for super efficiency (1000+ players), you should look into the java.nio package. I had lots of trouble figuring java.nio out on my own. I read the "Java NIO" book which helped a lot.

Key concepts to remember when doing networking:

1. Everything you send and receive is in bytes. So learn about bytes.2. Protocols.

A Protocol is a set of predefined rules on how data is sent and received between programs. F.ex: If the first byte in a received message is the number 5, then treat the rest of the message (bytes) as text.

For your own game, you'll want to make your own protocol. To communicate with other programs ( http, irc, etc etc ) you will need to learn the protocol by heart. Here's a list of a bunch of used protocols (rfc's) http://en.wikipedia.org/wiki/List_of_RFCs

1. Everything you send and receive is in bytes. So learn about bytes.2. Protocols.

That's, why you should use Kryonet. It gives you efficient Object-Serialization (better than Java's), and you don't have to worry about Protocols and sending byte per byte.

It depends on what you want to do. But regardless you'll still need Protocols. Kryonet wraps around the bytes and deals only with objects afaik. It's fine for your own Client/Server applications. But it comes with a "slight" overhead and if you want to communicate with existing protocols you have to deal with bytes. In the end, everything that's sent/received over a network is in bytes.

1. Everything you send and receive is in bytes. So learn about bytes.2. Protocols.

That's, why you should use Kryonet. It gives you efficient Object-Serialization (better than Java's), and you don't have to worry about Protocols and sending byte per byte.

It depends on what you want to do. But regardless you'll still need Protocols. Kryonet wraps around the bytes and deals only with objects afaik. It's fine for your own Client/Server applications. But it comes with a "slight" overhead and if you want to communicate with existing protocols you have to deal with bytes. In the end, everything that's sent/received over a network is in bytes.

But I really think, since he is startign with networking, the best thing to do for him, is to use Kryonet. Worrying about Protocols and OTHER Protocols is kind of too much to deal with, in the beginning.

You might want to check out Electroserver 5. Not open source, but it is free to use up to 50 concurrent users, and has a bunch of client API's including a Java client API. In the docs there are quite a few client examples using Java, and the server code is Java, if needed.

You might want to check out Electroserver 5. Not open source, but it is free to use up to 50 concurrent users, and has a bunch of client API's including a Java client API. In the docs there are quite a few client examples using Java, and the server code is Java, if needed.

Full disclosure: I'm one of the developers

I will have a look at it later. If I experience any problems - may I contact you?

You might want to check out Electroserver 5. Not open source, but it is free to use up to 50 concurrent users, and has a bunch of client API's including a Java client API. In the docs there are quite a few client examples using Java, and the server code is Java, if needed.

Full disclosure: I'm one of the developers

I will have a look at it later. If I experience any problems - may I contact you?

java-gaming.org 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‑gaming.org