XNA Game Studio 2.0 Presentation – Cleveland .NET SIG

Last night, Reuben Ahmed of Bennett Adelson gave a presentation to the .NET SIG on XNA Game Studio 2.0. He took us through a simplified game creation process, creating a basic Invasion of Alien Lifeform (think “space invaders”) clone in a little over 2 hours.

Reuben kept relating the stages to Mario and the various Mario games, which got me excited, as I’ve always been a fan of Nintendo’s Mario games. From the old school NES days to Mario Kart on SNES and higher, I’ve always enjoyed a good Mario game. So this made his presentation even easier to relate to.

One of the first things he pointed was that XNA made games programming easy for the hobbyists. That means that those of us who didn’t get into hardcore Direct X programming and games programming actually could make our own games.

XNA, according to his presentation, stands for X-Platform Next Generation Architecture.  According to the XNA Frequently Asked Questions on MSDN, XNA is one of those recursive acronyms like GNU (GNU’s Not Unix) and PINE (PINE Is Not Elm), and it stands for XNA Not Acronymed. Either way, XNA is a really cool tool. It’s a game framework for C#, which is weird considering that a lot of game programming is done in C++ rather than C#.

To use XNA, you need at least Visual C# 2005 Express. It also can work with Visual Studio 2005, but due to the timing of its release, it does not currently work with Visual Studio 2008. The other key requirements are Direct X and Pixel Shader. You can tell which version of Direct X you have by running the command dxdiag from a Run prompt in Windows. There was uncertainty to how to tell if Pixel Shader is present. I found an XNA Requirements Checker Program while doing a search on XNA and Pixel Shader. XNA will work on Windows XP and Vista.

So what are some of the things that XNA has to offer?

  • Optimized game loop: A game loop is the sequence of sprites that are used for a jump or for moving forward or any other form of movement. XNA provides Update and Draw methods to handle this.
  • Content pipeline: This is an easy way to insert graphics, audio, and other assets for your game.
  • Can make games run on Windows and XBOX360: There’s a cost for XBOX360 that will get mentioned later.

At this point, Reuben put started the code portion of his demo. When you create a new game project in your development environment, you can run it with the default code and a windowed blue screen should show up. I find it funny that they use a blue screen by default – since when has a blue screen really been a good thing?

The next part of XNA that he got into is graphics and textures. Just like adding code files to App_Code, in XNA, your graphics and textures have their own special folder called Content. This folder is used with the built-in content pipeline, to make it extremely simple to use images in games programming. First, you add the assets to the Content folder. Then you need to load the graphic in a variable. Since his demonstration focused on jpg or gif files, he used the Texture2D class. Once a graphic is loaded into a variable, its position can be updated within the Update() method, and it can be drawn via the Draw() method.

There are certain factors that have to be taken into consideration with placing images. On a 2D level, graphics are placed based on the upper left corner. So keeping that in mind, it makes sense that when you are determining boundaries, you have to keep the image’s width and height in mind. If these are forgotten, then it’s very easy to place an image off the screen. Another thing to consider is something called overscan. When you are developing a game for the XBOX, you need to take this into consideration. Finally, keep in mind that the 2D vector system is a positive number system, where (0,0) is the upper left corner of the Viewport. Negative coordinates will render an object off the screen. Although the object wouldn’t be visible, it would still get loaded into memory.

After adding graphics, Reuben showed us how to tint images, so that player 1 could be a yellow ship and player 2 could be a different colored ship. For those of us who are Photoshop-challenged, this is actually a very simple, painless process.

From graphics and textures, he moved on to user input. With XNA programming, you can program for Keyboard input and XBOX Gamepad input at the same time, via enumerators. So for example, let’s go back to an old-school game – Wolfenstein 3D. There was a cheat code for it, where M-L-I had to be pressed simultaneously. Programming this in XNA, would look something like this:

if (Keyboard.GetState().IsKeyDown(Keys.M) && Keyboard.GetState().IsKeyDown(Keys.L) && Keyboard.GetState().IsKeyDown(Keys.I)){
// Give uber hacks here


In the demonstration, Reuben showed how to bind the left and right keys to move a ship (a graphic already displayed on the screen). The movement was done through simple vector addition and subtraction.

Another thing that can be controlled is the rumbling of the Gamepad. There are two motors in it – a low motor and a high motor. Through the Gamepad enumerator, you can call a SetVibration() method.

In the demonstration, an alien was added to the program, and this alien moved across the screen. Thanks to the MathHelper.Clamp() method, the alien was constrained to the Viewport. This particular method is used for setting boundaries, as it “clamps” a number within a range. So if you want a number to stay between 0 and 50, this would return 50 if the value exceeds 50.

Once the alien was added, it was time to add bullets and logic for hitting the alien.
As Reuben warned us at the beginning of the presentation, he was programming for the fun of it, not necessarily taking any best practices into consideration. So for his collision detection – determining whether two objects have collided – he used the rectangle method. Basically, draw rectangles around the objects that you want to test, and then use the Rectangle.Intersects() method to determine whether there’s a collision. The problem in doing this is that the rectangles also get loaded into memory. With games development, especially at a 3D level, you have to keep memory usage in mind. Other collision detection approaches that were suggested include per-pixel collision detection (determining collision detection at an exact pixel point) and color collision detection (based on a color map).

Writing text was included. From a simple “Hello World” to a hit counter, it was a simple call to write.

The last detail before packaging and distribution was adding audio to the game. In order to do this, you need to create an audio project with the Microsoft Cross Platform Audio Creation Tool (XACT). The interface allows the simple drag’n’drop familiarity for adding WAV files to wave banks and sound banks, in order to get played in the game. This tool creates an XAP file, which then can get added into the game code similarly to adding graphics. The MSDN Audio Overview explains how this works.

Now once everything is put together and you have a game that works, you definitely want to share it with your friends, right? If you’re doing a Windows game, you’re in luck. There are no fees for redistributing your game. Using a tool called XNA Pack, you can package your game into a redistributable executable file.

Writing games for the XBOX comes at a cost. In order to even debug your game for the XBOX, you need to have an XNA Creators Club license, which runs $49/4 months or $99/year (as of this posting). The other problem with writing games for the XBOX is that you need an active Internet connection, as the XBOX has to go out and validate the license. Reuben was not able to show us this part, as he could not get an Internet connection out for his XBOX.

The last thing he showed was a sample of what could be done with XNA. This particular program was written within 1 week. Here it is:

Whether it’s a space shooting game or some game to promote your business, XNA can be a useful tool. Even those of us with little to no game programming can get into using XNA!

Some links to check out include:

On Mentoring…

I’m at home today, thanks to this awful weather and my body not liking weather changes much. So being at home, I was twitter-surfing and came across the tweets of one of my favorite programming bloggers/authors. In one of his recent tweets, he mentions (in passing) that he has a mentor, which I find quite interesting.

I’ve been reading up on mentoring a lot lately. Being in a professional organization such as the Association for Computing Machinery, I’m exposed to some interesting benefits, including membership to MentorNet. So after receiving numerous emails on it, I figured I’d check it out. I’ve spent quite a bit of time reading through the MentorNet site to get a better idea of the way they work.

In many past experiences, I’ve been shadowed by younger students and younger programmers and techies. I’ve enjoyed being able to share my experiences and knowledge with them, and I especially enjoyed being able to take the step of instructing labs in college and working with students then. I love programming; I love what I do. The passion for programming compels me to share my talents when I can.

Getting where I am today, oddly enough, I haven’t really had a mentor. Sure there were professors I looked up to while I was in college, and there were the guys along the way who encouraged me to keep it up. That’s just how I’ve gotten to where I am – getting lucky by meeting the right people and networking with them. But there were never any mentoring programs at the college level, at least not in the programs I had been in.

So I have to ask – for those of you who have/had mentors, how has the mentoring situation helped you? Have there been any problems that you’ve run into? Sure, I can read sites about mentoring, but I’m curious about personal experiences as well.

Really Simple Syndication… RSS for short

Last week, as I looked at some sites, I kept noticing links to their RSS feeds. Being back in the public-facing web development arena, I figured that I should probably understand the technologies that are out there for me to use. So I contacted my friend Nivex, who I knew had dealt with RSS feeds in the past, as he had mentioned them to me in passing. He was able to explain it to me so that I could understand it.

RSS stands for Really Simple Syndication. They work on subscriptions, and whenever you subscribe to a site’s RSS “feed”, you can read the site’s updates automatically without having to go to the site. If you don’t want to see a site’s updates anymore, you can simply delete your subscription to the feed, without having to go to the site to unsubscribe.

RSS feeds are read through RSS readers. There are various types of software packages and websites out there to read RSS feeds. Here at home, I use Google Reader, and I use Mobipocket at work. Other readers can be found by searching for the terms “rss reader” or “rss aggregator” or “feed reader”.

When I wake up in the morning, there are a few sites that I visit consistently. Since I found the RSS feeds for them, I no longer open each site to see if they’ve updated or what they’ve changed to. I can just go to my RSS reader of choice and read the updates there. Granted, some RSS feeds are smaller than others, so I do have to go to the sites when the message is longer than the feed.

The night after I had the RSS conversation with Nivex, Jeff Blankenburg had messaged me, after realizing I had mentioned him here. He had some neat tools to show me, and so I checked them out. A couple tools he had me check out include Google Analytics and Google Alerts. I’ll save the details behind them for another entry. But the tool I’m going to focus on is Feedburner.

Whether you’ve got a blog, podcast, or commercial site, Feedburner can work for you. Feedburner can take your RSS feed and make it work for you. From statistics on how many people read your feed to what kind of reader they use to various statistics found in other web packages (site traffic, referrers, etc.), you can find out all sorts of details about your feed. You can see what search terms people are using to find your site. These are just site statistics and feed statistics.

But wait, there’s more! Feedburner can make sure that your feed is accessible to any feed reader application, using their SmartFeed feature. Whether you have mobile readers or people who just read from their desktop or laptop, SmartFeed makes sure their reader can read your feed.

There are various things that can be spliced into your feed – including pictures from Flickr, links to share the data on a variety of social networking sites, and links that are shared from a variety of social networking sites. There are also specialized feed handlers for feeds that deal with events and financial symbols.

Feedburner can work with the Google AdSense program, so if you’re making money from AdSense Ads, you can inject those into your feeds as well.

Getting the word out via Feedburner is fairly easy. Burn your feed, and then they have instructions on how to advertise your burned feed on your site, with instructions geared specifically for some common browser packages (including WordPress, Blogger, and TextPad).

My feed for this blog can now be accessed at http://feeds.feedburner.com/CodingGeekette.

Thanks to the talk of RSS and really neat tools with Nivex and Jeff, I’ve got some ideas as to how I can use them not only for my own advantage but for the company I work for as well. There are a few parts of our site that I can build feeds for that I could easily see as being beneficial. I have to pitch the idea to the company, but I think I could sell them on it.

Check it out – you may have a use for it too!

Microsoft, the Not-So-Evil Empire (Part 1) – CodePlex

This post is the first in many on Microsoft, the Not-So-Evil Empire, in relation to programming related topics and sites. Many years ago, I ran in circles with the Toledo Area Linux Users Group and later on with some of the guys here in Cleveland. One thing I noticed with those crews is the strong anti-Microsoft sentiment throughout. However, I was upfront with them about my playing the field – I prefer to be able to switch between platforms without playing favorites. They put up with me, but the president of TALUG at the time reminded them that I had volunteered for Microsoft (the Gaming Zone, but still…) and would tease me for not being a loyal Linux user. Every time I gave a presentation, I would hear a line about it.

One of the things that the Linux people complained about was that Microsoft didn’t deal with open source. Their operating system isn’t open source, the programs aren’t open source, and there’s no support for open source. Insert the rest of the Linux complaints against Microsoft and anti-open source here.

The Linux community has always looked towards SourceForge as its open source repository. There are many different categories of software available – including databases, sysadmin stuff, games, and desktop stuff. Some better known Linux packages on SourceForge include: phpmyadmin, PHP SysInfo, Squirrel Mail, and Licq.

Something I noticed while writing this blog though was that SourceForge has definitely changed. There are definitely more Windows packages available. Some packages worth checking out include GIMP for Windows (similar to Photoshop, but open source and free), GNUWin32 – GNU tools for Windows, and Tight VNC.

Now Microsoft isn’t anti-open source. It just took them a little longer to get there. Introducing CodePlex, Microsoft’s open source hosting site… live since June 2006, it’s their attempt at getting open source projects in the Microsoft world. Some projects to check out include Iron Python, 3D Tools for WPF, Power Toys Pack Installer, and a managed library for the Wiimote.

So how does this make Microsoft not-so-evil (as opposed to the Evil Empire that Linux people really see it as)? By promoting open source, they are also promoting community interaction with their users. Each project may be worked on by one developer or many devs. Version control can be handled by numerous CVS tools including Tortoise SVN and TFS. Yes, SourceForge was out first, but let’s give Microsoft some credit for taking this step.

One beaten dead horse addressed, with many more to come (but not necessarily right away)…

The GoF, My GoF Experience, and Design Patterns in General

Recently, the GoF came up in a discussion on Twitter. They were talking of design patterns, and Joel Ross actually had to refer to the book for some reason.

Now to a seasoned programmer, the GoF is well-known. But some programmers out there are not aware of the GoF or their book. They didn’t mention it in my data structures classes in college, and we never did look at it in programming paradigms either. For me, I learned about it firsthand at OOPSLA ’99.

The GoF was the Gang of Four, referring to the four authors of the book – Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. The GoF is also used in reference to the book, so take the abbreviation in context. The book came out in late 1994, and it was first made available at OOPSLA ’94. (Side note: I use the term “was” – sadly, John Vlissides died on Thanksgiving of 2004.)

At OOPSLA ’99, the GoF was on trial for crimes against computer science. The trial description can be found at The Show Trial of the Gang of Four For Crimes Against Computer Science panel description. After having spent some of the day coding in Java, a language I was cramming to learn on our off moments, I was glad to get a break and to witness this.

On Wednesday, November 3, 1999, the GoF was found guilty of their crimes. This was probably the best part of OOPSLA ’99, in terms of bringing in experts with a great sense of humor. Although I don’t remember all of the details of the trial, I do remember John Vlissides kept it interesting. That’s what made me curious about the GoF.

After seeing them at OOPSLA, I had to see what their story was. What is a design pattern and why was there such a big deal about it?

A design pattern is a reusable solution to a common software design problem.
Some pattern references can be found here:

The more I had read about it, the more I wished that they would teach as a followup to a data structures course. The data structures teach the basics – loops, clauses, classes, and other building blocks. A class on design patterns would show just how to use those building blocks in real world applications. Sometimes, you need that extra step to show just how everything comes together.

Then again, it could just be the engineer in me that likes to see building blocks being used to build something in the grand scheme of things.

Links for this entry were gathered via a collaborative search on Tafiti, which was recommended by Jeff Blankenburg.

Geocaching: Get the Geek Outside

This post has been inspired by To Code or not To Code, who made a post about his geeky hobby of model railroads. As we discussed, geeks need hobbies too. This one I’m going to talk about is definitely geeky – it’s called geocaching.

Quick – what’s the overall concept of geocaching?

The overall concept is fairly simple. Think of it as a treasure hunt. You’re given coordinates to where the treasure is, and with a GPS, you go and find that treasure. Sign the physical log that you were there, and then log your find on the website.

What is a geocache?
Someone out there took a bucket, loaded full of goodies, posted the coordinates (latitude and longitude) on the Internet, and waited for someone else to find it. It was here where the sport of geocaching started.

A simple geocache may be something like a 35mm film canister or smaller, with a piece of paper for people to log their visits. Depending on the canister size, most people log their geocaching nickname and the date or sometimes just their initials and the date. Other small log containers include the containers used to hide keys for when someone is locked out of their house.

A small geocache may be a tupperware container or a lock-n-lock container. Those usually contain things called travel bugs – trackable items that usually have a traveling goal, signature pieces – items with people’s geocaching nicknames that they leave as tokens, and the log book. The log book is key to every cache size. It’s for the cache owner to track down who has visited their cache and when.

A large geocache may be an ammo can or one of the cookie tins that you received from your vendors around the holidays. These typically have larger items for trading, and they also have a log book to sign.

Outside of containers, there are other interesting cache types. There are virtual caches – where you have to go to a location and find certain details from there and message the cache owner with those details to get credit for the cache. There are webcam and earth caches, where you have to take a picture of something in particular to prove that you’ve been there.

Sometimes, you are given coordinates directly to the cache. Sometimes, though, the coordinates take you to a step of a multi-step cache. At that step, you may be given more coordinates or you may have to find something to help you calculate coordinates. Some caches are called puzzle caches – you have to solve a puzzle of some sort to get your coordinates. Some puzzles are easy – like a sudoku puzzle or “count how many trees are at these coordinates”. Some though are quite difficult – like here’s a pattern that’s encrypted, now go find the cache.

These caches are located all around you, and you most likely haven’t noticed them. They may be in parking garages, behind stop signs, under lamps, or hidden right in front of your face (or “hidden in plain sight” as we cachers call it). They may be a statue or plaque you’ve read or at a bench you’ve sat on. They are out there, and they almost always go unnoticed.

Why do people geocache?

Some people geocache just to get out of the house. Others cache with a goal of reaching a certain number of caches. Still others cache to see just where they may end up.

Where have you geocached?

I typically cache in the NE Ohio/NW PA/Columbus, OH/Detroit, MI areas. I’ve got family and friends who live in those areas, and we’ve taken many of our friends out with us to see what the adventure is about. When the weather gets nicer, we’ll be introducing at least one more person to the sport. After giving a presentation on geocaching to a bunch of amateur radio guys, we have a few who are interested in going out.

If any of you live in those areas and want to see what it’s like, definitely contact me at sarah at codinggeekette dot com to set something up.

We have also geocached internationally. Caching in Canada was an interesting treat, especially since the cache we did there last summer took us to an old battlefield. It was interesting to read the plaques throughout the field, and at the same time, we were gathering information to calculate the end coordinates. It was a beautiful park, and the cache was definitely tough to find. Caching in Bermuda was nice though too. We were there with friends of ours from college who actually convinced us to get into it. We saw a lot of local fauna and flora while caching there.

What kind of GPS is needed for this?

As long as your GPS can narrow in on coordinates easily, you should be fine. The big name GPS makers are Garmin and Magellan. However, there are plenty of others out there.

Many GPSes out there support the GPX file format – this is the file format the coordinates are available in from the website. Also, the website exports the cache information in a variety of formats, and there are third party applications that are designed specifically for geocaching, like Swiss Army Knife (GSAK).

What if I want to learn more about geocaching?

The people at geocaching.com have put together a great collection of geocaching guides, including their FAQ, how to select a GPS unit, and how to put out a geocache. There are also local groups that have members who are always willing to help a newbie cacher out.

And I’m also willing to try to answer more questions. I can be reached at sarah at codinggeekette dot com.

Considering Your Audience – All of Them…

For all of my past programming positions, I’ve worked on in-house applications. I knew who my end users were, and I was able to develop solutions for them based on what they had and what they needed.

But what do you do when you’re designing for the public? You don’t know who may be visiting your site. How do you design your site?

When it comes to my personal sites, I’ll admit that I’m a slacker. I don’t use validators, and I tend to stick with basic HTML tags.

However, one of my projects in my current position forces me to truly be a great web developer. I have to take my audience into consideration on the company’s website. Sure, Visual Studio has validators, but even that isn’t enough for me.

As a web developer, I need to make sure that whatever information I’m broadcasting on the web is available to as many people as possible. This means that the visually impaired user needs to be able to find out information clearly, but the guy in the coffee shop with his PDA should also be able to find everything fairly easily.

What about those people who have Javascript disabled? One of the big features on the existing site is written in Javascript. It’s a great tool for finding out what’s available, but the data isn’t that accessible. Since it is part of my job to update the technology behind the existing site, I have changed the Javascript tool into an ASP.NET application that works even with Javascript disabled.

Working with this site has definitely taught me to be more aware of my users. Another section of the site is getting updated with a new look and feel. More images are being added. Although I was given the design for what needed to be seen, I picked up on the other users right away. When I sent the changes to the project manager, he wasn’t expecting two sets of changes, but at the same time, he was glad to see that someone thinks of the other users.

I haven’t had the joys of testing with a screen reader yet, so we’ll see how that works. However, I do spend quite a bit of time with the W3C Validator. I use the Accessibility Validator in Visual Studio, but sometimes I wonder if that’s enough. Yesterday, while looking up some things for work, I came across a book that mentioned WebXACT as another powerful tool. This is something I will probably end up looking into, just to see how well it works for our site.

Being interested in Human Computer Interaction definitely helps me in developing for the anonymous end-user, with whatever characteristics they may have.

Fascinated by Languages

When I was studying for my degree, one of my favorite classes was a programming paradigms class. It covered various types of languages and some basic structures. It taught me that there are certain languages better than others for each situation. To be a good programmer, it helps to know the language you work in. To be a great programmer, you know your language and are aware of the other languages out there. You are also willing to take the steps to add more languages to your repetoire, to help keep you one step above the rest.

My goal this year is to pick up more languages. At the beginning of 2007, I had a conversation with a co-worker at my former place of employment. We were talking about the languages out there, and he mentioned that he’d like to learn more about C#, but with our work demands, we had no time to learn it. I remember us coming to the conclusion that we’ll never need it, so we weren’t going to bother learning it. A few months later, I was in an interview for a web developer position that needed C#, and I mentioned to the interviewer that I’d go the distance to learn the language, as I already had a strong enough programming language and web development background to get started. That was at the end of March, and at the beginning of April, I got the job offer.

So I’ve been working with C# since the end of April 2007. I’ve converted ASP pages to ASP.NET, and I’ve had the joys of learning my data structures all over again. I’ve endured the experience of nested master pages with delegates. For being out of a solid programming position for so long, it’s been a great experience reawakening the programmer in me.

My inner programmer is now awake, and I’m looking forward to learning new languages. So far, my goals include:

I do not have an inkling to want to learn LOLCODE, even though my current license plate is in the code. Something about the whole LOL movement – LOLCODE, LOLCATS, etc. – just gives me a headache thinking about it. Unless someone can convince me it’s worthwhile, I’ll avoid it for now.

If there are other languages that are worth looking into, definitely leave a comment here.


Yesterday, at lunch, one of my fellow programmers asked me “Why OOPSLA? Why not TechEd or some other conference?” Honestly, having been out of the programming realm for so long, I’m not familiar with all the conferences out there for us. So give me links to look into these other conferences. I’ve already declared 2008 my year of passions – and programming is one of them that I’m focusing on. Give me fuel for my programming passion.

As for OOPSLA, there’s a reason why I want to return to it. Nine years ago, I was part of a CodeFest team at OOPSLA ’99 in Denver. CodeFest is where selected university teams come out and implement designs that were developed in DesignFest. DesignFest is a part of OOPSLA where developers get together in teams of 4 or 5 and solve a problem given to them. They need to work as a team and come up with all that the coders would need to implement the design effectively.

I worked on a team with two other people from our university’s chapter of ACM. One of those teammates was the chair of the student group; I was his vice chair. The other happened to be a great programming friend as well. None of us had worked together on projects or coding, but we were very lucky to work very well together for this. When we got our problem – design and implement a vending machine, we had to then figure out which language would be best for our implementation and then go from there.

Our problem was not just any vending machine – it was a coffee vending machine. That told us there what language we just *had* to use – Java! I hadn’t ever used it, so I learned it as we worked throughout that week. Both of my teammates had used it and knew that I’d be fine learning it, so that’s what we ended up implementing it in.

Now OOPSLA stands for Object-Oriented Programming, Systems, Languages, and Applications. So the whole point of the conference is to see things and learn things that are all about the OO approach. I had used Visual Basic extensively, which really didn’t get into OO notation as much as I needed for the conference. So I figured out that as well.

At the end of the conference, we had to present our project. We had a lot of people watching us throughout the conference, since we were programming out in the open. There were a lot of people in front of us at the conference, watching our presentation. We also never met our design team, so we did what we could with what they gave us. It was a great experience for me – learning a new language, learning about OO a bit more, learning more about the software design lifecycle, and meeting many people.

So why OOPSLA? It was where I realized long ago that I truly am meant to be a programmer. I found things that challenged me and that kept me curious. This year, I want to go to OOPSLA and participate in DesignFest. I enjoyed my CodeFest days, but I also want to see what it’s like to work with total strangers on a programming project that we have no prior knowledge of, at the moment. I want to see what it’s like on the other side of the OOPSLA ‘Fests. And maybe I’ll get to see CodeFest teams there who show the same potential that the teams of CodeFest ’99 showed.