Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Help making simple RPG game less boring

by jethro (Monsignor)
on Oct 30, 2012 at 13:22 UTC ( [id://1001498]=note: print w/replies, xml ) Need Help??


in reply to Help making simple RPG game less boring

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'.

Replies are listed 'Best First'.
Re^2: Help making simple RPG game less boring
by jms53 (Monk) on Oct 30, 2012 at 13:27 UTC
    Yep,
    After the previous comments I'm restructuring the whole thing to work with subroutines.
    I really like the location idea.
    J -

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-03-29 09:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found