Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (495)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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  
  Ninja: NIO Networking for Java  (Read 4070 times)
0 Members and 1 Guest are viewing this topic.
Offline Nate

JGO Kernel


Medals: 147
Projects: 4
Exp: 14 years


Esoteric Software


« Posted 2009-09-01 18:58:44 »

I've released my client/server networking library, Ninja, under the BSD license:
http://groups.google.com/group/ninjanetworking

Would love to hear what you think about it! Code reviews and constructive criticism are most certainly welcomed! Smiley Feel free to post comments on the code here, or PM me and I can send you a link that will allow you to annotate the source right on the Google Code website.

Offline sunsett

Senior Member




ribbit!


« Reply #1 - Posted 2009-09-02 15:59:55 »

Nice work Nate!  I've only briefly looked at it, but it looks like you're making good progress.

Any games using it yet?
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 798
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #2 - Posted 2009-09-02 16:02:54 »

If I were you, I'd implicitly register the 1D and 2D array types of any class that is registered, to remove the burden (and confusion) from the developer.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Nate

JGO Kernel


Medals: 147
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #3 - Posted 2009-09-04 02:05:11 »

Nice work Nate!  I've only briefly looked at it, but it looks like you're making good progress.

Any games using it yet?

Thanks. No released games using it yet. It has 3 or 4 users so far, but its only been out a month or so and been BSD only a few days. Smiley I have plans to use it in many game, with one in progress. It is neat to play a game on the desktop using Slick against the same game on Android!

If I were you, I'd implicitly register the 1D and 2D array types of any class that is registered, to remove the burden (and confusion) from the developer.

I hesitate to do it automatically because the ordinal for registered classes is sent across the wire each time the data for an instance of the class is transferred. If 0 <= ordinal <= 253 then I can transfer the value using just one byte. For 254 <= ordinal <= 65536 it takes 3 bytes. So if every class registered took 3 spots for class, class[], and class[][] it would start using 3 bytes to send ordinals after 84 classes registered. Not a huge deal, I know, but is it really that bad to register it? This is the exception you get the first time you try to send an unregistered array:

Quote
IllegalArgumentException: Class is not registered: short[]

I went to extra trouble to make this exception message nice and pretty. Smiley

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 798
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #4 - Posted 2009-09-04 06:05:31 »

Getting an Exception the first time you give something a try is kinda annoying.

You can also change the protocol a bit, and assume nobody is every going to use more than 4D arrays, and use 2 bits in your header.
00 => 1D
01 => 2D
10 => 3D
11 => 4D

That would give you 6 bits (64 indices) for your classes. That's about enough for 99% of applications. You can ofcourse use the 'wide' 3 bytes protocol if people really have up to 64K classes around.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Hsaka
« Reply #5 - Posted 2009-09-25 03:19:12 »

Hi,

I've been using Ninja for a game I'm working on, and I need to see the javadocs, but the link [http://groups.google.com/group/ninjanetworking] is broken. Did you delete the group?
Offline Nate

JGO Kernel


Medals: 147
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #6 - Posted 2009-09-25 03:42:40 »

Yep, gone, sorry. Someone contested the name "Ninja" so I figured it was easier to just rename it. Here is the last JAR and source for Ninja, javadocs included:
http://n4te.com/temp/ninja-final.zip
Hope this holds you over until the new projects are ready!

The-project-formerly-known-as-Ninja is being broken into two projects:

Kryo
http://code.google.com/p/kryo/
Does the serialization. This way the serialization bit can be used without the networking bit, or with a different networking lib. I did some benchmarks and it holds up well against other similar libs (such as Google's protobuf):
http://code.google.com/p/kryo/wiki/BenchmarksAndComparisons
I am just finishing up Kryo and starting on refactoring the networking piece.

KryoNet
http://code.google.com/p/kryonet/
This is the networking portion. Obviously, it uses Kryo for the serialization. Will be an almost identical API to the-project-formerly-known-as-Ninja.

"Kryo" isn't the best name, but the good names are taken. I was spending way too much time just trying to name it, so Kryo it is! At least it is short...

The HTTP communication portion of the-project-formerly-known-as-Ninja is getting moved to a "client" project the Legion project:
http://code.google.com/p/legion/
Legion lets you send/receive objects to/from a servlet just as easily as Ninja/KryoNet. This means it is easy to write turn-based games and desktop or mobile applications that communicate with a webserver. Any webserver will work, but a servlet container lets you use Kryo on the server. Legion supports Google App Engine and will come with some common functionality (user registration, login, sessions, arbitrary data storage).

I'm also working on another project called Skorpios for OpenGL on both desktop and Android with a single codebase:
http://code.google.com/p/skorpios/
The code for this was mostly ready a couple weeks ago, but I just recently came up with the name (wanted Scorpion but Skorpios isn't too bad) and have been busy with other things. The code will be up soon!

Offline Hsaka
« Reply #7 - Posted 2009-09-25 04:11:00 »

Thanks.
Just to make sure, is ninja.jar in ninja-final equivalent to ninja-0.7?

Good luck with the new projects.
[Too bad about the name, kinda got attached to Ninja.. Wink]
Offline Nate

JGO Kernel


Medals: 147
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #8 - Posted 2009-09-25 05:22:45 »

Thanks. Smiley Yeah, Ninja was a good name. Too good I guess.

Uhm, I'm not exactly sure if the ninja.jar there is the same as 0.7. There may be some small differences. I forgot to tag the release in SVN.

Mind if I ask what you are working on? I'd love to see the project in action!

Offline tom
« Reply #9 - Posted 2009-09-25 08:06:39 »

Kind of glad you changed the name. If you google for ninja networking you get www.ninjanetworking.com as one of the top hits. It seems to do roughly the same thing and has a similar logo. Was a bit confusing when you tried to google your library.

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

JGO Kernel


Medals: 147
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #10 - Posted 2009-09-25 08:43:51 »

Heh. Yeah, those were the guys. See, I chose the name "Ninja" and thought I was fine. There is a number crunching library for Java with that name, but otherwise I'm good. When I went to register on Google Code, "ninja" was taken by a non-Java SourceForge project. I registered "ninjanetworking" without checking it sufficiently. Oops!

Oh well, changing the name got me thinking it was better to break it into two projects, so I think in the end things will be a lot better.

Offline Ashley Gwinnell

Senior Newbie





« Reply #11 - Posted 2009-09-25 11:44:18 »

Good to hear that you've created the pages for Skorpios! Smiley
Offline Nate

JGO Kernel


Medals: 147
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #12 - Posted 2009-09-25 12:31:30 »

Ashley Gwinnell, sorry it has been taking so long! I should have some Skorpios code checked in soon.

Checked in the code for Kryo just now!
http://code.google.com/p/kryo/source/browse/#svn/trunk/src/com/esotericsoftware/kryo
It started as the serialization portion of Ninja but has undergone some heavy refactoring. Besides a cleaner API and the ability to use it standalone (without the networking portion) the biggest changes are that it doesn't use static methods and that serialization is thread safe. This makes the library useful in servlets, as well as just about any environment.

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.

BurntPizza (14 views)
2014-09-19 03:14:18

Dwinin (31 views)
2014-09-12 09:08:26

Norakomi (58 views)
2014-09-10 13:57:51

TehJavaDev (79 views)
2014-09-10 06:39:09

Tekkerue (40 views)
2014-09-09 02:24:56

mitcheeb (62 views)
2014-09-08 06:06:29

BurntPizza (45 views)
2014-09-07 01:13:42

Longarmx (30 views)
2014-09-07 01:12:14

Longarmx (36 views)
2014-09-07 01:11:22

Longarmx (36 views)
2014-09-07 01:10:19
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!