Category Archives: Game Programming

Beginning HTML 5 Game Development With Quintus

I am super excited about my latest Pluralsight course:

Beginning HTML 5 Game Development With Quintus

I have been a vocal skeptic of JavaScript, it is no secret.  But lately I’ve been becoming more and more convinced that even if there are some aspects of the language that I don’t like, it is an extremely powerful language that, if used right, can allow for a flexibility that can simplify many problem domains.

It is really amazing how easily you can use HTML5 and JavaScript to create a real game that runs in a browser on many different devices.

2013 10 28 13 37 25 Beginning HTML 5 Game Development With Quintus

Here is the official course description:

Game development is awesome! And it is actually much easier than you think, especially now that you can develop games completely using web technologies you probably are already familiar with.

Modern browsers today that have support for HTML5 and fast JavaScript engines are more than capable of running complex games that would have been impossible years earlier.

In this course, I’ll show you how to create a complete game using only HTML5 and JavaScript. We’ll start off by learning the basics of game development and the basics of how HTML5 and modern browser technologies support it.

Then, we’ll dive right in and start implementing the basics of a game. We’ll start off by actually creating the start of a game completely from scratch, implementing everything ourselves.

Once we’ve seen the basics of doing things from scratch, we’ll introduce a JavaScript game engine to help us out as we learn about Quintus and start building our first real complete game.

From there on we’ll expand our game little by little as we add features like moving a player around and firing shots in the game. We’ll also learn how to create enemies in the game and give them some intelligence.

So, if you are interested in game development or if you just want to see what is possible with HTML5, check out this course. You’ll be surprised how easily you can put together a real HTML5 game.

Building a Game (Guest Post)

This week I am doing something a bit different.  I asked the winner of the XNA contest that I held to promote my Pluralsight course on game programming with XNA to write up a guest post about his experience making the game.

joshuaburchatipad thumb Building a Game (Guest Post)Joshua Burchat was the first place winner of an iPad, and he graciously agreed to do a write up of his experience.

So congratulations again and thanks you Joshua.

Here is Joshua’s post:

After winning the XNA contest John asked me to write a guest post about my experiences with the course and developing the game. So here it goes.

My name is Joshua Burchat and I’m from Oakville Ontario. I work as a developer designing and supporting business applications to support reporting within warehouse operations. My language of choice is C# but I enjoy trying other languages and technologies.

What appears to be a daunting task

When I saw John’s post I was instantly excited about the course. The only experience I have making games was doing a small Cocoa2d chess game app. I had yet to do anything with animations and moving sprites. Writing code for a game seemed like a daunting task. I decided that I needed a new project to work on, and this would be a challenging and worthwhile task.

After starting the course, building a game seemed so much more simplistic from a coding perspective than I originally thought. John has a great layout to the course. Upon completion, you end up with a fully functioning basic space shooter game.

Doing something a little different

When doing any sort of tutorial I tend to want to write a different application than the example being presented. I do this to enjoy writing the application because it’s one of my choosing, and to run into different scenarios which need to be solved. I use a similar practice when learning a new language; except I usually pick a program I have already written and port it.

Wanting to do something different, I decided to go with a side scrolling platformer. The plan was to make it like Mario but with punches, a health bar and an energy bar. The course got me started with how to display graphics and create boundaries for game entities in a very simple and reusable way. The course also teaches you how to implement sounds and game states (pause, next level etc.). There were quite a few things that you need to tweak to make a more advanced game. However the structure you are given from the course is very extensible.

One of the things that I needed to add to the game that was not in the course is the concept of gravity. The player, as well as some of the enemies needed to be able to jump and fall. Entities needed to be able to transition to different animations as well as be prevented from doing certain actions while the animation has yet to finish. I ended up using a similar method that John used for the game states; I made sprite states. When a sprite had a specific state it would determine what the sprite is currently doing and what it could do next.

The current state would have an update method that the sprite would call from its update method in the game loop. The state was responsible for setting the animation for the sprite and whether or not the state should change. For example, when the up arrow was pressed the standing and walking action would lead to the jumping action for the player sprite. Enemy sprites had actions that they used to make them attack and move around.

Here is an example of the player sprites states:

clip image001 thumb Building a Game (Guest Post)

Once implementing the ability for sprites to change state, I needed to make use of them. I had five types of sprites in the game:

Player: Controlled by user input. The player sprite has an energy level that is used to preform jumps and punches. The energy recharges over time. This sprite also has health, the player has to restart the level when the health hits zero or if it falls off a ledge.

Enemy: Controlled by its surrounding. If they hit the edge of a platform, turn around. If it hits the player, change the player state to ‘stunned’ and takes some of the players health away.

Terrain: Represents the bounds for that prevent the player and enemies to go past.

Background: Elements that do not have any effect on the other sprite types, and are simply for visual effects. Some background effects move, such as clouds or snow.

Item: Created from an enemy sprite when it is killed. Adjusts the players stats such as health or energy.

Here is a video of the game play:

Lessons Learned

After completing the course you will definitely be able to make a basic game and in time and with a good amount of effort you should be able to make an excellent game. There are a few things besides coding that go along with game design that I find to be the hardest aspect of the craft. These are things that I will need to improve in my game.

Physics/Feel: The way entities interact, timing, controls. The physics of the game help to allow the user to feel the game. If the characters move too slow or don’t jump in a logical way then the user feels it and the game becomes unappealing.

Story: Games should have a story, it can be simple or complicated but it needs to exist. While making this game I did not really start off with a story, I just wanted to learn the programming aspect. Now that I have learned enough to make a more robust game, the next one will definitely have a story.

Graphics: I have no skill at creating graphics myself; I needed a bit of help from my girlfriend to make some decent sprites. Graphics are hard; the game needs to have a good style that helps keep the user’s attention and make the experience more enjoyable. When I say good graphics I don’t necessarily mean high end rendered images, I simply mean they need to be appealing and click with your game. A good example of this is Minecraft, it looks silly but it is very fun to play and has a large following. It is also important to keep in mind what John states in the course, don’t worry about the graphics when learning to make a game. At the beginning of this game’s development I used boxes for sprites, it looked silly but it got me through the tunnel.

Since working on this project, I have recommended this course to a few of my fellow developers at work. Not because they enjoy video games but because I believe making a game helps strengthen your OO skills. I was surprised at how bad I was at doing something that consists purely of writing objects; it really put my skills to the test.

I ended up rewriting some the application a few times before I had my base designed in a manageable way. I am a strong believer in writing a program more than once, learning from the mistakes of the first pass through and coming out with something more refined. I would recommend this course; it is definitely worth your two hundred free minutes of PluralSight if you have not signed up yet.

Where to next

Now that I have made a platformer game I would like to try something different. I am going to try to make an adventure RPG, attempting a classic Zelda feel perhaps. Another thing I am going to attempt is to port the game over to ISO and Andriod either manually or using mono.

Making games is something that I could see taking whole bunch of effort and failures to get right. I want to try various types of games so that one day I can make one that I consider distributable to the public. I am not releasing this game on any application market, it is still a half cooked and there are quite a few improvements I would need to make.

I am glad that I had entered this contest, and I believe that it was a building block for a great hobby and maybe one day a career. Thanks John for this fun project, many a nights were spent with key clatters. I hope everyone else had a great time making their games as well.

Winners from XNA Contest

Around the end of Sept when I released my XNA course with Pluralsight I announced a contest for a chance to win an iPad, Kindle Fire HD or a Nexus 7.

Thanks for everyone that entered the contest!

It was difficult to pick the winners, but without further ado, here they are!

First place!

Hermies Adventure by Joshua Burchat


2012 12 08 12 10 49 thumb Winners from XNA Contest

I really liked the depth that was put into this game.

In my course, I had covered creating a shooter game, but Joshua went beyond that and figured out how to create a platform game.

The game features scrolling clouds in the background, falling snow and lots of different enemies that behave in different ways.

The game even included potions that randomly dropped when killing enemies.

Congratulations Joshua, great job on this game!

Second place!

Genesis by Patrick Kalkman

opentk game window 2012 12 08 12 12 29 thumb Winners from XNA Contest

This game was also very well done.  It was a very tough choice between this one and Hermies Adventure.

Patrick did an excellent job of really creating a nice shooting game with smooth animations, power ups and even bosses.

He also included a level editor.

I really liked how Patrick created the enemy movements.  It really felt like a classing arcade game.

Third place!

Bee-pops by Ilias Shaikh

bouncingball 2012 12 08 12 13 14 thumb Winners from XNA Contest

Another excellent game.  I really liked how Ilias utilized realistic physics to make the balls bounce around the screen.  The little transparency effects on the balls made a neat game experience as well.

It is a pretty simple concept, but it was done very well.

Thanks everyone who entered the contest

Was really great to see all the games that were created.

Introduction to MonoGame

I’ve been playing around quite a bit with MonoGame lately and thought I would take some time to write a bit about it and talk about how to get started.

I’m also currently working on a Pluralsight course on cross platform development with MonoGame.

monogamelogo100x100 thumb Introduction to MonoGame

What is MonoGame?

Well, if you are familiar with XNA, then you already know what MonoGame is.

If you are not familiar with XNA though, it is basically a game development framework that allows for creating games quickly without having to write all that repetitious code that all games need.

Basically it makes creating games more about the game and less about the technical details.

The only problem with XNA is that it only really works for Windows, XBox360 and Windows Phone 7.  If you want to create a game on Android and iOS, you can’t use XNA.

This is where MonoGame comes in.  MonoGame is an open source port of the XNA framework that can run on many more platforms that Microsoft’s XNA.

Great, so what does this actually mean?

Well, if you are interested in game development, especially if you are interested in game development for the most popular platforms today, MonoGame might be able to help you to write pretty close to the same exact code and have it work on Android, iOS, Windows 7, Windows 8, Windows Phone 7, MacOS, XBox 360, Linux and the new Playstation console.

That is pretty awesome!  Especially if you are trying to monetize your effort.

In my mind MonoGame helps overcome two huge barriers to getting into game development.

  1. Difficulty of monetizing the effort.  By allowing the same code to be shared on most platforms, a game developer can get paid for their effort in multiple marketplaces.
  2. Not knowing where to get started.  The XNA API is so simple to use that you can get a simple game, like a Pong clone for example, up and running in about a couple of hours.

Also, because MonoGame is basically just XNA, you can find a whole host of resources on how to develop a game using the platform.

In my upcoming Pluralsight course, I show how to create a Pong clone on Windows and then we get that game up and running on Android, iOS and Windows Phone 7, with minimal changes.

dgun 853 50 games pr h thumb Introduction to MonoGame

Getting started

It can be a bit challenging to find good information to get started in each platform using MonoGame, but the basics are located on the Github page.

For the Windows tutorial there, you can use Visual Studio instead and use the MonoGame installer.

For each platform things area slightly different, but really not all that hard.  If you want to have your game run in Android and iOS, you’ll need Mono for Android and MonoTouch respectively.

For Android development, you can use Visual Studio as long as you have Mono for Android installed and all you really need to do is link your files from your Windows project and create a small bit of startup code in an Android Activity to start the game.

For iOS development, you will need to use MonoDevelop, which is packaged with the install of MonoTouch.  MonoTouch itself uses XCode and the iPhone SDK, so you have a bit more installing to do there, but the idea is pretty much the same.  One you have MonoTouch running on your Mac, you can link over the files from your Windows project, add a small bit of startup code, and you are up and running.  (You’ll also need to download the actual MonoGame source code to add to your project, since there isn’t an installer for Mac currently.)

Xamarin also has a seminar they did on MonoGame to help you get started.

True cross platform development, finally

At least for game developers.  For other applications in the mobile space, there are some solutions that help you share your code, but nothing that really allows you to have near 100% portability without a big sacrifice.

I was pretty amazed the first time my game just ran on my Android and iOS devices with virtually no changes.

I’d definitely encourage you to check out MonoGame and stay tuned for my Pluralsight video on the topic, where I will go through all the details of creating a game and getting it running on most of the major platforms.