Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (523)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
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 help?  (Read 2953 times)
0 Members and 1 Guest are viewing this topic.
Offline bert

Junior Devvie




Miles of road and miles of code


« Posted 2006-05-15 17:37:23 »

I've read the book SAMS Teach Yourself Java 2 in 21 Days, Fourth Edition. Don't judge me on that, I've read many since. However, it has been my only source for networking, and the only part of it that made sense to me was the chapter on Remote Method Invocation (RMI). It didn't make sense to me, though, because the program on the server is not actually running! Huh The reference looked to me like it was just a file on the server and it didn't make sense to me. Can someone clear it up, please?

w00t, i'm winning
Offline sunsett

Senior Devvie




ribbit!


« Reply #1 - Posted 2006-05-15 18:59:51 »

Well, RMI previous to 1.5 is EXTREMELY overly complicated.  RMI post-1.5 is only moderately overly complicated. :-p

Since you're in the game development forums I'm assuming you are wanting this information for game development.  I would highly warn against using RMI for game development.  There are a number of game networking APIs out there (here's where I insert my biased plug).  One such API is JavaGameNetworking (http://javagamenetworking.dev.java.net).  Of course I wrote it, but there are a number of other ones out there that can help you accomplish the task of networking within your games without all of the headache involved of dealing with the information directly.

If you should choose to go directly to the networking you'll probably want to learn about TCP and UDP to move forward.

Good luck,

-Matt Hicks
Offline CommanderKeith
« Reply #2 - Posted 2006-05-16 02:38:00 »


RMI is a massive headache, but thankfully its one of those things you can live without.

Try the JGN API or alternatively get to grips with network communication using the regular I/O streams and sockets.

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

Junior Devvie




Java games rock!


« Reply #3 - Posted 2006-05-16 08:22:28 »

Hehe I often wonder how the world works. I have an idea and whammo .. so did 567295 other people. Cheesy

I have started some projects using RMI to facilitate mutlitplayer games in applets without having to set up network stuff.
I hope this would attract more people as you do not have to validate a whole bunch of wierd stuff... most of which our 'customers' have no friggn idea about.
(note I have not looked further into the matter so I could be completely wrong!)

I have a working example of a basic chat system and am working on a child-friendly battleship clone.

I am not aiming for realtime fps shooters but casual and community games without violent content.

Anyone have more experiance in this?
Offline ryanm

Senior Devvie


Projects: 1
Exp: 15 years


Used to be bleb


« Reply #4 - Posted 2006-05-16 09:32:36 »

RMI is a massive headache,

Really? My (admittedly individual) experience with RMI was great. I followed the tutorial trail to get the Hello World example up and running, and that was the hard part over. From then on, it was just a matter of adding methods, and everything was automagical.

Was I just lucky?
Offline OverKill

Junior Devvie




Java games rock!


« Reply #5 - Posted 2006-05-16 09:38:12 »

Really? My (admittedly individual) experience with RMI was great. I followed the tutorial trail to get the Hello World example up and running, and that was the hard part over. From then on, it was just a matter of adding methods, and everything was automagical.

Was I just lucky?
Getting it to run for me was a PITA but then, easy money.
Somehow I was to dense to figrue out the tutorial I had and that you had to start the server class.
Offline harry@dayfamilyweb

Junior Devvie





« Reply #6 - Posted 2006-05-16 10:05:06 »

why on earth do you need a special API? just use the java.net ServerSocket and socket classes
Offline ryanm

Senior Devvie


Projects: 1
Exp: 15 years


Used to be bleb


« Reply #7 - Posted 2006-05-16 10:27:49 »

why on earth do you need a special API? just use the java.net ServerSocket and socket classes

RMI abstracts away from the actual networking, and makes interacting with objects on the server look almost the same as interacting with objects locally. Sure, you could build your own abstraction layer to wrap up the sockets and such, but you'd eventually just reinvent RMI.
There's a couple of things to bear in mind: that RMI will have more overhead than a custom networking protocol, and that objects passed through the remote methods must be Serialisable, but other than that, it's all gravy (again, in my limited experience).
Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Reply #8 - Posted 2006-05-16 11:19:26 »

why on earth do you need a special API? just use the java.net ServerSocket and socket classes

Thats like saying 'why use Java, just write bytecode'

The sockets are the lowest layer in the networking (software side). It is *far* easier to use a generic library. If you really need something that is very very specific, then yes, write your own. I admit that the networking libraries that exist are not great, and before SGS I wrote my own, but it's a PITA.

Endolf

Offline sunsett

Senior Devvie




ribbit!


« Reply #9 - Posted 2006-05-16 11:59:08 »

When I was first looking at adding networking to my games I actually was thinking along the lines of RMI, but my games are primarily first-person shooter style games that need real-time messaging and I knew the horrendous clutter that comes with RMI.  I actually started JGN with the idea of writing something with all the benefits of RMI but none of the headache or problems.  With JGN you can simply create your own custom "Message" objects that are simple beans with getters and setters.  You can then just send them to other clients or the server and they can receive them as events to an added MessageListener.  This significantly reduces the complexity of the networking code required in your game development and lets you focus more on game development than worrying about all the nasty socket connectivity stuff you're maintaining in your game.

There are other networking APIs that provide somewhat similar functionality.  They do this because it just makes sense to reduce the complexity in your game.  Sure, you can go directly to the TCP and UDP, but by abstracting as much of that away as possible you make management of your games significantly easier.  Further, many of the networking issues can be handled "under the hood" once so it doesn't have to be dealt with every time you develop a game.  Abstraction when used properly is a very powerful and beneficial thing to a developer.

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

Junior Devvie




Miles of road and miles of code


« Reply #10 - Posted 2006-05-30 20:27:05 »

I'm going to post this into the Newbies forum as well but I don't understand how the Sockets work.

w00t, i'm winning
Offline Kova

Senior Devvie





« Reply #11 - Posted 2006-05-30 23:54:18 »

well you can't learn everything just from javadocs... read tutorials, books and you will learn Smiley Search for java nio tutorials or books
Offline ENC

Junior Devvie





« Reply #12 - Posted 2006-06-05 07:35:29 »

Then for in games... it is always better to use connection connection instead of a connectionless connection?? cause in terms of overhead connectionless has less overhead
Offline sunsett

Senior Devvie




ribbit!


« Reply #13 - Posted 2006-06-05 12:17:14 »

ENC,

they both have merit...in most cases it makes sense to have both UDP and TCP in the same game.  For example, messages that need guaranteed delivery such as chat messages, important information, deaths, etc. that need to make it to everyone to guarantee the game remains in sync should most likely be done with TCP, but positional synchronization that is continuously being sent could fit into UDP (although it could also be done over TCP if so desired).

Make sense?

-Matt Hicks
Offline OverKill

Junior Devvie




Java games rock!


« Reply #14 - Posted 2006-06-06 10:39:09 »

@bert:
How is the work going?
Are you still using RMI or have you switched to Sockets?

Last stuff I did I was having problems with the dialog (awt/swing) stuff. Smiley
Been away on vacation so no progress updates from me but will be getting back to work asap.
Offline ENC

Junior Devvie





« Reply #15 - Posted 2006-06-06 11:03:53 »

hi Matt!

Oh... but if I use TCP for all the functions den would the game lag.. cause there is alot of graphics...?

Is there any recommened features that would be better for TCP? rather than UDP?

and are there any features that UDP would be better?


Cheers!
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.

SHC (24 views)
2014-11-25 12:00:59

SHC (23 views)
2014-11-25 11:53:45

Norakomi (19 views)
2014-11-25 11:26:43

Gibbo3771 (22 views)
2014-11-24 19:59:16

trollwarrior1 (36 views)
2014-11-22 12:13:56

xFryIx (74 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (41 views)
2014-11-12 21:09:33

kovacsa (68 views)
2014-11-07 19:57:14
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!