Jarred Capellman and Louis Salin

MonoGame Mastery

Build a Multi-Platform 2D Game and Reusable Game Engine

1st ed.
Jarred Capellman
Cedar Park, TX, USA
Louis Salin
Cedar Park, TX, USA
ISBN 978-1-4842-6308-2e-ISBN 978-1-4842-6309-9
© Jarred Capellman, Louis Salin 2020
Standard Apress
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, express or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Distributed to the book trade worldwide by Springer Science+Business Media New York, 1 New York Plaza, Suite 4600, New York, NY 10004-1562, USA. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.

To my wife, Amy, for always supporting me through thick and thin.

—Jarred Capellman

To my kids, in the hope that they pursue their dreams.

—Louis Salin

Introduction

Building video games has an undeniable appeal in the imagination of many people coming from various backgrounds. Many children want to be game designers when they grow up and many programmers have learned the art of writing code thinking that they would, one day, create their own game.

Creating a video game is both an expressive art form and a series of logical challenges that must be solved. A game programmer needs to be creative while materializing the content of their imagination on a computer monitor, and at the same time, they must constantly solve the many physical constraints placed upon them as they shape their game. For those of us that enjoy solving problems and have a penchant for art, this is a dream field, whether as a hobby or, professionally, as a full-time job.

There has never been a better time for regular people than today to write video games! While hobbyists around the world have built games since the 1970s, the amount of deep technical knowledge required has diminished and the barrier of entry has dropped much lower in the last few years. Game tooling and game engines now abstract away the complexities of getting something drawn on a screen, while computers have gotten so powerful that programmers do not have to be so precise anymore in the way they handle memory management and the game performance. Furthermore, getting a video game published on gaming consoles and computers has become much more accessible today to anyone with the perseverance to bring their game to completion, as can be seen with the sheer number of indie games found on the market.

Software developers today have a wide array of technologies to choose from when building their game. One of these choices is MonoGame, a framework for creating powerful cross-platform games.

In this book, we aim to take experienced C# programmers through a journey as we explain game development basics and build a small two-dimensional vertical shooter video game from scratch, using MonoGame as our framework. By the end of this book, our readers will not only have built a reusable game engine that they will be able to use in their future games, but they will also have gained valuable knowledge to give them a leg up in their future projects, whatever framework or engine they decide to use.

Acknowledgments
There were two big drivers for bringing me to focus my career on programming. The first being my father who handed me a QBasic book when I was 9 years old. He supported my passion for programming throughout my childhood, buying books and updated versions of Visual Basic and Visual C++ every release. The other was John Carmack. When I first played Wolfenstein 3D in 1992, I was mesmerized at how immersive the game was. A few years later seeing John Carmack on the cover of the Wired magazine, reading how he and John Romero had created and transformed the first-person-shooter genre, I knew I wanted to achieve that level of impact in my career.

—Jarred Capellman

Many events in my life brought me to this point, where I get to thank the people who have helped me and believed in me. My father bought me my first computer and enrolled me in a Basic class in sixth grade, where I learned how to draw lines and circles on the screen.

Years later, Richard Egli, my computer graphics professor in college, brought me to my first SIGGRAPH conference where I learned how deep the rabbit hole goes. Thank you for believing in me.

Finally, I’d like to thank Jarred, my coauthor, for giving me a chance to help him write this very book.

—Louis Salin

Table of Contents
Index 317
About the Authors
Jarred Capellman
../images/485839_1_En_BookFrontmatter_Figb_HTML.jpg

has been professionally developing software for over 14 years and is Director of Engineering at SparkCognition in Austin, Texas. He started making QBasic text–based games when he was 9 years old. He learned C++ a few years later before studying OpenGL with the eventual goal of entering the gaming industry. Though his goal of professionally developing games didn’t come to fruition, he continued deep diving into frameworks such as MonoGame, Vulkan, and DirectX as an important part of his free time. When not programming, he enjoys writing music and is working on his DSc in Cybersecurity, focusing on applying machine learning to security threats.

 
Louis Salin
../images/485839_1_En_BookFrontmatter_Figc_HTML.jpg

has been a developer for more than 15 years in a wide variety of fields, developing on Windows in the early days in C, C++, and eventually C# before working as a developer on Linux-based web applications using different scripting languages, such as Ruby and Python. His early love for coding comes from all the time he spent as a kid copying video games written in Basic from books borrowed from the library. He wrote his first game in high school and took many classes in computer graphics.

 
About the Technical Reviewer
Simon Jackson
../images/485839_1_En_BookFrontmatter_Figd_HTML.jpg
is a long-time software engineer and architect with many years of Unity game development experience, as well as an author of several Unity game development titles. He loves to both create Unity projects and lend a hand to help educate others, whether it’s via a blog, vlog, user group, or major speaking event.

His primary focus at the moment is with the XRTK (Mixed Reality Toolkit) project; this is aimed at building a cross-platform Mixed Reality framework to enable both VR and AR developers to build efficient solutions in Unity and then build/distribute them to as many platforms as possible.

 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.190.219.65