Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
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  
  Resources for game networking  (Read 4364 times)
0 Members and 1 Guest are viewing this topic.
Offline pudelhund

Junior Newbie





« Posted 2012-05-03 18:49:44 »

Hi,

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 Smiley

Thank you!
Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #1 - Posted 2012-05-03 19:13:15 »

Look at Kryonet (http://code.google.com/p/kryonet/) I love it, and I want to support it Smiley

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

Junior Newbie





« Reply #2 - Posted 2012-05-03 19:19:41 »

Yea, I already found that! Looks good, but do you know any (working) examples?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #3 - Posted 2012-05-03 19:30:49 »

Hmm... You can look at my little simple "Console-Chat" code (BEWARE: My fist Kryonet Project! But should work, although older version...):
http://dl.dropbox.com/u/45530199/Games/ConsoleChatSrc.zip

Btw, you can connect to my running server with #connect flux.homelinux.org  Grin

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline jonjava
« Reply #4 - Posted 2012-05-03 19:36:51 »

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

Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #5 - Posted 2012-05-03 19:39:09 »

Key concepts to remember when doing networking:

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.

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline jonjava
« Reply #6 - Posted 2012-05-03 19:49:54 »

Key concepts to remember when doing networking:

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.

Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #7 - Posted 2012-05-03 20:11:14 »

Key concepts to remember when doing networking:

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.

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

Junior Member





« Reply #8 - Posted 2012-05-04 19:13:00 »

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 Smiley
Offline pudelhund

Junior Newbie





« Reply #9 - Posted 2012-05-04 20:26:57 »

Thanks for all the useful advices!
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 Smiley

I will have a look at it later. If I experience any problems - may I contact you?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline tigeba

Junior Member





« Reply #10 - Posted 2012-05-04 20:52:47 »

Thanks for all the useful advices!
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 Smiley

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

Sure thing.  We also have user forums if you would prefer that option.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (24 views)
2014-07-24 01:59:36

Riven (22 views)
2014-07-23 21:16:32

Riven (18 views)
2014-07-23 21:07:15

Riven (21 views)
2014-07-23 20:56:16

ctomni231 (50 views)
2014-07-18 06:55:21

Zero Volt (45 views)
2014-07-17 23:47:54

danieldean (36 views)
2014-07-17 23:41:23

MustardPeter (39 views)
2014-07-16 23:30:00

Cero (54 views)
2014-07-16 00:42:17

Riven (54 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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
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!