Lesson 18.1 – Future enhancements for the game


You finished with the lessons, and have a working game!

Plus, you’ve learned many of the most common things you need to write more C# programs.

There is still plenty more to learn, if you decide to get serious about programming. I’ve been programming for over 30 years, and learn something new every week.


Expanding the game

The easiest thing for you to do is to make a bigger world, with more locations, quests, monsters, and items.

Draw a map of your larger world, and modify the World class to include these new locations. Create more monsters and quests. Add more powerful weapons, so the player can defeat the giant spider.


Ideas for new features

This is a very simple RPG, and there is a lot you can do to expand it.

Here are a few ideas:

  • Save the player’s current game to disk, and re-load it later
  • As the player gains experience, increase their level
    • Increase MaximumHitPoints with each new level
    • Add a minimum level requirement for some items
    • Add a minimum level requirement for some locations
  • Add randomization to battles
    • Determine if the player hits the monster
    • Determine if the monster hits the player
  • Add player attributes (strength, dexterity, etc.)
    • Use attributes in battle: who attacks first, amount of damage, etc.
  • Add armor and jewelry
    • Makes it more difficult for the monster to hit the player
    • Has special benefits: increased chance to hit, increased damage, etc.
  • Add crafting skills the player can acquire
  • Add crafting recipes the player use
    • Require the appropriate skill
    • Requires components (inventory items)
  • Make some quests repeatable
  • Make quest chains (player must complete “Quest A” before they can receive “Quest B”)
  • Add magic scrolls
  • Add spells
    • Level requirements for the spells
    • Spells require components to cast (maybe?)
  • Add more potions
    • More powerful healing potions
    • Potions to improve player’s “to hit” chances, or damage
  • Add poisons to use in battle
  • Add pets
    • Help the player in battle by attacking opponents
    • Help the player in battle by healing the player
  • Add stores/vendors
    • Player can sell useless items and buy new equipment, scrolls, potions, poisons, and crafting/spell components


There are also more programming techniques you can learn to make the program a little cleaner.

  • LINQ, when searching lists
  • Events/delegates, to handle communication between the “logic” project and the UI project – which will let you move more logic code out of the UI project
  • BindingList, so you don’t have to repeatedly repopulate the DataGridViews and ComboBox in the UI


Version control

If you’re going to make more changes, or write more programs, you really should learn how to use a version control tool.

You can create a backup copy of your program by copying the solution folder to a new location before making your change. But version control software is a better solution.

It will let you keep track of all the changes you ever make to your program. This is extremely helpful when you make some changes that don’t work, and want to go back to the old, working version.

I use TortoiseSVN (Subversion) and VisualSVN (a Visual Studio plug-in that works with TortoiseSVN).

Git is another popular version control tool. Many programmers use a web-based version of it at GitHub.

Version control tools usually take a little while to set up, and to figure out how to use. But once you have one in place, and you learn the basics, using it will become a habit that doesn’t require any time or thought. And the first time you need to go back to a previous version, you’ll thank yourself that you used version control.



Now that you have the basic game, you can expand it.

Hopefully you enjoyed these lessons, and learned some new things.

Please let me know if you have any questions about anything that wasn’t clear in the lessons, if you want to see some other features in the game, or if you want to learn some other aspects of programming in C#.


Next lesson: Lesson 19.1 – Scroll to the bottom of a rich text box

Previous lesson: Lesson 17.1 – Running the game on another computer

All lessons: Learn C# by Building a Simple RPG Index

52 thoughts on “Lesson 18.1 – Future enhancements for the game

  1. Hi again Scott,

    I was wondering if I wanted to change the form’s background image depending on what location the player is currently at, how would I go about that, if it’s even possible?

    I’d assume you would have to add a new property to the Location class and its’ class constructor but I not sure how to program it.

    Then there is also the fact, would I have to individually import the images in the World class and then have it included in creation the locations in the world.

    Anyways, I’m not really sure, but here are my thoughts, please let me know if I’m not making myself clear enough.


    1. Hi Taryn,

      Here is some information on how to set the background image for a Windows Form: https://stackoverflow.com/questions/20045676/how-to-change-background-image-of-a-form-in-c It tells how to change the image based on the user selecting a menu option. But, you can change that to when the player is at a new location.

      Here are some lessons about adding images to SuperAdventure (this version, and a WPF version):
      Lesson 26.1 shows how to include images in a project.
      Lesson 04.1 and lesson 04.2 (of the WPF version of this game) show how to modify the Location class, so you know which image to display. You won’t be able to paste that code into your version of the game, but it should give you an idea how it works.

      Let me know if you try it and have any problems.

  2. Hi again Scott,

    So I was able to successfully modify the location class and the locations themselves but I don’t know how to get the string image path to an actual image to be able to set it as the background image.

    I’ve tried adding

    //Set the background image of the form
    this.BackgroundImage = newLocation.ImageName;

    And then I tried

    Image myImage = new Bitmap(newLocation.ImageName);
    this.BackgroundImage = myImage;

    And it didn’t bring up an immediate error but when I ran the code it came up with an error that states “An unhandled exception of type ‘System.ArgumentException’ occurred in System.Drawing.dll” If you have an idea of what I should or could do, that’d be most appreciated.

    Thanks a lot,

    1. Do all locations have a value for their ImageName property?
      What values are you putting into the ImageName property? Do they include the namespace, like “/Engine;component/Images/Locations/{imageName}” (including the image file’s extension, like “png”)?
      Are the images included in the project, and are their “Build Action”s set to “Resource”?

  3. Hello Scott. Thanks for your tutorials.

    However, I ran into a problem when I start my program. As I wanna choose a sword, it stands as Engine.Weapon. When I click it, it crashes.

    1. Hi Anders,

      In SuperAdventure.cs, do you have these lines of code:
      cboWeapons.DataSource = _player.Weapons;
      cboWeapons.DisplayMember = "Name";
      cboWeapons.ValueMember = "Id";

      If that is correct, can you upload your solution (including the directories under it, and all the files in those directories) to GitHub or Dropbox, so I can look at it?

        1. I found the problem. It is with some “eventhandlers” – connections between UI controls (buttons, comboboxes, etc.) and the code in SuperAdventure.cs. This can happen if you accidentally double-click on the UI control, when you are in the form designer.

          The program should work if you update SuperAdventure.cs and SuperAdventure.Designer.cs with the files here: https://gist.github.com/ScottLilly/4f0972b670c74be6104a008a4bb6345f.

          I commented-out the extra eventhandlers (and their functions) for cboPotions_SelectedIndexChanged and cboWeapons_SelectedIndexChanged. I also connected btnUseWeapon and btnUsePotion to their eventhandlers (btnUseWeapon_Click and btnUsePotion_Click).

          You can learn more about eventhandlers in Lesson 21.3

          Please tell me if that does not fix the problem, or if you have questions about it.

  4. Hey, Scott, I am trying to add a shop to my game where the player can buy stronger weapons and things like that, but I want to, in order to keep the UI organized, have the items the character can buy as a combobox and button, I think I’m having trouble assigning an Item called _buyItem variable in SuperAdventure.cs, because I can use the variable but it doesn’t function properly. I think the issue is on line 205 of SuperAdventure.cs. I’m using the combobox cboShopItems to assign it, once at the end of MoveTo() at line 205, and in cboShopItems_SelectedIndexChanged(object sender, EventArgs e) on line 496, but neither work. _buyItem is supposed to hold the item that is selected by the cboShopItems so that the buy button (btnBuyItem) will be updated with the cost, and when they hit the buy button, it will be added to their inventory. The cost always displays as 0, and the item is not added to the inventory. Here is my code on GitHub: https://github.com/JenniferE55/SuperAdventure/tree/NewLocationShop

    Can you help me?

    1. Hi Jennifer,

      In the constructor of the Item class, there is an “int” in front of the “Value = value;” line. The code thinks you want a new “Value” variable, and it assigns the parameter to that new variable, instead of the Value property. So, all the Item objects currently have a value of “0”. If you remove the “int”, the rest of your code should work.

Leave a Reply

Your email address will not be published. Required fields are marked *