This is a new WPF/XAML game, based on the game from my Windows Form tutorial: Learn C# by Building a Simple RPG
Lesson 01.1: Installing Visual Studio Community 2015 – Update 3
Lesson 01.2: Installing TortoiseSVN and VisualSVN
Lesson 02.1: Planning the Game
Lesson 03.1: Creating the Solution and Game Screen
Lesson 03.2: Creating and Using a Subversion Repository
Lesson 03.3: Creating the Player Class
Lesson 03.4: Creating the GameSession (ViewModel) Class
Lesson 03.5: Displaying the Player Object
Lesson 03.6: Update Player data with the PropertyChanged event
Lesson 04.1: Creating the Location class
Lesson 04.2: Creating the World
Lesson 04.3: Moving in the game world
Lesson 04.4: Improving the World – Inheritance and INotifyPropertyChanged
Lesson 04.5: Improving the World – Factory and Guard Clauses
Lesson 05.1: Creating the Game Item Factory
Lesson 05.2: Creating the Player Inventory
Lesson 06.1: Creating the Quest Factory
Lesson 06.2: Using Quests in the Game
Lesson 07.1: Creating Monsters
Lesson 07.2: Adding Monsters to Locations
Lesson 07.3: Sending Messages from the ViewModel to the View
Lesson 07.5: Monster and Combat Refactoring
Lesson 08.1: Completing Quests
Lesson 09.2: Adding the Trade Screen
Cleanup/refactoring, before adding more features
Lesson 10.1: Refactoring Base Class for Player, Monster, and Trader
Lesson 10.2: Grouping GameItems in Inventories
Lesson 10.3: Refactoring – Encapsulating LivingEntity Properties (Hit Points and Gold)
Lesson 10.4: Bug Fix – Removing multiple items from GroupedInventory
Lesson 10.5: Encapsulating Level and ExperiencePoints Properties
Lesson 10.6: Clean up property setters and PropertyChanged notifications
Create a base for automated tests
Lesson 11.1: Creating the Unit Test Project
New game features
Lesson 12.1: Making the GameItem class more flexible
Lesson 12.2: Creating the AttackWithWeapon command
Lesson 12.3: Making the Action class more flexible with an interface
Lesson 12.4: Letting the Monster use AttackWithWeapon
Lesson 12.5: Creating the first consumable GameItem
Lesson 12.6: Refactoring after adding Actions
Lesson 12.8: Crafting items with recipes
Lesson 13.1: Add keyboard input for actions, using delegates
Lesson 13.2: More keyboard actions (and fixes)
Load game world objects from XML files
Lesson 14.1: Moving game data to external files
Lesson 14.2: Creating extension methods
Lesson 14.3: Read World (Location) data from an XML file
Lesson 14.4: Read Monster data from an XML file
Lesson 14.5: Move Remaining Game Data to XML Files
Lesson 15.1: Bug Fixes, Unit Tests, and Tooltips
Lesson 15.2: Catch and log exceptions
Lesson 15.3: Building a “functional” inventory class
Lesson 15.4: Using GitHub to upload and download a solution
Lesson 16.1: Adding centralized messaging
Lesson 16.2: Creating the Battle class
Lesson 16.3: Complex attack initiative and hit success logic
Lesson 17.1: Saving and loading game state
Lesson 17.2: Reducing serialized data in save game file
Lesson 17.3: Add a menu to save and load the game state
Lesson 17.4: Automated test for saved game reader
Lesson 99.1: Fix event subscriptions
Lesson 99.2: Replace random number library
Customizable Player attributes
Lesson 18.1: Making Configurable GameDetails
Lesson 18.2: New starting windows and configurable player races
Lesson 18.3: Player creation screen
Lesson 18.4: Adding Player Attributes to Living Entities
Lesson 18.5: Update game loading and saving
Upgrade and improvementsLesson 19.1: Converting SOSCSRPG to .NET 5
Lesson 19.2: Identifying refactoring targets
Lesson 19.3: Move data and image files out of Engine project
Lesson 19.4: Replace BaseNotificationClass with Fody PropertyChanged Notification
Lesson 19.5: Convert properties to auto-properties
Lesson 19.6: Move files out of Engine project
Lesson 19.7: Decouple services from ItemQuantity
Lesson 19.8: Create SOSCSRPG.Core project for native language extensions
Lesson 19.9: Decouple services from Location and Monster model classes
Lesson 19.10: Create a GameState model for SaveGameService
Lesson 19.11: Move common functions to SOSCSRPG.Core
Lesson 19.12: Decouple InventoryService from LivingEntity
Lesson 19.13: Remove CombatService dependency from model classes
Lesson 19.14: Moving the Engine classes to their new projects
Lesson 20.1: Create floating inventory canvas
Lesson 20.2: Create floating quest and recipe canvases
Lesson 20.3: Create floating player details canvas
Having pasted your entire file, I receive the following error in VS2019 and the window design does not appear:
Severity Code Description Project File Line Suppression State
Error Could not find file ‘C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ImageName’. WPFUI MainWindow.xaml 2
I believe that is not a “real” error. Can you run the program, and does it look like it works?
If the program runs correctly, that error is probably coming from Visual Studio trying to interpret the XAML page, which expects an instantiated Location object, with an ImageName value that points to a location (or monster) file. When you’re editing or compiling the program, and don’t have instantiated objects to bind to, Visual Studio shows that “error”.
Please let me know if that is not the problem, or if my response is not clear.
Thanks for your response. The program runs ok.
Hello, thank you for this huge project. It is a wonderfully helpfull tutorial. I am learning a lot of things and appreciate all the effort and tim eyou invest into this project.
Hopefully you will find experienced assistance to keep this project alive.
Something i noticed about the new website. The code area could be somewaht wider. To read most of the code lines, you have to scroll alot sideways. I know there is videos in the first place, but maybe it is not that much needed to widen the text area so more of the code gets visible at once.
Good luck with the project, i hope to see more videos in the future.
Is there a .Net6 conversion in planning ?
I changed the page layout to be wider. In lesson 191., we convert the solution to .NET 5. I haven’t tried it, but you can probably convert it to .NET 6. I tried to avoid code that only works in specific versions.
Thanks alot, it is much better to read now.
Understandable, I have converted my project to .NET6 and it works so far.
Will this project receive any further lessons in the future? If so, what are you currently working on?
Again, thanks for this great tutorial.
I want to add more lessons in the future.
Right now, I am working on creating a paid course for C# and SQL Server. I’d like to build a business teaching programming. Once I release this course, I’ll have a little time to add some more things to SOSCSRPG, but I don’t know exactly what new changes to make. If you have any ideas what you’d like to see next for the game, please let me know.
#Quote: “Right now, I am working on creating a paid course for C# and SQL Server. I’d like to build a business teaching programming. Once I release this course, I’ll have a little time to add some more things to SOSCSRPG…”
Ok, nice. Looking forward to that course. =)
Hmm, maybe some of the things already included as future release plans?
Armor System? Jewelry System? Echantment System? Buff/Debuff System?
RPG Style Equipment window, drag and drop Items to slots, prevent items not fitting a slot to be equipped etc.?
I released the SQL course at: https://codingwithscott.teachable.com/courses
The separate program to manage the game data files might be a good thing to work on next. Although, I’m not sure if it would be better to make the changes to the class files first – since those changes would need to be handled in the game file editing program.
cool, bought the course. SQL is something that interests me. Haven’t yet spend to much time with it though. So this will come in handy. =)
Hm, i guess handling the prerequisites first instead of jumping back and forth would be best in my opinion.
Thanks for getting the course! It does need a little C# knowledge. But, if you understand classes, properties, functions, collections/lists, and static classes, you should be able to follow all the lessons.
If you have any suggestions about ways to improve the lessons, please let me know.
Addition to the above mentioned inventory system…
That would of course mean to have an icon based inventory of course.
Your tutorial is a highly valuable resource for C# programmers. I’ve learned a lot. Thanks!
You’re welcome! That’s great to hear.
Happy Fall Scott. I have been following your site and projects over the years. I was wondering if you were ever considering a console version of the second RPG game. Some of us are still on Mac though Visual Studio is getting better on Mac. We could do the console if needed
Thanks Stanley! I’ve tried to think of what to do next with SOSCSRPG, but haven’t come up with anything yet. Well, I’ve come up with a lot of ideas, but haven’t been able to get focused on one yet.
I do like the idea of a console version. I’ve been writing more of my personal programs as console apps, and that would also allow for writing some natural language processing code.
I just started a new project for a client, so I know I won’t start anything with SOSCSRPG for at least a few weeks. If I get started on updates for the game, I’ll post here and at the YouTube channel https://www.youtube.com/c/SOSCSRPG
Is this still being updated or have you moved on?
I’m learning so much and I’m grateful, I’d like to also see combat against multiple enemies at once and player companions to help in combat. Buffs/debuffs, special abilities, npc’s to talk to.
Thank you for all the work you put into this 🙂
You’re welcome Wicked Cat!
You are correct. I’m not doing any further enhancements or updates for the game (although I still answer questions about the lessons). I’ve been trying to figure out my next project to work on, but haven’t decided what it should be yet. I’m glad to hear you’ve learned from these lessons and hope you can continue having fun with programming. 🙂
aw, well I’m sorry to hear it’s not getting updated, I love RPG’s. But thanks for the reply, are there any tutorials you would recommend after someone has finished yours?
and thanks again for this, it must have been a ton of work and releasing it for free is amazing <3
If you’re looking for more general C# tutorials, check out https://www.youtube.com/@IAmTimCorey. If you want to keep programming C# games, check out https://dotnet.microsoft.com/en-us/learn/games, https://www.monogame.net/, and https://godotengine.org/. Those are the most popular C# game engines I know of.