Windows Phone Resources
Starting today, students and faculty with access to the MSDN Academic Alliance will see a few new products available through their system. The most notable of these products in Windows 7 Professional edition, over two months before it’s available to the general public. I’ve been running Windows 7 since it was first made available in the public beta, and have been very impressed by it’s overall quality, including it’s speed and stability. I currently have four machines running Windows 7, my two work laptops, which are running the RTM Enterprise edition, and two netbooks, running the Release Candidate. I plan to pick up a copy of the RTM for my netbooks when general availability drops on October 22nd, but even the Release candidate is better than any Operating System I’ve run before (and yes, I have run multiple non-Windows OSes).
Also up on the MSDN AA page is Expression Studio 3. This includes Blend, Design, Web, and Encoder, all of which contain huge improvements from the previous versions. It’s hard to believe that the entire product sweet has been around for less than two years, seeing the quality of the releases. Some things to take a look at inside of Expression Studio 3 are behaviors in Blend (building games in Silverlight just became a lot easier), and the screen recording tool in Encoder. Encoder also supports AVCHD natively now, though you have to have a licensed version to do so. There’s also a preset in there for encoding for the Zune HD, which I have been waiting for patiently since I first heard about it.
If you don’t have access to MSDN AA, and you are a student or faculty member in a department that focuses on Science, Technology, Engineering, Math, or Design, let me know. I should be able to hook you up with the people to make it happen. And if you have MSDN AA, but you don’t see Windows 7 or Expression Studio 3, check with your administrator, or drop me a comment,and we’ll get that fixed, too. Just imagine rolling up to a buddies house and showing him the Silverlight game you built on your Windows 7 laptop. You know you want this. Go make it happen.
On Tuesday, March 6th from 10:00 AM to 5:30 PM, Microsoft will be holding a session at the Game Developers Conference to introduce developers to the future of games and entertainment. They'll be doing deep dives on Xbox LIVE and Windows 8, where you can learn about how you can take advantage of Microsoft's vision for connected entertainment.
The primary audience for this Developer Day is professional developers who build games and entertainment applications for Xbox 360 and Kinect, Windows 8, Windows Phone, and the web. Developers will learn about the new Windows 8 Metro style application platform and new Xbox LIVE services that deliver breakthrough entertainment experiences across all of Microsoft's entertainment platforms.
This represents a huge opportunity for game and entertainment application developers to take advantage of the connections being built between the Xbox 360, Windows 8, Windows Phone, and the web. You can get more information about the Microsoft Developer Day by going to the GDC Tutorials page.
I just got out of a presentation on the Kinect (formerly Project Natal) at the Foundations of Digital Games 2010 conference in Monterey, California. This is the second time I’ve seen the Kinect in action, and it’s come a long way. The demonstration started with an overview of the platform, including the traditional camera, depth sensor and microphone array. They showed a visualization software showing what the camera saw and how it mapped that into a game ready skeleton, and then onto the in-game avatar.
They showed three of the launch titles: Kinect Adventures, Kinect Joyride, and Kinectimals.
In Kinect Adventures, they showed three minigames: a rafting game, an obstacle course, and a modified and improved version of the Ricochet game showed off in a few venues. The main concept they were showing off was that the games had intuitive controls. They showed some videos they had where they filmed themselves making actions that they thought should be used to control the game, and determined how fun the game would be. They also spoke on the idea of the drop in/drop out mechanic, and how it they encourage multiple players without the need to return to a menu or interrupt their game.
Kinect Joyride showcased natural gestures. The presenter brought up the idea of everyone understanding the movements related to driving a car. They then went on to talk about how during the development of the game, they found that there were certain gestures that naturally emerged, like leaning into a turn, and how they implemented these in game as gestures that controlled drifting or stunts to give the player extra points.
The last game that they showed was by far the cutest. It’s also the game that I think would get the most play at my house, as I’m sure that my daughter would end up spending a good amount of time playing with her virtual pet cat. They showed an RPG element in teaching your pet tricks like jumping, standing on their hind legs, and playing dead. This skill then translated into an obstacle course, where your actions were translated into the actions of the Kinectimal.
One common thread between all of the games was that the interaction to the game was both natural, and very active. I’ve played a lot with the Wii, and even games like Wii Fit didn’t get me moving at much as the Kinect demo showcased. I’m really looking forward to the launch in November.
One downside, though, was that someone asked a question about the availability of using the Kinect through XNA. The answer given was that the current access to the Kinect for developers is through the full development kit. I’m hoping that we’ll see XNA developer access once the Kinect launches, as that will give me an even stronger reason to pick one up.
Welcome to the second post in the series building TriangleShooter. In this post, I will be going over drawing a sprite to the screen, then moving it around using multi-touch. In the last post, I described what you got from File –> New Project, so we didn’t have any code as such as our starting point. This means that we’ll be starting from a new project named TriangleShooter. To make this happen, open “Microsoft Visual Studio 2010 Express for Windows Phone” from the start menu and selecting File –> New Project. From the New Project dialog that comes up, choose XNA Game Studio 4.0, pick Windows Phone Game (4.0), change the name at the bottom of the dialog to TriangleShooter and click OK.
This will get you the solution we went over last time, including two projects, TriangleShooter and TriangleShooterContent. We need to add a graphic that we will draw to the screen, so we’ll start by adding that into the Content project. I’ve added the Triangle graphic to SkyDrive, so you can grab that now. Once you’ve got that, we’ll add it into the project by right clicking on the content project, and choosing Add –> Existing Item…
Navigate to wherever you extracted the Triangle.png file, select it, and click Add. It should pop up under the Content Project. You can also drag and drop into the content folder if you prefer that. At this point, let’s take a look at some of the properties of the newly added Triangle.png file. To do this, right click on the file in the solution explorer and select properties. This should pop up the properties window beneath the solution explorer.
By default, a few things are set here based on the file type. The most important one to look at is the Asset Name. That is how you will refer to the file in code when we load it. Also important are the Content Importer and Processor. These determine how the file will be treated inside of the application. In this case, it is being handled by the Texture pipeline, but you could make use of a custom importer and processor, something I’ll take a look at in a future post.
So now that we’ve got the file included in the content project, we’ll need to draw it. To begin with, we’ll create a variable to store the texture. The type will be Texture2D, and we’ll name it triangle. Place the following code inside of the Game1 class beneath the SpriteBatch declaration, so it looks like this:
Next, we need to load this content into the variable. Since we’re loading content, we’ll use the LoadContent method. Inside of LoadContent, we need to make use of the templated Content.Load method, bringing over a Texture2D with an asset name of Triangle, and put that into triangle.
Finally, we’ll need to draw it. Naturally, we’ll do this in the Draw method. We’ll make use of the SpriteBatch, which allows you to queue up a bunch of draw commands for efficiency. It does this by requiring a call to Begin at the beginning, and End when you’re done. Between those calls come all of your drawing code. The SpriteBatch’s Draw function is highly overloaded. We’ll use the overload that takes a Texture2D, a Vector2, and a Color. The Texture2D is what you want to draw, the Vector2 is where you want the top left corner of the graphic to be, and the Color is a tint applied to the graphic. In this case, we’ll draw the triangle, draw it in the top left of the display, and tint it white, which won’t change the color.
If you run the code now, this is what you’ll see:
Looks good! There are a couple of changes we should make before going any further, though. First of all, I want this application to be full screen. To do this, I’ll add a line of code to the constructor, telling it that I want the graphics to be displayed in full screen mode.
Secondly, let’s change the background color to black. It adds a more spacey feel to the game. We’ll just change the line of code that clears the screen down in the Draw method to clear using Color.Black instead of Color.CornflowerBlue.
Now when you run the program, it looks a bit better:
For the last bit of this post, I’ll show you how to make the Triangle move around using multi-touch. We’ll start by adding another variable to the class to track position, called position. It will be of type Vector2, to hold the top left of the graphic. We’ll put it directly after the declaration of the triangle, like so:
We then need to give it a default value. Since we’re not actually loading it from anywhere, it won’t go into LoadContent, instead it goes into the Initialize method.
Then, we modify the line of code that draws the triangle to make use of position, replacing Vector2.Zero with position.
If we run now, we get the same behavior as we did before. This makes sense, because we’re not actually updating the position anywhere. To update the variable, we’ll want to add some code into the Update method. Specifically, we’ll go through the active touch points and set position to their position. In the next post, I’ll go into a method of finding out which touch point is the primary (first) touch point, and only updating using it, but for now, we’ll just update it using whatever touch point gets there. To do this, we’ll just loop through each of the touch points using a foreach loop and set the position, as so:
And that’s it! Run the program, and you can move the triangle around with your finger (or mouse, in the emulator). If you have a multitouch display or a Windows Phone 7, you can see what happens when you put more than one finger on the screen. Essentially, it updates to each of the touch points, which means whichever was the last one down will be where the triangle goes.
Download the completed source code
I am giving a session on XNA for the Windows Phone 7 today at 9:15 AM. For the presentation, I will be walking through the development of a game I am calling Triangle Shooter, because you are a triangle that shoots. I’ve posted the graphics I created to SkyDrive, and after the presentation, I will be posting a series where I walk through the source code and explain how I built the game.