Building a C# adventure game can be a fun way to learn how to code. While constructing a text-based game, you can gain an understanding of fundamental programming concepts, and an introduction to object-oriented theory.
Learning to program is similar to learning a musical instrument, or a foreign language. Practice is important. At the end of each chapter you are encouraged to create additional smaller programs. These are opportunities to experiment and practice what you've learned. By the end of this series you'll have several console applications that show your understanding of programming and C#.
C# Adventure Game Overview
We will focus on programming basics that are, for the most part, similar across multiple languages with console applications. At first C# fundamentals will be our priority. Later, we will add some design elements to our interface.
This book is written for those new to C#, or to programming in general. Often the most straightforward way to code is not necessarily the most efficient or elegant. As we move through the material, we'll talk about ways to program more efficiently, and how to optimize earlier code.
While making the C# Adventure Game, you'll supply the content. Guided assignments along the way will make this adventure experience uniquely yours. Try to add elements you've never seen before; the more original the content, the better.
Styling Conventions
Special styles indicate tasks and expandable boxes.
- Tasks are marked to indicate when you need to take action (Example task).
Expandable Toggle Boxes
More information is inside of expandable boxes. Clicking the title reveals explanations, code examples, and other items that might be useful (but not essential for you to build the Adventure Game).
Expand these boxes to learn more. If you are feeling overwhelmed with new information, skip the box. You can always go back and read it later.
Try it out.
Click Me (Toggle Box)
Screenshots of an example adventure game:
Audience
If you've never worked with C# or are just learning to program, this book was written for you.
Read through the chapters - even if you don't understand all of what you are reading. Do the assignments. You might not fully "get" a concept until you've built a couple of applications. That's okay. Some of the ideas are complex and you just need time and practice to understand them.
Tips
- Read through all the chapters
- Do the practice assignments listed in the "To Do" sections
- Practice a few times a week
To Do Sections: Experiment & Practice
Learning programming requires practice. The more you program, the easier it will get. If you feel like a chapter is a challenge, don't give up. Keep practicing and moving through the assignments.
At the end of each chapter are activities for experimentation and practice. The more applications you make, the more your skills will improve. Practice what you've learned, then improve your adventure game project with the new knowledge.
Practice Multiple Days Each Week
If you practice programming a few days a week you will have better results.
Programming is a creative activity that also involves logic and problem-solving. Research suggests that taking a break between consciously and unconsciously thinking about a problem will yield better results1.
Focus and think critically about what you are learning and creating, then take a break and "sleep on it"2. When you return to the problem you will likely have a better understanding of it.
C# Language
C# (pronounced C-sharp) is a language Microsoft developed.
It is classified as an Object-Oriented Programming (OOP) language because object-oriented theory is inherent; code is organized as objects that have properties and behaviors. We’ll talk more about what that means and how we use objects as we work through this book.
Next Step
Your next step is to set up your development environment. C# Adventure Game screenshots show the Integrated Development Environment (IDE) Visual Studio Community 2015 and Visual Studio Enterprise 2017. Visual Studio Community is a free application that will help you write and debug your code.
If you already have Visual Studio (or an alternative development environment) set up, you can skip the first chapter, and move to C# Adventure 02: Output where we will walk through how to create a new project in Visual Studio, and write text to the screen (Console Window).
- Dijksterhuis, A. (2004). Think different: The merits of unconscious thought in preference development and decision making. Journal of Personality and Social Psychology, 87, 586-598.
- Weinschenk, S. 2016, May 19. Why "Stepping Away" Increases Your Creativity https://medium.com/@weinschenk/why-stepping-away-increases-your-creativity-bc958057b8dc