Leanpub Header

Skip to main content

Build Your Own RPG Dungeon Crawler in Python

Book 2: Inventory, Magic, Armor, Weapons, and More

Build Your Own RPG Dungeon Crawler in Python

Your dungeon was only the beginning. Add inventory, powerful equipment, character classes, and spells—from Magic Missile to a risky Teleport—as you build a richer Python adventure step by step. Bring it to life with a graphical interface, save your progress, and head downstairs—where death still has the final word.

Minimum price

$7.99

$8.99

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
About

About

About the Book

Your adventurer has survived the first dungeon. Now give them something worth going back for.

Build on your first Python dungeon crawler with a backpack full of possibilities: weapons to equip, armor to compare, potions to save, and spells that can turn a desperate fight into a daring escape. Choose a Warrior, Rogue, or Wizard, develop their abilities, and discover why the right equipment matters as much as a lucky roll.

Through step-by-step explanations and playable chapter checkpoints, you’ll add inventory management, character stats, leveling choices, magical equipment, and a growing spellbook. Hurl a Fireball, summon an ally, charm a monster—or risk a Teleport that might end somewhere unfortunate.

Give gold a purpose with dungeon shops. Return upstairs to floors that remember your choices. Add a graphical interface with animated magic, then save the entire adventure so your character can live to explore another day. Unless, of course, they die.

Written for readers of the first book and Python programmers comfortable with the basics, Book 2: Inventory, Magic, Armor, Weapons, and More shows how a small game grows into a collection of connected systems. Source code, a glossary, troubleshooting guidance, and an appendix explaining intermediate Python techniques help you along the way.

The dungeon is getting deeper. What will you build before heading down?

Author

About the Author

Mike Gold

I have been developing software for over 20 years and worked as a consultant in the banking, manufacturing, healthcare, finance, and military industries. I am a former Microsoft MVP and have a background in Electrical Engineering. I've contributed over 200 articles on .NET/C# technology and have lately been working fullstack with .NET Core and ReactJS

The Leanpub Podcast

Podcast

Podcast Episode

Contents

Table of Contents

Chapter 1: Back Into the Dungeon

  1. What the First Game Was Missing
  2. Who This Book Is For
  3. What We Will Build

Chapter 2: A Backpack at Last

  1. Start With the First Game
  2. Give the Player Somewhere to Put Things
  3. Collect Without Activating
  4. Show All Nine Slots
  5. Read the New Commands
  6. Connect Pickup to Movement
  7. Only Advance After an Action
  8. Try It
  9. Next: Make the Backpack Earn Its Keep

Chapter 3: Use It or Save It

  1. Start From Your Backpack
  2. An Effect Needs to Say Whether It Worked
  3. Give Every Effect the Same Kind of Result
  4. Use First, Remove After Success
  5. Put Something Down
  6. Remember Which Slot Is Selected
  7. Pick Up What Is Under Your Feet
  8. Let the Dungeon Read the New Command
  9. Let an Inventory Action Advance the World
  10. Follow One Potion Through a Turn
  11. Try It Before Going Deeper
  12. Next: Who Is Carrying the Backpack?

Chapter 4: Choose Your Adventurer

  1. Start With Chapter 3
  2. Define Three Starting Classes
  3. Turn a Score Into a Modifier
  4. Give the Player Scores and Derived Values
  5. Let Monsters Use the Same Combat Rules
  6. Roll Against Armor Class
  7. Update Items to Match the New Attributes
  8. Keep Leveling Compatible
  9. Display the Character You Built
  10. Choose Before Entering the Dungeon
  11. Try Three Different Starts
  12. Next: Decide Who You Become

Chapter 5: Earning Your Next Level

  1. Start With Chapter 4
  2. Keep Experience Cumulative
  3. Describe the Choices Once
  4. Make Constitution Affect HP Growth
  5. Apply a Stat Increase in One Place
  6. Show Future Growth Alongside Current Stats
  7. Preview Before Spending the Point
  8. Award the Level, Then Ask the Question
  9. Follow a Warrior Through Two Levels
  10. Finish the Existing Combat Action
  11. Try Earning Your Next Level
  12. Next: Something Worth Equipping

Chapter 6: Weapons, Armor, and Equipment

  1. Start With Chapter 5
  2. Give Items Equipment Data
  3. Define the Gear We Can Find
  4. Build Items Through One Helper
  5. Reference Equipped Items From the Player
  6. Let Dungeon Loot Use the New Templates
  7. Equip Without Removing the Item
  8. Remove Gear Without Dropping It
  9. Show What Equipping Would Change
  10. Use Consumables, Equip Gear
  11. Make Whetstones Follow the Weapon
  12. Drop the Gear and Its Bonus Together
  13. Extend the Backpack Controls
  14. Display the Equipped Set
  15. A Rare Find: Magically Enhanced Equipment
  16. Try a Replacement, Not Just a Pickup
  17. Next: A Different Kind of Treasure

Chapter 7: Something Better Than a Healing Potion

  1. Start With Chapter 6
  2. Decide What Each Potion Does
  3. Restore Mana Without Wasting the Bottle
  4. Reuse the Stat-Increase Rules
  5. Add the Templates
  6. Keep a Stat Potion Unusual
  7. Use the Category Choice When Spawning
  8. Tell the Player What the Bottle Does
  9. Try the Bottles Without Waiting for Luck
  10. Next: Give That Mana a Job

Chapter 8: Learning to Cast

  1. Start With Chapter 7
  2. Describe the Spells
  3. Give the Player a Spellbook
  4. Learn From a Scroll
  5. Let a Wizard Grow Into Sleep
  6. Give Monsters Sleep and Reward State
  7. Handle Damage in One Place
  8. Award a Kill Exactly Once
  9. Trace a Spell Through the Map
  10. Validate Before Spending Mana
  11. Cast the Chosen Spell
  12. Make Sleep Cost Exactly Three Actions
  13. Choose a Spell From the Book
  14. Choose a Target and Commit
  15. Connect Casting to Dungeon Input
  16. Update the Character and Startup Displays
  17. Try Casting Before Going Deeper
  18. Next: A Dungeon Worth Preparing For

Chapter 9: A Little More Magic

  1. Start With Chapter 8
  2. Expand the Spell Table
  3. Teach the New Spells
  4. Let Intelligence Improve Mana Growth
  5. Track Temporary Strength Separately
  6. Let Monsters Be Friendly, Frightened, or Temporary
  7. Share Movement Between Enemies and Allies
  8. Wake and Uncharm Through Shared Damage
  9. Add Critical Hits and Weapon Fumbles
  10. Find Legal Places for an Ally
  11. Define Teleport’s Destination Pool
  12. Find Undead Worth Turning
  13. Define a Fireball’s Blast
  14. Confirm Dangerous Magic Before Spending
  15. Validate Each New Kind of Spell
  16. Let Wizard Spells Grow With Level
  17. Resolve the Spell Effects
  18. Extend the Casting Menus
  19. Show Buffs and Advance One Shared Phase
  20. Try the Expanded Spellbook
  21. Next: Somewhere to Spend the Gold

Chapter 10: The Dungeon Store

  1. Start With Chapter 9
  2. Make a Store Tile
  3. Give the Merchant a Small Business
  4. Define Offers Without Creating Player Items Yet
  5. Put the Store Somewhere Reachable
  6. Complete a Purchase Only When It Can Succeed
  7. Browse Before Spending
  8. Return the Store With Its Floor
  9. Reopen the Shop Without Walking Away
  10. Enter After the Movement Turn
  11. Follow Two Purchases Through the Turns
  12. Try Shopping Before Going Deeper
  13. Next: A Reason to Go Back Upstairs

Chapter 11: Remembering Previous Levels

  1. Start With Chapter 10
  2. Make Stair Travel Deliberate
  3. Reserve Landings Without Blocking the Player
  4. Give Room Placement Enough Attempts
  5. Store a Whole Floor Together
  6. Generate Each Depth Only Once
  7. Keep Actors Off the Arrival Tiles
  8. Remember the Run’s Deepest Point
  9. Read Enter as a Stair Command
  10. Select an Active Floor in the Game Loop
  11. Make a Round Trip
  12. Next: Give the Dungeon a Face

Chapter 12: Giving Your Dungeon a Face

  1. Keep the Working Game Beside the New Face
  2. Let Each Layer Keep Its Job
  3. Set Up Imports and Layout
  4. Load the Engine Without Editing Its File
  5. Build the Application and Its State
  6. Receive Text and Map State
  7. Separate Feedback From Repeated Status
  8. Connect the Adapter to the Engine
  9. Welcome the Player
  10. Read Window Events as Game Keys
  11. Draw Text, Panels, and the Frame
  12. Render the Same Character Grid in Pixels
  13. Fill the Legend, Equipment, and Status Panels
  14. Put Menus Over the Game
  15. Scale the Canvas to the Window
  16. Animate a Missile Without Taking Another Turn
  17. Run and Exit Through One Cleanup Path
  18. Save a Preview Without Playing a Run
  19. Try the New Face
  20. A New Face, the Same Dungeon

Chapter 13: Saving Your Adventurer

  1. Start With the Existing Engine
  2. Decide What a Saved Run Means
  3. Give the Adventure an Owner
  4. Save Values, Then Rebuild Behavior
  5. Reconstruct Items From Their Templates
  6. Preserve Equipment References
  7. Keep Every Explored Floor
  8. Check the File Before Using It
  9. Keep the Random Sequence
  10. Replace the Save Only After Writing It
  11. Save at a Stable Point in the Loop
  12. Make Death Final
  13. Offer Continue or a New Adventure
  14. Use Either Interface
  15. Try Leaving the Dungeon Alive
  16. The Dungeon Can Wait

Chapter 14: The Next Descent

  1. Look at What You Built
  2. Play Before You Add Another Feature
  3. Choose One Next Project
  4. Keep a Working Version Close
  5. Let Someone Else Enter the Dungeon
  6. Make It Yours

Appendices

  1. Appendix A: Where to Find the Source Code
  2. Appendix B: Glossary
  3. Appendix C: A Closer Look at the Python
  4. Appendix D: Corrections to the First Game
  5. Appendix E: Monsters With a Little Uncertainty
  6. Appendix F: Running the Finished Game and Troubleshooting

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub