Home News New Blog Forum Blog RPG Tutorials Tutorials Screenshots XNA Links Xin About Me Contact Me

XNA GPA Blog

February 13, 2010
XNA and Full Screen Games
I answered a question today on Dream.In.Code about centering a game in a larger screen. The person had a game, that was 200 pixels by 200 pixels. They wanted their game to be centered in say a 1024 pixel by 768 pixel screen. After thinking about this for a little while I came up with an answer for them. I thought I would share what I came up with my readers. When you set the IsFullscreen property of the GraphicsDevice class XNA will make your game run in full screen mode, regardless of the size you set your game to. So if you were to set your width and height to be 200 by 200. XNA will make your game run in such a way that it will take up the whole screen. There is a way to make the screen size larger and have your game centered on the screen with borders around it. I am going to write a quick tutorial on this. It should be available tonight.

February 12, 2010
Xin Partner
I have a partner working with me on Xin. He is going to be adding in support for Zune and Zune HD. I won't release his name until I've gotten his permission. He likes the Xin project and found the code I used for Xin very straight forward and easy to follow. I'm hoping that people will find it both of these to use as well.

February 11, 2010
Xin Beta Release Estimate
After finishing the latest XNA role playing game tutorial this evening, I've decided that I am going to work on Xin a little this evening. To try and get Xin ready to be released as a Beta version. This is for people to try Xin and get feedback on the features I've added to Xin and to get suggestions for future releases. Xin is under the Creative Commons Attribution 3.0 License. That means you are free to use Xin in your projects as long as I get a credit in your project or in the documentation of your project and a link to my web site.

I hope to work on a few short tutorials over the next few days along with the next tutorial in my XNA role playing game series. So, keep tuned in for news on my tutorials and for more on Xin.

February 10, 2010
Been Very Busy on next RPG tutorial!
I have been working hard on the next XNA RPG tutorial today. I have got most of what I wanted to accomplished. The rest I should easily finish tonight and get started on actually writing the next XNA RPG tutorial. I would suspect to have it available on the site tomorrow night or maybe even tonight if I have the time to finish it all.

One of my readers has asked if I thought about adding in a forum to my site. I have been thinking about it but it will have to wait until I make the move to the Linux server that supports PHP. The reason is that I have not been able to find good forum software that will run on a Windows server. That isn't to say that there isn't one, I just haven't found one that I like.

I hope to have some of the mini XNA tutorials available on the site shortly. One that I am thinking of writing is a tutorial on sprite animation. That is a fairly common task when making XNA games and it is easy enough to accomplish. I will write the tutorial so that it will work with both XNA 3.0 and XNA 3.1 and it will use both the keyboard and the game pad. I wrote a tutorial on uniform motion of a sprite using keyboard input. On how if you are using the keyboard and are moving a sprite diagonally it will travel faster on the diagonals then if you are moving it up and down or side to side. This is something that you should try and avoid in your own games. I will try and have that short general XNA tutorial on the site shortly.

February 9, 2010
Screen Manager Tutorials
I have uploaded the XNA screen manager tutorials that I was talking about the other day. I was unable to get much work done yesterday however. I ended up having quite a lot to catch up on from being sick over the weekend.

I will be working on Eyes of the Dragon tonight, the role playing game that I am writing a tutorial series on. I will also be working on a few smaller tutorials that I hope will be useful. They won't be complete games with all of the polish that goes into a complete game, such as managing screens, sounds, or game levels. They will be useful tutorials in that you will be able to pick the code out of the tutorial and add it into your own games easily.

I will also be working on a set of five or six tutorials on creating an Asteroids style game with XNA. This will be a complete game, from start to finish, with everything that you would expect to find in the complete game of Asteroids. It will not be the traditional black and white arcade game though. I'm going to try and update it with more modern graphics. I will also be adding in sound to the game! Something that I haven't written a tutorial on before.

February 8, 2010
Migrating from XNA 3.0 to XNA 3.1
When Microsoft released XNA 3.0 they made it very easy to upgrade your XNA 3.0 games to XNA 3.1. They also made it so that you could create both XNA 3.0 and XNA 3.1 games with XNA 3.1. If you have an old XNA 3.0 game and you would like to upgrade it to XNA 3.1 they couldn't have made the process any easier. All that you need to do is to right click your solution in the solution explorer and select the Upgrade Solution option to convert your game from XNA 3.0 to XNA 3.1. This will upgrade your game to use the XNA 3.1 framework instead of the XNA 3.0 framework. You can not mix XNA 3.0 and XNA 3.1 projects. You need to use one or the other, not both.

If you ever have a Windows game that you would like to create a version of the game for the Xbox 360 or the Zune, you can do that easily as well. All you need to do is to right click your game in the solution explorer and select Create a Copy of Project For Xbox 360 or Create a Copy of Project For Zune. You will of course need to make a copy of any other projects related to your game, like game libraries.

February 7, 2010
Screen Manager Tutorials
I have written previously two more tutorials in my XNA screen manager tutorial series and I am planning on adding them to the site tomorrow. I just need to convert them to PDF format and make a few modifications. In these tutorials I added in support for the Xbox 360 game pad and I also added in making a pop up screen.

February 6, 2010
The Future
I didn't get as much done the past two days as I would have liked. Both on personal projects and on my XNA tutorials. I have been feeling a little under the weather and can't seem to focus well on programming. Hopefully I will have a new tutorial ready by Tuesday night, my time, which is GMT-5. I just can't seem to focus well enough to get any new code written or do any writing on what I have been doing.

I have done a little work on Xin. Just testing in old demos that I've made in the past and I find it to be pretty helpful.

With so many people reading my tutorials and using my code I have decided to choose a Creative Commons License for you using my code in your own games. Simply the license says that you are free to use my code for both commercial and non-commercial use as long as you give me credit in your game, documentation, or web site. A link on your web site would be appreciated even if you are just reading the tutorials for personal use to spread the word.

Creative Commons License Jamie McMahon
This work is licensed under a Creative Commons Attribution 3.0 Unported License.

February 5, 2010
Blog Archives & X-In 611
I have have archived the blog entries for December of last year and January of this year into pages of their own. You will find links to the blog archives on this page in the right column.

I was working with X-In last night and I really like what I have come up with here. I tested X-In in the game I was talking about yesterday and I liked how well it worked. It will not as useful in a small game where all of the input is handled in the main game class. In games where input is handled in many different classes is where X-In will be much more useful, like in Eyes of the Dragon where input for menus is handled in the menu components. All of the input methods are available to any class that wants to use them.

I know that I didn't invent the wheel here but I have found X-In to be really helpful for managing input in large games.

February 4, 2010
Xin Update
I think I may have my Xin library finished. I still have to test some of it but I wrote most of the code. I'm going to test it in a demo game I made for the 52 Weeks of Code XNA challenge at Dream In Code. The 52 Weeks of Code challenge is a challenge where you try things you haven't tried before. The first week was to try something with jQuery, which is a Javascript library. The second was to try XNA. The third was to try something with the Twitter API. Last week's was to try Python and this week's is to try Ruby. I moderated the XNA challenge and I made a little demo game for it. It is a very simple space shooter that would just introduce XNA to a C# programmer who had never tried XNA before.

To use Xin you just add the game library to your project. You add a using statement for the namesapce, which at the moment is InputHandler, and at the start of the Update method of your game you call the method to get the state of the input devices and at the end you call the method to set the last state of the input devices like this.

protected override void Update(GameTime gameTime)
{
    Xin.SetStates();

    // Game logic goes here

    base.Update(gameTime);
    Xin.SetLastStates();
}

There are many methods and properties in Xin for input. For example, if you want to see if there has been a single keypress you can do the following.

bool result = Xin.CheckKeyPress(Keys.Space);

I'm really excited about Xin. I've tried it with something I'm working on and it makes life so much easier! I'm also including functionality to activate the motors in the Xbox 360 controller to have them vibrate.

I am going to try and work on the new XNA RPG tutorial today as well. The tutorial is going a little slow right now but I'm sure it will be finished tomorrow. But don't forget Murphy's Law: If anything can go wrong it will. go wrong it will.

February 3, 2010
Small project
I started work on a small XNA project yesterday evening. I've been talking about writing a tutorial on creating an input manager with XNA. I won't be writing a tutorial on an input manager with XNA but I am developing an open source input manager with XNA. I'm calling the project Xin Input Handler. I'm planning on have a lot of functionality added to Xin, for short. It is a game library that you can add to an XNA game to handle all of the input of your Windows and Xbox 360 games. If I ever get a Zune, not sure that I'm going to, I will possibly create a version for the Zune as well. Xin will handle input from the keyboard, Xbox 360 game pad, and the mouse. Of course since the Xbox doesn't have a mouse that will not be available for the Xbox 360. I will let you know when the first beta is ready for testing.

The new XNA RPG tutorial is coming along well. It will probably be a two part tutorial at least. In this part of the game I'm handling picking up items. When they player picks up items I'm planning on moving to a pop up screen to display the items they have found.

February 2, 2010
Cleaned up a little
I made a few small changes to the site today. I made an archive out of some of the old news posts on the News Page of the site. I'm going to work on some javascript and jQuery on this page and on the tutorial pages to help organize them a bit better as well. I'm about to sit down and do a little work on the newest XNA RPG tutorial. I hope to get most of it done today, and if possible have it up on the site for download.

February 1, 201010
Didn't move after all
I did move the site today after all. I will be moving it very soon but I will make sure to let you know when I will be doing that. I hope to have the XNA screen manager tutorials available on the web site tomorrow and I will be working on the next XNA RPG tutorial as well. I'm going to write a tutorial on creating an input manager for your games. When it is done you will have a game library that you can easily add to your games to manage all of the input of your games. It will work with both the Xbox 360 and Windows. I don't have a Zune so I can't implement that into it. On the Xbox it will use both the keyboard and game pad. In Windows it will use the keyboard, game pad, and the mouse.

I just want to add one more thing to this entry. When making games there is something that many people don't take into consideration, at least in Windows. That is you do not own the computer. There are many ways for the person playing your game to switch to a different window and you should handle that. What I mean is if they are playing a game in a window and they need to click on something outside of the window you should pause the game until they return. There is a very easy way to do that with XNA. You can do it with just two lines of code! (Or even one since you could put all the code on the same line.) XNA has a property called IsActive. This property will return whether or not your game is the active window. If your game is not the active window you can just exit the Update method using return like this.

if (!IsActive)
    return;

That is all that you have to do! The player can switch out of your game and not have to worry about their progress in your game.

I'm going to work on archiving December's posts, and archives in general, and making drop down menus to make navigating a little easier.



Good luck with your XNA game programming adventures.

Jamie McMahon

Blog Archives

February 2010
January 2010
December 2009