Creating and consuming services in your XNA Game
Feb 18th
The GameServiceContainer implements the IServiceProvider interface and the MSDN documentation says about the IServiceProvider interface:
Defines a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.
This article will “attempt” to describe how can you use the GameServiceContainer in your XNA game, in both your GameComponent(s) and your game’s entity objects.
More >
Changing the PlatformTarget in Visual C# Express
Jan 18th
Some project types in Visual C# Express (Empty Project) will not allow you to change the PlatformTarget from the UI. You can still change the target platform though by editing the .csproj file in a text editor. Close the project and open it up in your favorite text editor (I use Notpad++). The .csproj file is really just a XML file. You should see somewhere in the file something like:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> .... </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> .... </PropertyGroup>
Inside the PropertyGroup elements, add the PlatformTarget element:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> .... <PlatformTarget>x86*</PlatformTarget> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> .... <PlatformTarget>x86</PlatformTarget> </PropertyGroup>
Save the file and open your project back up. Your project’s output should now target only x86.
Google says I’m awesome
Jan 16th
Google Alerts is a service that allows you to be notified whenever a new search result is found by Google. I currently have it set up to alert me whenever a new result is found for “Zachary Snow”. Turns out I’m not the only Zachary Snow in the world, although I am the #1 (as of this writing) according to Google (see here). That is why I am awesome.
Too Many Video Games
Jan 8th
For the first maybe ever in my adult life, I think I can actually say I have to many video games to play at once. Shortly before vacation back to the US, I bought Dragon Age: Origins and was unable, of course, to complete it before vacation. Then for Christmas / my birthday, I was given Mass Effect, a game I have been wanting for some time by my best friend via Steam. I have yet to play it as I don’t want to take on another RPG at this time.
After returning from the US, I bought Trine off the Steam sell for 5 €. Trine is not that long of a game I don’t think and I will probably finish that fairly soon. I was then given Forza 3 as a birthday present from work. Forza is basically another RPG with the season mode.
So, with what little gaming time I have, I now must split my time between 3 games: Dragon Age, Forza 3, and Trine. I will play Mass Effect after Dragon Age is finished, but then there is the new expansion coming out.
I guess I really shouldn’t be complaining. There are many times when I just wish I had one good game to play and now I have 4. It just feels like sometimes when you have too many games that you want to play at a given time, the collective fun factor isn’t as high as when you play them each one by one. But then, there are worse problems to have.
It’s good to be a website owner again
Dec 5th
After about a year or so of not owning my own website, I finally purchased my own webspace again. I don’t know if I’ll be copying over my old posts or not.
First Look at Map Editor
Jul 13th
I’ve been working on a map editor for what seem likes forever now. I’ve gotten so much done and then I would just feel like the thing was written poorly and so I would completely reorganize it. I’ve done that about 3 times now.
Finally though I have an MVC pattern going in the code and I’m very comfortable with what I’ve written. I’m not sure when I’ll be finished but I should have something workable within the next weeks or so.
xblcg.info
Apr 28th
I haven’t had time to write anything as of late. Really busy with work and I’m spending most of my spare time either writing code or playing video games. I’d like to point people in the direction of http://www.xblcg.info/. I think this site is what community games has needed for the longest and glad to see the guys doing the good work.
M is for Massive
Mar 15th
Scientific Ninja has a post about how the term MMORPG is a little overused by hobbyist developers. It’s a good read.
Calculating an angle from a Vector2
Feb 28th
When you need to calculate an angle from a Vector2 structure, you can use this piece of code:
public static class Vector2Helper
{
public static float CalculateAngle(Vector2 v)
{
float angle = 0.0f;
if(v != Vector2.Zero)
{
v.Normalize();
angle = (float)Math.Acos(v.Y);
if(v.X < 0.0f)
angle = -angle;
}
return angle;
}
}
I used this to calculate an angle from the Vector2 of the Left Stick.
The original credit for this source code comes from here.
The Game Show Host Problem, aka The Monty Hall Problem
Feb 12th
NOTE: This is a repost from my old blog.
So, me and my girlfriend went to see 21 last night and in the movie they make mention of The Game Show Host problem, aka The Monty Hall Problem.
The jist of the problem is this: You are on a game show. The host presents you with 3 doors, 1 of which has a car behind it, the other 2 have goats. The game show host tells you to pick a door. You do so, at which point the game show host opens up a door to show you a goat behind the door and then asks you if you would like to switch your choice to the other closed door. The question is then, should you switch your choice?
The correct answer is yes. More on why after the jump.
I won’t go too far into detail about why you should switch your answer, I’ll leave that to Wikipedia. Some things to note that may not be obvious: 1) The game show host will always open a door that is not the correct door 2) He will never open your door. These are the keys to this problem. By switching, you will win a prize 2/3 of the time as opposed to only winning 1/3 of the time if you do not.
Many people will argue that once the game show host opens the door with the goat behind it that there is now a 50% chance of you picking the right door by either staying with your door or switching. This is simply not true. Each door still only has 33.3% chance of being the door with the car behind it. The thing is though, once you pick your door, the game show host then eliminates a door based on 2 criteria: 1) The door is not the one with the prize behind it 2) The door is not yours. Due to these criteria, the odds of the correct door do not change for the door that you have picked, but rather change for the doors that you have not picked. The 2 doors not chosen by you then in a sense combine into one option and they together have a probability of 66.7%.
The Wikipedia article explains in much more mathematical detail why it is better to switch. I suggest you look there if I have done nothing but confuse you. This is simple strategy and probability. Knowing exactly how the game works can make you alot better at it.

