Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Help making simple RPG game less boring

by jms53 (Monk)
on Oct 30, 2012 at 12:10 UTC ( #1001493=perlquestion: print w/replies, xml ) Need Help??
jms53 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, I mattempted making an RPG in Perl, mainly to better understand hashes and AoHs. I enjoyed coding it, but running it is... tedious to say the least.

The code is available at

If anyone has pointers for making it less boring, I would be very grateful :) EDIT 30.10.12 17:53 After the input I am rewriting everything from scratch using subroutines
J -
  • Comment on Help making simple RPG game less boring

Replies are listed 'Best First'.
Re: Help making simple RPG game less boring
by marto (Archbishop) on Oct 30, 2012 at 12:21 UTC

    Since you're not asking a Perl question, rather a game design quesiton I'm confused as to why you're posting here. However, so far:

    At this point I've pressed one button, this one decision has resulted in all the action taking place. I'm now level 9 for deciding to play the game by pressing '1' rather than the script dying at line 120 with an "uncaught exception" (which occurs when you select "2" rather than "1").

    The game lacks any real user involvement I've experienced with other text based RPGs. If you want it to be interesting for people I suggest more user involvement, less automated actions. Perhaps you should check out some other games of this nature and see how they engage users.

    Update: Added option "2" explanation.

      I posted it here because I coded it as a Perl learning exercise. Currently restructuring the whole thing to be more user oriented.
      Thanks for your input!
      J -

        But you ask for game critique, rather than programming advice. I appeciate that this was a Perl exercise, but regardless of which language it was created in the game experience would be the same.


        You pick up some ancient armor, def + 100 A wolf appears You attack the wolf for 43 The wolf retaliates with 150 The wolf has 58 health, you have 205 You attack the wolf for 45 The wolf retaliates with 150 The wolf has 13 health, you have 105 You attack the wolf for 54 The wolf retaliates with 150 The wolf has -41 health, you have -45

        I now have less health than the wolf, which dies, but am somehow still alive and leveling up.

      Since you're not asking a Perl question, rather a game design quesiton I'm confused as to why you're posting here.

      Should post in Meditations?

      Design is part of everything

        For clarification, the question of this being "boring" doesn't relate to a perl problem with this program, if this were written in BASIC it'd be just as "boring". It's somewhat subjective, what one person finds boring another may not. As described in Where should I post X?, Seekers of Perl Wisdom is for problems specifically relating to perl, rather than solving the problem of how make something less boring to use/play.

        The fact that it the program doesn't work as intended (for example, I later posted how I died yet defeated a wolf) is a programming problem, I noticed this as I reevaluated the programs vast output based on my one decision/choice. The question OP asked was how to make the game less boring, which is outwith the scope of Perl.

Re: Help making simple RPG game less boring
by jethro (Monsignor) on Oct 30, 2012 at 13:22 UTC

    You don't have a single subroutine in your script. I have coded lots of simple scripts without subroutines or modularisation, but even a simple game should be so complex that it becomes impossible to manage without some abstraction and structure.

    For example, make a subroutine that does the monster selection. The subroutine should be called with the parameters $lvl and possibly location type (so that wild pigs are only encountered in forests, Mothers-in-Law only in towns). Also not every location should have a monster

    Make a subroutine that is called whenever the player moves into a new location. It should select and print what the location is (hill, road, forest, town) and return the location type. Maybe add some special events that can happen

    Make a subroutine that asks the player what to do when he enters a location without a monster. Possible things to do: Heal, select a different weapon, search the area, goto next location

    Make a subroutine for fighting monsters. This subroutine should ask the player each round what to do (attack, change weapon, run away, make a special attack (more damage, but less defense on the counter attack of the monster), heal ...) and resolve that. Don't hesitate to put each action the player can do in its own subroutine.

    Try to give each subroutine everything it needs as a parameter. Your main script should essentially be a few subroutine calls that show the structure of the game.

    If you have done that your script has become more maintainable and your game is probably a bit more fun.

    UPDATE: I forgot the usability hint: Don't let the player enter 1,2,3... to select the options, attack should be 'a' not '1'.

      After the previous comments I'm restructuring the whole thing to work with subroutines.
      I really like the location idea.
      J -
Re: Help making simple RPG game less boring
by pvaldes (Chaplain) on Oct 30, 2012 at 13:18 UTC

    More RPG: the biggest fail is that the game is plain because your characters are plain. Your hero don't even has a name, origin, or a description.

    Detailed description of the surroundings, scene and monsters, less plain descriptions of the monsters and not standard monster names (why to have a wild boar when you can have a vampire babirusa instead, or to have a wolf when you can have a ice canyon's wolf?), use your imagination, don't mix very different monsters in unprobable surroundings, and basically, tell a history

    More Perl: maybe a sub {} for each monster, a line that shows briefly an image of each monster and a few sound files played at random times, (Use Inline::Files), or a gtk structure of windows and buttons... There is a lot of room to improve and make your game special

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1001493]
Approved by biohisham
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2018-05-23 05:57 GMT
Find Nodes?
    Voting Booth?