Learn C# by Building a Simple RPG – Index

Giant Spider!

Mandatory Giant Spider!

If you want to write a Role Playing Game, but don’t know how to program, or just want to learn how to program in C#, then you’re at right the place.

These  lessons will take you from a complete beginner, to being an author of a Role Playing Game, for free.

Now, this isn’t the world’s greatest game. In fact, it’s very short and kind of ugly.

However, as you create it, you’ll learn the most common C# programming practices and techniques. Then, if you want, you can improve the game, adding more features and your own special touch to it.



Lesson 00.1 – What is in these lessons?

Lesson 00.2 – General information about programming in C#

Lesson 00.3 – The parts of Visual Studio

Lesson 01.1 – Defining classes and objects for the game

Lesson 02.1 – Installing Visual Studio Express 2013 for Desktop

Lesson 02.2 – Building the solution for the game

Lesson 03.1 – Building the first screen

Lesson 04.1 – Creating the Player class and its properties

Lesson 05.1 – Creating objects from classes

Lesson 06.1 – Creating the remaining classes

Lesson 07.1 – Inheritance and base classes

Lesson 08.1 – Setting properties with a class constructor

Lesson 08.2 – Using class constructors with derived classes

Lesson 09.1 – Using your classes as datatypes

Lesson 10.1 – Creating collections of objects

Lesson 11.1 – Using a static class

Lesson 12.1 – Add the remaining UI controls

Lesson 13.1 – Functions, procedures, and methods

Lesson 13.2 – Creating functions to handle user input

Lesson 14.1 – Variables

Lesson 14.2 – If statements

Lesson 14.3 – Foreach loops

Lesson 15.1 – Getting random numbers for the game

Lesson 16.1 – Writing the function to move the player

Lesson 16.2 – Refactoring the player movement function

Lesson 16.3 – Functions to use weapons and potions

Lesson 17.1 – Running the game on another computer

Lesson 18.1 – Future enhancements for the game

Bonus lessons (enhancements to the game)

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

Lesson 19.2 – Use a calculated value for a property


Finished the final lesson? Let your friends know!

{ 17 comments… read them below or add one }

kobrad November 27, 2013 at 8:48 pm

This seems like a really good tutorial – thank you for your work


Scott Lilly Scott Lilly December 2, 2013 at 7:12 pm

Thanks. I’ve been working on the next sections. They’ll be up soon.


Jase June 5, 2014 at 12:03 am

I like this tutorial a lot. It’s exactly what I was looking for. I’ve already finished through 13.1. I can’t wait for your future lessons as I’m trying to learn C#, while also building a simple text based game (although it doesn’t feel that simple yet). I think you’re doing a great job and I’ll keep checking back for the rest of your lessons. I bookmarked this website. Cheers.


Scott Lilly Scott Lilly June 5, 2014 at 12:47 pm

Thank you.

I just published Lesson 13.2 – Creating functions to handle user input. I’m working on Lesson 14, and it’s a big one. It covers the almost all of the game logic – moving around, completing quests, fighting monsters, etc. So, it will probably be split into 3 or 4 smaller lessons.


Jase June 6, 2014 at 2:18 pm

Sounds great. I’ll keep looking for it. :) Thank you again for your work.


Scott Lilly Scott Lilly June 16, 2014 at 4:29 pm

In case you haven’t seen, there are several new lessons available.

Lessons 14.1, 14.2, and 14.3 cover variables, “if” statements, and “foreach” loops.
Lesson 15.1 adds a class to let you create random numbers.
Lessons 16.1, 16.2, and 16.3 add code to move the player around, let them get quests, fight monsters, and complete quests. These lessons are a bit long, since they cover a lot of code.

At the end of lesson 16.3, you’ll be able to play the complete game, running it from within Visual Studio. The next lesson will be on how to run the game on other computers, without Visual Studio installed.


Jase June 22, 2014 at 2:52 pm

Yes, thank you!! I’ll get to work on it here early next week. Today is too busy. :(


Luke August 15, 2014 at 4:34 pm

I just finished this series, and I have learned so much! This series was amazing, and it was very well done. Thank you so much for making this series! It really gave me a huge boost in the right direction.


Scott Lilly Scott Lilly August 15, 2014 at 4:52 pm

Thanks for letting me know it helped you.

If you want to see how the game would look with some more advanced techniques (such as, LINQ and raising events to communicate from the Engine project to the UI), I’m currently working on it here: https://github.com/ScottLilly/ShinyRockHunter. I don’t have any lessons for LINQ or event-handling (at least, not yet). But I may write some when the app is closer to being completed, if people are interested.


Zerocchi August 26, 2014 at 6:04 am

I was looking for a website that teach C# by doing project. Seems like I come to the right place!

Thanks for all your effort. Bookmarked this website and going to start learning now :)


Scott Lilly Scott Lilly August 26, 2014 at 7:04 am

You’re welcome. Please let me know if you have any questions.


TheCaptain August 26, 2014 at 9:40 pm

This tutorial was great, thank you very much for the write up!


Scott Lilly Scott Lilly August 27, 2014 at 7:25 am

You’re welcome. I’m glad it helped you.


Rusty August 27, 2014 at 5:32 pm

Really helpful and fun way to explore C#


Rusty August 27, 2014 at 5:33 pm

I see you offered to answer questions to another poster, I would love to ask a couple myself, if you are willing to answer them or explain some more about the language and class system.


Scott Lilly Scott Lilly August 27, 2014 at 10:16 pm

Certainly. I’m working on a few projects right now. So, if they’re difficult questions, it make take me a few days to write up an answer for them. But feel free to ask.


Scott Lilly Scott Lilly August 27, 2014 at 10:15 pm



Leave a Comment