Jun 23, 2011

EggyBank: My first XNA Game

This is a simple game which i made using XNA Game Studio. My very first game. The main objective of the game is to catch as many eggs as you can. Eggs will be falling from the sky and the player has to catch it. Simple!!! There are 6 levels and scoring differs with each level and with each egg.

Some screenshots:






Download link: http://www.mediafire.com/file/nw45jmn7p62a6nd/EggyBank.rar

How to install:
1) Before you install the game, check whether you have Windows Imaging Component and Windows Installer 3.1 installed. Windows 7, by default, has them installed. If your an XP user, you must check these or else the game will not be installed.
Links: Windows Imaging Component, Windows Installer 3.1 redistributable

2) After checking the above requirement, extract the EggyBank.rar and double click the file setup.exe. The setup will download the components required to run the game from the internet and will install them.

3) If the setup doesn't download and install the components, or if you get any installation errors, you must have Microsoft .NET Framework 4.0 redistributable and XNA Game Studio 4.0 redistributable installed on your machine. Download and install them.
Link: Microsoft .NET Framework 4 Client Profile (Standalone installer), Microsoft XNA framework Redistributable 4.0
After downloading and installing the above files, run setup.exe again and it will work for sure.

Have fun playing the game. :-)

Jun 5, 2011

Microsoft XNA Game Studio : A Learning Guide

This post details you not on how to develop a game using XNA Game Studio(GS) but on how to go about learning the game studio.


Firstly, XNA game studio is build on top of C#. That is, it uses syntaxes and semantics of C# Programming language. So I first suggest you to be strong on fundamentals of C# programming language. The fundamentals include knowing the following:
  • Data types and operators
  • Control statements
  • Classes and objects
  • Constructors, destructors, and methods
  • Interfaces, arrays, enumerations, and structures
  • Inheritance and virtual methods
  • Exception handling
  • Delegates, properties, events, and Lambda expressions
  • Attributes
  • Generics
  • Named and optional arguments
  • Implicitly typed variables
  • Using IO
  • Namespaces, Preprocessors and assemblies
  • Nullable Types
  • Collections, Enumerators and Iterators
    The latest version of .NET framework is 4.0. So I suggest you to read any C# book related to that version. C# 4.0 The Complete Reference by Herbert Schildt is the book i feel is good for beginners. Andrew Troelsen's Pro C# 2010 and the .NET 4 Platform is also a good book. The first book of Troelsen that i read was based on .NET 1.1. And he has written books on each .NET framework major releases. So reading his book is recommended.

    Having a strong base in C# basics is essential for quick learning of XNA GS. So the time spent in learning XNA can be reduced significantly if you know C# basics. So don't hesitate to learn it.

    For XNA GS 4.0, which is the latest, i suggest 2 books: 

    The first book is written by Tom Miller and Dean Johnson. They both are involved in developing XNA GS. So their book talks most of the features of XNA GS. But their books has minor errors. If you know the basics of C# then these errors are nothing. And there are very few grammatical mistakes. So if you can grab the logic they are explaining, its a very good book. And trust me, the logic they are explaining is easy to grab. They have written their book like that. And as stated, it is a Developer's Library. Many XNA books teach you the APIs (Application Programming Interface) by making Games. But this book doesn't. It teaches you only the APIs with short examples but not with a complete game. So it doesn't really need you to know the logic of any Game. This is an advantage as it can used as a reference material. Thought the title says programming for Xbox 360 and Windows Phone 7, it also includes making games for PC. So it really is a good book. The only problem i find with this book is, certain features are explained with respect to Xbox 360. And since i don't own an Xbox 360 console, i found it difficult to use it practically. Even thought those features can be used in PC, you should refer to an online material or another book for completely understanding those topics. You can use the second book in that case.

    The second book written by Aaron Reed is the most popular. If you read this book after reading Miller's book, it will be very easy. You can scan through most of the topics in this book, if you have read Miller's book first. This book explains XNA GS's features by making a complete game. This is both advantageous and disadvantageous. Advantageous because you can have a practical approach on how to make a real game. Disadvantageous because you got to follow the game logic throughout the entire book or else you will be lost. You got to remember the method names and logics that are game specific also. This book can be read if you want to also know how to approach in making a professional gaming.

    If you read both the books, i can assure you, you will be well learnt in XNA GS. For references, you can use MSDN that provides an online repository for various XNA APIs.