Java RMI question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

Java RMI question

would RMI be good for this scenario? I have a game I have been working on for a year now, and want to add multiplayer. Of which, when turned on, another computer running a special client can execute a command (i.e summon tornado or something), on the PC which is currently playing the game The book I have been reading, suggests RMI is used for much different remote instances. If so, are there any other ways of pulling something like this off?

31st Jan 2018, 6:47 AM
DeleteThisAccount
4 Answers
+ 3
Summarizing a response I posted on another forum we are on, I would advise against using Java RMI for the following reasons: - Requires configuring firewall ports for RMI communication to occur. Even if users are willing to do this, this opens up other security concerns. - Limited only to Java applications that have been compiled with the RMI interfaces. - Cannot run on devices that do not support Java Runtime, such as iOS. - Horrible support for backward compatibility when updating RMI libraries. Rather, I recommend exploring the use of web sockets for the following reasons: - Supported over standard web ports. - Doesn't require Java Runtime, so it can be extended to iOS and app built in other languages. - Can support backward compatibility when introducing non breaking changes to existing interfaces.
7th Feb 2018, 7:12 PM
David Carroll
David Carroll - avatar
+ 5
RMI could be used to do it, but peer to peer would be how I'd do it. As soon as you open up RMI, you increase possible hacking opportunities that you must think of and protect against. Peer to peer limits it making it easier on your part to stop hackers. I can watch the data being sent via the network and stuff my own copies in, illegally spawning tornados. You need to detect and prevent that. It will be much harder with RMI as all of the communication is out of your hands.
7th Feb 2018, 6:20 PM
John Wells
John Wells - avatar
+ 3
@Kavuma I simply want to execute a command on one computer, to do something on another. Examples online and in my book mention multiple servers and a bunch of confusing stuff
3rd Feb 2018, 6:07 AM
DeleteThisAccount
+ 2
It always depends on you the developer. How do you want it to be?
2nd Feb 2018, 5:36 PM
Izaiah Kay
Izaiah Kay - avatar