Skip to main content
  • Textbook
  • © 2019

Learning C# by Programming Games

  • Unique combined presentation of general programming techniques and computer game development, organized along the structure of games

  • Complemented by an additional website with numerous exercises, solutions, and ready-to-use game assets (like e.g. sprites and sounds)

  • Readers will see various fascinating games of growing complexity

  • All tools needed to program and replay the games are freely available

  • Authors ideally combine academic teaching experiences with industrial game development

Buy it now

Buying options

eBook USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book USD 54.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Other ways to access

This is a preview of subscription content, log in via an institution to check for access.

Table of contents (26 chapters)

  1. Front Matter

    Pages i-xxvi
  2. Getting Started

    1. Front Matter

      Pages 1-1
    2. Building Your First Game Application

      • Wouter van Toll, Arjan Egges, Jeroen D. Fokker
      Pages 3-8
    3. What Is Programming?

      • Wouter van Toll, Arjan Egges, Jeroen D. Fokker
      Pages 9-23
    4. Game Programming Basics

      • Wouter van Toll, Arjan Egges, Jeroen D. Fokker
      Pages 25-40
    5. Creating a Game World

      • Wouter van Toll, Arjan Egges, Jeroen D. Fokker
      Pages 41-63
  3. Game Objects and Interaction

    1. Front Matter

      Pages 65-68
    2. Showing What the Player Is Doing

      • Wouter van Toll, Arjan Egges, Jeroen D. Fokker
      Pages 69-89
    3. Reacting to Player Input

      • Wouter van Toll, Arjan Egges, Jeroen D. Fokker
      Pages 91-106
    4. Basic Game Objects

      • Wouter van Toll, Arjan Egges, Jeroen D. Fokker
      Pages 107-143
    5. Communication and Interaction Between Objects

      • Wouter van Toll, Arjan Egges, Jeroen D. Fokker
      Pages 145-172
    6. A Limited Number of Lives

      • Wouter van Toll, Arjan Egges, Jeroen D. Fokker
      Pages 173-187
    7. Organizing Game Objects

      • Wouter van Toll, Arjan Egges, Jeroen D. Fokker
      Pages 189-209
    8. Finishing the Game

      • Wouter van Toll, Arjan Egges, Jeroen D. Fokker
      Pages 211-222
  4. Structures and Patterns

    1. Front Matter

      Pages 223-226
    2. Dealing with Different Screen Sizes

      • Wouter van Toll, Arjan Egges, Jeroen D. Fokker
      Pages 227-239
    3. Arrays and Collections

      • Wouter van Toll, Arjan Egges, Jeroen D. Fokker
      Pages 241-261
    4. Game Objects in a Structure

      • Wouter van Toll, Arjan Egges, Jeroen D. Fokker
      Pages 263-284
    5. Gameplay Programming

      • Wouter van Toll, Arjan Egges, Jeroen D. Fokker
      Pages 285-308
    6. Finishing the Game

      • Wouter van Toll, Arjan Egges, Jeroen D. Fokker
      Pages 309-324

About this book

Developing computer games is a perfect way to learn how to program in modern programming languages. This book teaches how to program in C# through the creation of computer games – and without requiring any previous programming experience.


Contrary to most programming books, van Toll, Egges, and Fokker do not organize the presentation according to programming language constructs, but instead use the structure and elements of computer games as a framework. For instance, there are chapters on dealing with player input, game objects, game worlds, game states, levels, animation, physics, and intelligence. The reader will be guided through the development of four games showing the various aspects of game development. Starting with a simple shooting game, the authors move on to puzzle games consisting of multiple levels, and conclude the book by developing a full-fledged platform game with animation, game physics, and intelligent enemies. They show a number of commonly used techniques in games, such as drawing layers of sprites, rotating, scaling and animating sprites, dealing with physics, handling interaction between game objects, and creating pleasing visual effects. At the same time, they provide a thorough introduction to C# and object-oriented programming, introducing step by step important programming concepts such as loops, methods, classes, collections, and exception handling.


This second edition includes a few notable updates. First of all, the book and all example programs are now based on the library MonoGame 3.6, instead of the obsolete XNA Game Studio. Second, instead of explaining how the example programs work, the text now invites readers to write these programs themselves, with clearly marked reference points throughout the text. Third, the book now makes a clearer distinction between general (C#) programming concepts and concepts that are specific to game development. Fourth, the most important programming concepts are now summarized in convenient “Quick Reference” boxes, which replace the syntax diagrams of the first edition. Finally, the updated exercises are now grouped per chapter and can be found at the end of each chapter, allowing readers to test their knowledge more directly.


The book is also designed to be used as a basis for a game-oriented programming course. Supplementary materials for organizing such a course are available on an accompanying web site, which also includes all example programs, game sprites, sounds, and the solutions to all exercises.

Authors and Affiliations

  • Rennes, France

    Wouter van Toll

  • Utrecht, The Netherlands

    Arjan Egges

  • Department of Information and Computing Sciences, Utrecht University, Utrecht, The Netherlands

    Jeroen D. Fokker

About the authors

Wouter van Toll is a post-doctoral researcher at Inria in Rennes, France, as well as a fanatic developer of games and apps. His research focuses on simulating the behavior of human crowds. Previously, he was a lecturer at the Department of Information and Computing Sciences at Utrecht University in the Netherlands. He has taught several bachelor and master courses there, including the introductory Game programming course designed by co-author Arjan Egges.


Arjan Egges has more than 15 years of teaching experience at the Department of Information and Computing Sciences at Utrecht University in the Netherlands as well as at the University of Geneva in Switzerland. He taught programming courses on both bachelor and master levels, as well as courses related to games and computer animation. He wrote several books about game programming, in C#, JavaScript, and Swift. Arjan is currently involved in the startup Fans4Music, which aims to provide a platform that connects musicians with their audience. He also recently launched Pensyve, a web-based platform that offers assignments in various programming languages as well as tools that help teachers create handouts for their students and grade programming assignments.


Jeroen Fokker is an assistant professor in the Software Technology group at Utrecht University. As the director of education, he is responsible for the undergraduate programs in Computer Science and Information Science. He has been teaching introductory programming courses for over 20 years, using C++, Haskell, Java, and C#, as well as courses on compiler construction.

Bibliographic Information

Buy it now

Buying options

eBook USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book USD 54.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Other ways to access