[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: [QUIZ] Space Merchant (#71

Ross Bamford

3/21/2006 8:57:00 AM

On Tue, 2006-03-21 at 08:45 +0900, James Edward Gray II wrote:
> On Mar 20, 2006, at 3:00 PM, Ross Bamford wrote:
>
> > On Tue, 2006-03-21 at 02:48 +0900, James Edward Gray II wrote:
> >> On Mar 20, 2006, at 11:41 AM, Ross Bamford wrote:
> >>
> >>> Anyway, the problem with that was that, since Sector handles most
> >>> of the
> >>> output (and will probably just call puts) the output all goes to the
> >>> server's terminal :(
> >>
> >> Could you have the client pass you $stdout and $stdin, then set them
> >> on the server?
> >
> > I had a go with this, but couldn't get it to work.
>
> Bummer. Here is where I got the idea, just FYI:
>
> http://ian.blen...

Ahh, I see. It looks like we had pretty similar concepts of how it
should work, but my stdout/stdin references kept on turning into
DRb::DRbUnknown instances after I made the first call on them. The other
problem was that, because we have to handle multiple players and sectors
use 'puts' for output, I had to keep the right bits for each player
somewhere and redefine puts to take account of that. Fortuntely DRb
seems to do thread-per-client so I could store it there.

Doing that, though, I realised it might be nicer to route everything
through the player after all - the output setup is currently completely
transparent from the game classes' point of view, so could be easily
changed e.g. to use a different output style, or for
internationalization (instead of marshalling the messages, give each
message a number that is sent over the wire, and looked up on the client
to get the right message).

Also, since the player is provided by the client, different clients
could be using different output formats or whatever with the server
having no knowledge of that :)

--
Ross Bamford - rosco@roscopeco.REMOVE.co.uk



1 Answer

James Gray

3/21/2006 5:25:00 PM

0

On Mar 21, 2006, at 2:56 AM, Ross Bamford wrote:

> Doing that, though, I realised it might be nicer to route everything
> through the player after all - the output setup is currently
> completely
> transparent from the game classes' point of view, so could be easily
> changed e.g. to use a different output style, or for
> internationalization (instead of marshalling the messages, give each
> message a number that is sent over the wire, and looked up on the
> client
> to get the right message).
>
> Also, since the player is provided by the client, different clients
> could be using different output formats or whatever with the server
> having no knowledge of that :)

This is a great point. Good ideas all around. I believe you're
right that this would be the correct way to handle multi-player.

James Edward Gray II