On 11 Mar 2008, at 20:18, Diego Bernardes wrote:
> Hi guys, i have done a game in ruby using gosu, its a side scrolling
> game, i want to make it multiplayer, well, i hope make it a mmorpg  
> some
> day, so, now im caring about the network, need be something safe but
> consume low bandwidth as possible because of the server.
>
> I dont have any exp doing this, can anyone post web with the basics  
> or a
> tuto or something to give me a start XD?
>
> What is best to work? UDP? TCP? Can i use DRb?

You have two sets of considerations: gameplay and network utilisation.

The gameplay concern is about making sure that one or more players  
aren't cheating so you will probably want to encrypt your traffic.  
Take a look at the Ruby OpenSSL library.

If you're looking at rolling your own protocol I'd recommend doing it  
on top of RUDP as this is more efficient than TCP/IP with lower  
latencies, or if you can afford to lose packets go for UDP.

Another attractive option would be to use the Rinda library which is  
built on top of DRb as that will make your code very simple to follow,  
but if I remember rightly DRb runs over TCP/IP so you may take a  
performance hit.

For a very simple example of using OpenSSL encryption as part of a  
client-server application in Ruby take a look at the code portions of  
my Semantic Networks presentation at http://slides.games-with-brains.net/ 
.

Also be aware that whilst Ruby is a very easy language to code this  
stuff in, if you need high performance you may need to migrate  
portions of your network stack to a C extension. I'm thinking here  
primarily of any MMORPG server you may have in mind in the future -  
for a half-dozen clients it would be serious overkill.


Ellie

Eleanor McHugh
Games With Brains
----
raise ArgumentError unless @reality.responds_to? :reason