Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (117)
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  
  RMI for networking?  (Read 2973 times)
0 Members and 1 Guest are viewing this topic.
Offline deepthought
« Posted 2010-12-26 20:58:18 »

would it be a good idea to use RMI for a networked game, or would it be too slow?

jocks rule the highschools. GEEKS RULE THE WORLD MWAHAHAHA!!
captain failure test game
Offline dbotha

Senior Newbie





« Reply #1 - Posted 2010-12-26 21:28:48 »

I would avoid it and stick with plain old sockets Smiley
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 800
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #2 - Posted 2010-12-26 21:29:48 »

I would strongly advise against it.

Not only do you suffer from RMI garbage collection, RMI simply isn't suited for anything realtime.

If you, however, will want to use it, be sure to disable Nagle's Algorithm, because of the lack of explicit flushing in RMI, you can have serious unexpected multi second delays.

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 deepthought
« Reply #3 - Posted 2010-12-26 21:42:41 »

so... say i use an interface with methods like update(int x, int y, int z, int frame) and
damage(int damage) using only primitives, so serialization is not needed, will it go reasonably fast?

or should i just send messages like that over a socket?

jocks rule the highschools. GEEKS RULE THE WORLD MWAHAHAHA!!
captain failure test game
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 800
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #4 - Posted 2010-12-26 21:45:28 »

Use DataInputStream & DataOutputStream, it surely is much better to understand the underlying technologies and their characteristics, before you go highlevel with RMI or its alternatives.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline delt0r

JGO Knight


Medals: 27
Exp: 18 years


Computers can do that?


« Reply #5 - Posted 2010-12-27 11:26:23 »

I even use human readable messages when i am developing net code. I can switch between debug human readable and, binary compressed even in release versions. Being able to see things with tools like tcpdump is invaluable.

I have no special talents. I am only passionately curious.--Albert Einstein
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 800
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #6 - Posted 2010-12-27 11:50:16 »

I would also advise starting with a human readable protocol: plain text. Line separated protocols probably work best. Almost the entire internet runs on these 'legacy' easy to debug protocols.

I'm so used to getting criticism for it, with people advising really highlevel network APIs, that I didn't bother.

But just like you do the occasional System.out.println() or draw a few debug shapes in your UI, it's best to have a way to visualize your network traffic. Looking at binary doesn't really help.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Nate

JGO Kernel


Medals: 147
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #7 - Posted 2010-12-27 12:12:44 »

When I'm using KryoNet, it has debug logging so you can see what classes are being sent. This is generally not enough information to do much debugging. It also has trace logging, so you can see every little step of serialization. This is generally too much information (unless debugging serialization rather than game logic). So what I end up doing is this:

1  
2  
3  
4  
5  
StringWriter stringWriter = new StringWriter();
YamlWriter yamlWriter = new YamlWriter(stringWriter);
yamlWriter.write(message);
yamlWriter.close();
System.out.println(stringWriter);


This uses YamlBeans to dump all the fields on an object as YAML, which is nice and human readable. Smiley YamlBeans uses reflection to serialize very similar to KryoNet: handles object graphs, looks at fields the same way, etc. Example output:

Quote
!com.esotericsoftware.arcanetactics.actions.server.CastAction
action: !com.esotericsoftware.arcanetactics.actions.FireballAction
   id: 1
   characterID: 6
   column: 7
   row: 3
   x: 832
   y: 284

!com.esotericsoftware.arcanetactics.actions.server.TimerCancelAction
id: 1
completed: true

!com.esotericsoftware.arcanetactics.actions.server.HealthAction
characterID: 1
effectType: fireball_hit
value: -5

!com.esotericsoftware.arcanetactics.actions.CloakTimer
characterID: 6

Offline deepthought
« Reply #8 - Posted 2010-12-29 20:56:30 »

Riven's right. i should just use plain text(or binary and have an option on the server to dump a plaintext translation).

 :)Thanks for the help! Smiley

jocks rule the highschools. GEEKS RULE THE WORLD MWAHAHAHA!!
captain failure test game
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.

Grunnt (17 views)
2014-09-23 14:38:19

radar3301 (14 views)
2014-09-21 23:33:17

BurntPizza (31 views)
2014-09-21 02:42:18

BurntPizza (22 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (29 views)
2014-09-20 20:14:06

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

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

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

TehJavaDev (105 views)
2014-09-10 06:39:09
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!