Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

PerlMonks MUD in progress

by Coruscate (Sexton)
on Jul 13, 2003 at 05:04 UTC ( [id://273738]=perlmeditation: print w/replies, xml ) Need Help??

Since ar0n seems to have dropped the idea of a MUD type game for the PerlMonks community, I have decided to take it upon myself to get things rolling. This is my official announcement: the beginning of PerlMonks MUD is now underway by none other than myself. Any help that other monks may wish to offer is welcome. From rooms and objects to game commands and client/server code, any efforts will be appreciated greatly! The 'official website' for PerlMonks MUD will be kept at http://coruscate.perlmonk.org. Check it out for lots of goodies. Below is a little more info:

I had begun work on the project months ago but gave up for a while once I realized that communicating with telnet clients was hopeless. I have now redesigned things a bit and am also writing a custom client for the MUD server. Unfortunately, the client is a forking one, so windows users will currently be left in the dark. I expect that someone will come up with an alternative rather quickly so that everyone can participate.

Yes, PerlMonks MUD will require a valid PerlMonks login. No, your account information will not be stolen. It currently throws away the login info once the authentication is complete. In the future, a cookie may need to be stored to allow future hits to the site where a login is required (such as Message Inbox or certain xml tickers). When the time comes, a notice will be put up announcing that login cookies are being kept.

Fun times ahead! - Coruscate


If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.

Replies are listed 'Best First'.
Re: PerlMonks MUD in progress
by l2kashe (Deacon) on Jul 14, 2003 at 01:02 UTC
    *chuckle*..

    I've been working on one as of late myself. I think banging out a MUD is a pretty common task for certain types of programmers. It just seems to cover a very nice range of interesting problems from UI, to input validation, resource management, network communication, etc...

    I am interested why you didn't like communication via telnet? Also why the need for a custom client?

    With that said, all I can say is POE. Amazing beautiful POE (can you tell what I've been using as my base? ;) ).

    I'll be keeping an eye on this, but for now I think I'll stick with scratching my own itch.

    MMMMM... Chocolaty Perl Goodness.....

      People continue to suggest POE. I installed it, looked at the intro docs, and wanted to hide under a table. There is just too much to handle when using the module. Not only do you have to pick components, filters and wheels, you have to manually modify this 'heap' thing. Then there are so many event handlers that I can't even pick out the ones that are actually needed and which ones are there to bloat examples. I mean, just look at the second code "snippet" in this TCP server example. I see 5 imported modules, 4 calls to constructor methods, and a lot of code for an echo server. :|


      If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.

        Heh, fight the good fight brother.. ;)

        Seriously though. I too was fairly overwhelmed by the initial docs. Until you really grok what is available with POE it all seems so daunting. The way I got over it was I grabbed a perl based mud from sourceforge (I believe its called poe-mud, or some such), and hit http://poe.perl.org. On the poe site there is a simple chat server that I used as my base, and I have been extending since. If memory serves this is all it takes to get a full fledged TCP based server up and functional. ready?
        #!/usr/bin/perl use strict; use POE qw( Component::Server::TCP ); POE::Component::Server::TCP->new( Alias => "MUD", Port => '30000', InlineStates => { 'send' => \&handle_send, }, ClientError => \&c_error, ClientInput => \&c_input, ClientConnected => \&c_connect, ClientDisconnected => \&c_disconnect, ); $poe_kernel->run();
        So the server has predefined events, when those events happen the routines referenced on the right are called.

        In regards to the heap, as far as I have been able to understand it the heap is just that. A session's very own memory space. So that in sub_A you could set $heap->{some_key} = 1, and in sub_B do if ( $heap->{some_key}). The heap is there to get around shared memory issues I think.

        At any rate, stick with POE. I know its disconcerting, but the beauty and power of those modules are simply breathtaking for me. At some point I do believe I will be helping that project out, as it is so useful.

        Spend time reading POE::Kernel, and POE::Session. Once you really grok those 2 modules, then the rest just kind of falls into place. Also grab something written using POE and pull it apart, play with it, and make something slightly different. At some point the light will come on, and you will probably say "Holy @(#$, thats all it takes to do that?!?"

        Update: altered poe.perl.com -> poe.perl.org :P

        MMMMM... Chocolaty Perl Goodness.....
Re: PerlMonks MUD in progress
by castaway (Parson) on Jul 15, 2003 at 07:16 UTC
    I still don't understand your problems with telnet clients. Communicating with them is in no way hopeless, or even that difficult (IMO). Telnet clients talk the telnet protocol, if you want to talk to them you need to at least know how to ignore the specfic bits of that protocol. (Which is what my mud does currently, will get around to actually using it sometime.) It's like trying to get information from a web server, and not talking HTTP.. Crazy ;)

    Here's how I ignore the telnet protocol:

    sub ignore_options { # remove all telnet options from incoming text # Parameter: Text my ($text) = @_; my $chIAC = chr(255); my $chDONT = chr(254); my $chDO = chr(253); my $chWONT = chr(252); my $chWILL = chr(251); my $chSB = chr(250); my $chSE = chr(240); my $chSEND = chr(1); my $chIS = chr(0); my $chEOR = chr(239); my $pos = -1; while(($pos = index($text, $chIAC, $pos)) > -1) { my $nextchar = substr($text, $pos + 1, 1); if(!length($nextchar)) { last; } if($nextchar eq $chIAC) { substr($text, $pos, 1) = ''; $pos++; } elsif($nextchar =~ /($chDONT|$chDO|$chWONT|$chWILL)/) { substr($text, $pos, 3) = ''; } elsif($nextchar eq $chSB) { my $endpos = index($text, $chSE, $pos); substr($text, $pos, $endpos - $pos + 1) = ''; } elsif($nextchar eq $chEOR) { substr($text, $pos, 2) = ''; } else { substr($text, $pos, 2) = ''; } } return $text; }
    Still, reinvent a few wheels if you want to..

    C.

Re: PerlMonks MUD in progress
by Anonymous Monk on Jul 13, 2003 at 21:27 UTC
    If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.

    If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant please reply to this node or /msg me as to what could be improved with the post, so that I may update the node to the best of my ability.

    Gives it a much better tone, although most of it goes without saying anyways :)

    As for the MUD, don't you think there's a better way to handle the logins? Perhaps just getting users to /msg you and then sending them a new generated password. Besides, how were you going to authenticate their user/pass in the first place - login to perlmonks as them?

      My signature is the way it is because I like to note the fact that downvotes are a welcome factor when they are given when appropriate. It's also a memo to those who downvote without reason: if you can't give me a reason for the downvote, then I take the negative vote as just that: a physical vote with no thought on the voter's side of things. If however, I am told why I was knocked down, I know the voter spent time analyzing my post. I can take it as constructive critisism and can fix things so that the post will provide a better response for the next reader that stumbles upon it.

      Perhaps just getting users to /msg you and then sending them a new generated password.

      Yes, that's fine if all I needed to do was verify that a new player is an existing PerlMonks member. This method would not allow me to later access the site with their login (programatically of course). For example, if and when I add a feature that allows users to check their private messages, I would require the login cookie which effectively requires a username/password combo to first be sent to the site.

      Besides, how were you going to authenticate their user/pass in the first place - login to perlmonks as them?

      Essentially... yes. To be precise, I'll be executing more or less the following code for now. In the future, the value of $xml->{'_headers'}->{'set-cookie'} may need to be kept (only in memory) for the duration of a session in order to allow successive hits to the site's xml feeds as a logged in user. Note that the cookie wouldn't even be stored in a database. Only in memory from the point in time when a user logs into the MUD to the time they logout.

      my $username = user_input('Username: '); my $password = user_input('Password: '); my $ua = new LWP::UserAgent; my $xml = $ua->get( 'http://www.perlmonks.org/index.pl?node_id=227820&' . 'op=login&user=' . uri_escape($username) . '&passwd=' . uri_escape($password) ); undef $password; # deny access to $password later on deny_access('User authentication failed.') unless grep { /set\-cookie/i } keys %{$xml->{_headers}};

      Thanks :)


      If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.

        if and when I add a feature that allows users to check their private messages, I would require the login cookie which effectively requires a username/password combo to first be sent to the site.

        You are a much braver person than I.

        Personally I wouldn't want to be responsible for the account information of everyone playing the game. I'm sure perlmonks accounts aren't worth much to most people but this is a troll's wet dream. I assume you'd be sending the passwords from your site to Perlmonks in plain text? I hope you at least trust every system between you and perlmonks (including your own).

        How these things go uncriticized on a web development site are beyond me.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://273738]
Approved by hossman
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2024-04-23 09:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found