If you want to learn how to program games, you’ve come to the right place! In this book you’ll learn the basics of programming using the C# programming language. While we admit we love to program just about anything, developing games is one of the coolest things of all.
Most of the examples in this book are related to game development using MonoGame. MonoGame is an open source game development framework based on the Microsoft XNA 4 framework. It's even better than XNA was, though, because you can develop games for a great variety of platforms from mobile devices to consoles!
So you’ll learn how to program properly and you’ll learn how to build simple games using MonoGame. You’ll notice we said “learn how to program properly,” not “whack together games that seem to work.” This is a book that focuses on the correct way to write game software (and software in general), so there’s lots of discussion about our motivations for the particular design and coding decisions we make throughout the book.
The book assumes that you’ve never programmed before, so all the material starts at the most basic level. That means that anyone should be able to pick up the book and work their way through it without any prior knowledge. That’s the good news.
The bad news is that programming is hard work, especially at first. If you truly want to learn how to program, you’ll need to write programs yourself and struggle through some rough spots before some topics really click for you. Just as you can’t learn how to ride a bicycle by reading about it – you have to actually do it, probably with some spills along the way – you can’t learn to program just by reading about it. If you were hoping to read a book to learn how to program without doing any programming yourself, it’s not going to happen.
If you really just want to learn all the nuts and bolts of MonoGame, you should explore the MonoGame documentation instead of buying this book. If, however, you aspire to be a professional game programmer – whether as an indie game developer or in a large game company – then this book will give you a solid foundation for starting on that path.
Table of Contents
Chapter 1. Introduction
Chapter 2. Your First C# Program
Chapter 3. Data Types, Variables, and Constants
Chapter 4. Classes and Objects
Chapter 5. MonoGame Basics
Chapter 6. Strings
Chapter 7. Selection
Chapter 8. MonoGame Mice and Controllers
Chapter 9. Arrays and Collection Classes
Chapter 10. Iteration: For and Foreach Loop
Chapter 11. Iteration: While Loops
Chapter 12. Class Design and Implementation
Chapter 13. More Class Design and Methods
Chapter 14. MonoGame Text IO
Chapter 15. MonoGame Audio
Chapter 16. Inheritance and Polymorphism
Chapter 17. Exceptions, Equality, and Hash Codes
Chapter 18. File IO
Chapter 19. Delegates and Event Handling
Chapter 20. Putting It All Together
Appendix A: Setting Up Your Development Environment
Appendix B: The Content Pipeline