Preface

Foreword

Witty prose with glowing praise from a Xamarin team member, a MonoGame founder, or Andrew goes here.

{pagebreak}

Acknowledgements

Thanks to all the little people go here.

{pagebreak}

Special Thanks

This work relies heavily on resources and in-game assets provided by the following folks.

  • Kenney Vleugels (@KenneyWings)
    http://kenney.nl/
    Awesome assets. Most of the art in the examples for this volume came from Kenney. I discovered Kenney while browsing for art on OGA - http://opengameart.org/users/kenney. That’s another great resource for assets, but Kenney’s my favorite contributor by far.
  • Sergiu Muresan (@muresan_sergiu)
    http://sergiumuresan.com/
    Mr. music, himself. I met him through a friend when he was working on Creatures and Castles for iOS. Don’t let his modesty fool you, he’s a great resource for music.
  • Andrew Rollings (@hiive)
    http://www.hiive.com/
    An accomplished programmer and author, Andrew is the one who commissioned the works from Sergiu for his own games. Andrew graciously allowed me to use those assets in some of the examples in this book.
  • Daniel Cook (@danctheduck)
    http://www.lostgarden.com/
    Another great resource for game design, illustration, and (of course) free assets. I used some of Danc’s art in my first book. I plan to do the same in this series.
  • Joseph Hall (@groundh0g)
    http://www.moreoncode.com/
    That’s me! If there’s art or other assets in the examples that you don’t particularly care for, they were likely created by yours truly. I enjoy drawing, but I haven’t put in the hours required to master it.

{pagebreak}

About the Author

{width=45%,float=right} Me and my reasons for being.

Joseph Hall has been a professional software developer for nearly 25 years. He worked as a programmer for Microsoft and IBM, and he was the software architect for a Fortune 500 bank before starting his own consulting company in 2006. Joe makes his living writing desktop, web, and mobile device applications for businesses and governmental agencies, but game programming is his passion, and it was gaming that got him into programming in the first place.

Joe was a member of the original Xbox team and he joined the Visual Studio .NET team just after the Xbox was released in 2001. He is the author of XNA Game Studio Express: Developing Games for Windows and the Xbox 360, which was published in 2007. In this new series of books Joe applies his unique blend of development experiences to help you explore the exciting arena of cross-platform game development using Xamarin Studio and MonoGame.

Joe lives with his wife of more than twenty years and his three daughters in Montgomery, Alabama. Every summer, Joe teaches high school students how to write games during an intense weeklong course in North Carolina for Landry Academy. He occasionally does the same for local kids in his hometown.

In his free time, Joe dabbles in sketching, cartooning, and creating 3D models. When you see his artistic creations, you’ll understand why he makes his living as a programmer.

{pagebreak}

About the Series

After my first book was published, people often asked if I would ever write another. My somewhat-joking response was, “My wife says I won’t.” It takes a special kind of numbskull to take on such a huge undertaking that promises so few rewards. I spent a year of my life, locked in my home office or sitting at Starbucks, working on those 760+ pages. All the while, I was working more than 40 hours a week at my “day job” (consulting). That’s a lot of missed cheer camps, soccer games, basketball games, and general veg time with the wife and kids.

Still, it’s an experience that I wouldn’t trade. Writing scratches a creative itch for me. There’s something fulfilling about completing such a large project. Especially when it is so well received by the readers. Thanks, guys!

The first time around, I learned a lot about what it takes to make a good game-programming book. I put that knowledge to use while creating these titles. I appreciate all the feedback I received. This work has benefited from it greatly.

In this series, I follow the same general principles that drove the first book. I write the books that help the beginner without boring the more-experienced readers to tears. I write the books that contain examples that go beyond rainbow triangles and 3D cubes with crate textures. In short, I write the books that I, as a hobbyist game developer, would want to read. If you enjoy the book as well (and I sincerely hope you do), I consider that an added bonus.

There was so much content to cover in this new work that I decided to break it into five separate volumes (plus a sixth volume for my annual summer camp on game programming). Each book stands on its own. As much as possible, later volumes don’t assume that you own the previous volumes. If, for example, you want to dive into 3D and you have a few XNA or MonoGame game projects under your belt, then, by all means, jump straight to Volume 3: 3D Genre Studies.

Volume 1: Building Blocks

This book provides a solid foundation upon which to build your own games using MonoGame by exploring the background of the underlying technologies, providing an overview of those technologies, and reinforcing what you learn with working examples. Whether you’re a C# programmer who has never written a game before or you’re an XNA veteran, this volume will help you build great games for a variety of devices.

Best of all, it doesn’t matter if you’re developing on a Mac (using Xamarin Studio) or a PC (using Xamarin Studio or Visual Studio). You will find examples (including three fully-functional games) that will get you up and running quickly.

Volume 2: 2D Genre Studies

This book builds on what you learned in Volume 1 (or from Google, if you decided to skip the first book) to write seven actual games - from scribbles on a napkin, to packaged games that are ready to push to a variety of app stores.

Volume 3: 3D Genre Studies

Volume 3 injects Volume 2 with steroids, and then microwaves it on full power for 42 seconds. From concept to creation, you’ll learn the tools and techniques for taking your games into the 3rd dimension.

In this book, after a fairly detailed introduction to 3D programming concepts, you are taken through the process of building six fully functional games. If you happened to work through Volume 2, you’ll find that a few of these games may seem familiar. Several of the chapters focus on creating 3D versions of 2D games. This is a great illustration of the separation of the game world from the view (the data from the rendered view of the data).

Volume 4: Multiplayer Games

This book gives you the tools and knowhow to make your games more social. This volume explores several facets of multiplayer game modes. From simple AI, to single-device multiplayer support, to LAN-connected games, to internet-connected games, you will learn how to take your creations to the next level. Along the way, we will discuss spit-and-polish concepts like chat, leaderboards, and 3rd-party matchmaking (e.g. Twitter and Facebook authentication).

Volume 5: Tasty Bits

This book explores more advanced concepts like threading, performance tuning, and localization. This is my vanity volume. It’s a collection of topics that interest me greatly. I hope they interest you as well, but if there’s any one book in the series that was written with me as the intended audience, this is it. In addition to the typical technical yadda yadda, this volume includes a couple of chapters on version control and team collaboration.

Volume 6: Code Camps

This book is a stopgap measure to get content into the hands of my students as quickly as possible. I’ve been teaching game programming to teens and tweens since 2011. Each year, we’ve used XNA as our platform, and my 2007 book on XNA as the reference. As of 2014, XNA support was officially dropped. This book is a collection of the games my students have created, with some tweaks and polish, modified to target MonoGame.

While Volume 6 is the first out of the gate, I plan to use my copious free time to work on the remainder of this multi-volume set of books that teach game programming in greater detail, with greater depth.

{pagebreak}

About the Reader

I would love to say that you should buy this book if you have a pulse and you’re able to read and comprehend written text. I would love to say that you can pick up a book and a compiler and start writing games after just a weekend of reading. I can’t say that, though. I’ve made every attempt to make sure that someone who is new to game programming can easily follow the progression of ideas and concepts from introduction to implementation, while still keeping the interest of those programmers who have dabbled in game development or have written complete games, but this book will not teach you how to program.

If you have had any experience with writing programs (on any platform, in any language) you should be able to follow the examples in this book without any problems. If you don’t know what loops, variables, methods, and arrays are, then it’s time to pick up a good introduction to the C# language to which you can refer as you read this book. Games are frequently trivialized since they lie squarely within the realm of recreation and entertainment, but game programming is actually one of the most cerebral forms of programming that you’ll ever do.

I hope that I haven’t scared you off. If you have a passion for games, and you have a vision that you would like to see come to life, then I firmly believe that you can make it happen, and I believe that this book will help you. I just don’t want you to think that you’ll be developing the next Gears of War or Gran Turismo in a weekend, especially if you’ve never written a line of code in your life. Read the book. Answer the review questions. Work through the exercises. Modify the example code. By testing your assumptions, you’ll be able to know when you’ve mastered the material. Then you can combine those core concepts in different ways to create great games.

{pagebreak}

Contact Me

If you have any questions, notice any errors, have general feedback, or have suggestions for topics that you would like me to cover in future editions of this book, a new book, or in an article on my website, please email me at [email protected] I’ll try my best to reply to every email that I receive.

I’m fairly active on Twitter (@groundh0g), and Facebook (http://fb.com/groundh0g). My main website is http://www.moreoncode.com/. That’s where my blog lives. I plan to post articles, provide downloadable content, and host a forum for questions about the books.