Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (808)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (872)
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  
  Using Netty for game server/client network? Examples of game servers/clients?  (Read 6079 times)
0 Members and 1 Guest are viewing this topic.
Offline SkyAphid
« Posted 2019-11-14 03:57:55 »

Hey guys.

So on the weekends I'm playing around with learning some networking. I've learned some basic networking with Java sockets and want to try to go a bit further down the road and make a simple little game. I'm wanting to essentially remake the first game I ever made in Java into a basic little multiplayer test (it was essentially a Megaman Battle Network game, specifically centered on the combat).

I've done my research and it seems that Netty is the most up to date and functioning API for Java for networking. That said, it's meant for very broad usage and I can't find any good examples of making a game client/server with it. I was wondering if anyone could direct me to some simple resources that makes some sort of Hello World for it that sustains a game loop? I'm looking to use TCP/IP for simplicity.

I looked at KyroNet, but it seems like it's being very poorly maintained and doesn't seem to be too well documented (I may be wrong here, this was just my impression when going through the git page). With Netty, I understand that it can be very complex, but if I have access to some examples of usage, I can probably make my own open source wrapper for it that simplifies it.

Lastly, if there's an even better and more up to date networking API out there, feel free to link it.

What I'm looking for essentially is something:
  • Fast and easy to setup (I'm limited on time for this project and can't spend a lot of time trying to decipher and bugfix other people's old code)
  • Decent documentation and examples that work out of the box

So far Java sockets have ironically been the easiest to use because there's a plethora of articles on it out there, but I really want to find something that's built with simplicity in mind so I don't have to spend a lot of time on architecture and can just focus on messing around and having fun.

EDIT: Messed around with KyroNet a bit and it seems it might be viable, but additional resources are still appreciated.

it just werks
Offline VaTTeRGeR
« Reply #1 - Posted 2019-11-14 09:03:44 »

Project Zomboid switched over to some Java-binding of RakNet, JRakNet looks pretty usable. Otherwise i would roll my own networking module with some threading and non-blocking ringbuffers (LMAX disruptor type).
Offline ral0r2
« Reply #2 - Posted 2019-11-14 10:28:47 »

I'm by no far a network specialist and I think it someone depends on your requirements but for myself I found kryonet pretty good and straightforward.

The points you mentioned are somewhat true though I was also struggling with finding good maintained documentations.
But with the stuff you can find online you can go pretty far I think.

KryoNet also lists some alternatives as well. I`ve never heard about one of them though..


The project is similar to KryoNet. MINA's API is lower level and a great deal more complicated. Even the simplest client/server will require a lot more code to be written. MINA also is not integrated with a robust serialization framework and doesn't intrinsically support RMI.

The project is a minimal layer over NIO. It provides TCP networking similar to KryoNet, but without the higher level features. Priobit requires all network communication to occur on a single thread.

The project is a higher level library similar to KryoNet. JGN does not have as simple of an API.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

« JGO Spiffy Duke »

Medals: 1146
Projects: 3
Exp: 20 years

Eh? Who? What? ... Me?

« Reply #3 - Posted 2019-11-14 12:07:06 »

Can some kind soul enlighten me as to what these libraries do that you can't very easily be doing yourself but with less surprise and more control?

Cas Smiley

Offline ral0r2
« Reply #4 - Posted 2019-11-14 12:28:53 »

Can some kind soul enlighten me as to what these libraries do that you can't very easily be doing yourself but with less surprise and more control?

Cas Smiley

For me it`s mostly that I'm struggling enough to finish the core mechanics of a game. Also writing the entire network part of my own seems to be too much additional work for me. Full control over the network part was not neccessary yet for me since it always has been asynchronous so far and there was no speical need for deeper networking mechanics like client side prediction etc. I always feel like netcode is pretty hard to write by itself (depending on your goals ofcourse) and writing my own core to be able to write so already hard to write netcode seems overkill.

How ever I'm only a hobbyist I think if you do a bigger project than mine you should think twice whether the effort wouldnt be worth to write your own network part.

KryoNet for instance has a Remote Method Invocation (RMI) mechanism which works pretty well out of the box imo. The performance for me was also always satisfying.

I think it`s a general question for one whether he should write his own network part or use a general library for it depending on the circumstances and goals.
Offline SkyAphid
« Reply #5 - Posted 2019-11-14 23:39:20 »

Can some kind soul enlighten me as to what these libraries do that you can't very easily be doing yourself but with less surprise and more control?

Cas Smiley

Unfortunately 90% of the time I try a bunch of APIs, get frustrated, and just end up rolling my own while cursing under my breath the whole time at how easy it would've been for someone else to have made just as simple as solution lol. But hopefully KryoNet works so I don't have to waste my time with that.

it just werks
Pages: [1]
  ignore  |  Print  

Riven (847 views)
2019-09-04 15:33:17

hadezbladez (5791 views)
2018-11-16 13:46:03

hadezbladez (2603 views)
2018-11-16 13:41:33

hadezbladez (6207 views)
2018-11-16 13:35:35

hadezbladez (1499 views)
2018-11-16 13:32:03

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

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

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

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

nelsongames (5501 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08 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!