Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

MoLD: Request for Advice

by vaevictus (Pilgrim)
on Jun 13, 2002 at 20:10 UTC ( #174326=perlquestion: print w/replies, xml ) Need Help??

vaevictus has asked for the wisdom of the Perl Monks concerning the following question:

I'm codeveloper for MoLD, a roguelike game written in perl.

See _the_code_

We've decided *basically* how most things should be laid out in our game, yet are having some difficulty meeting some of our development goals.

These Goals being:

  • OO Perl.
  • Distinct Seperation between UI and game core.
  • multiple UI capabilities.
  • Some portability
  • General Code Asthetics
  • Efficiency, as much as feasible

I feel we've done well with most of these attempts... excepting possibly for the quality of our OO Perl, and probably with the Asthetics and quality of our code in general.

We're trying to use Heap::PriorityQueue for our event queue, and we've got some issues with our command processing code, which should be a collection of CODEREFS.

Basically, I've got some things laid out in docs/command_pathways that i'd like looked over, as well as all of the code in general... I'd like to increase number of MoLD enthusiasts. Please checkout the code and try it out.

Warning: possibly isn't very portable at all right now, but is currently tested on FreeBSD and Linux on perl 5.6.1.

Replies are listed 'Best First'.
Re: MoLD: Request for Advice
by TGI (Parson) on Jun 14, 2002 at 01:37 UTC

    I just saw an interesting presentation on POE. It's an event driven application environment.


    TGI says moo

Re: MoLD: Request for Advice
by vaevictus (Pilgrim) on Jun 13, 2002 at 20:41 UTC
    Clarification:
    Most of our event code is unwieldy.
    This is how I'd like it to work:

    The Command_processor should have the following information in it for each valid command: Valid Command - "move west" Pre Acceptance Checking - "can I 'move west'" Event Class - "what kind of event is 'move west'" Event Delay - "how long will moving west take?" Event - "how do I 'move west'" The Command_Processor will most likely have CODEREFS for each of the data types, except for Event Class. For efficiency, Command_Processor will contain a single hash of hashes... perhaps like the following: $self->{matrix}= ( "move west"=> ( "Test"=>\&Player::MoveTest('west'), "Class"=>"Player", "Delay"=>\&Player::MoveDelay('walk'), "Event"=>\&Player::Move('west') ), "run west" => ( "Test"=>\&Player::MoveTest('west'), "Class"=>"Player", "Delay"=>sub { return int (100/($DEXTERITY /2) +)} , # OR ## "Delay"=>\&Player::MoveDelay('run'), "Event"=>\&Player::Move('west') ), } ############################################################### So when the command processor recieves a request, it first checks for the validity of the command: return $INVALID_CMD unless defined ($self->{matrix}->{$NEWCOMM +AND}); And then: return $CMD_FAIL unless &$self->{matrix}->{$NEWCOMMAND}->{'Tes +t'}; and if everything is okay: return $self->{eventqueue}->event_add( &$self->{matrix}->{$NEWCOMMAND}->{'Delay'}, &$self->{matrix}->{$NEWCOMMAND}->{'Event'} ); And this is how it should work. ###############################################################
Re: MoLD: Request for Advice
by vaevictus (Pilgrim) on Jun 13, 2002 at 20:52 UTC
    You can also get the CVS in a tarball at this site

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2022-01-25 18:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (67 votes). Check out past polls.

    Notices?