Wednesday, December 24, 2008

OUT OF OFFICE

I will be "out of office" from DateTime.Now() until the end of the first week of January '09.

For those of you who usually read this blog thanks a lot for you time, comments and private messages.

As you may know, the results from Ziggyware's lastest article compo have been recently published so congrats to the winners (many thanks to all of you who submitted an article to the competition).

Before I leave, I must tell you: don't foget to check out the games been published on the community games channel on the XBox Live! There are great games being released as we speak which are quite fun to play ... my favorite so far is ... well, I'll tell you after the break.

Happy holidays and cheers!
~Pete

Friday, December 19, 2008

XLCG: DR. POPPER IS OUT!

Bill from Blue Rose Games has finally released his game "Dr. Popper" to the Community Games channel over the Xbox Live!

[For those of you who don't know Bill, he usually posts handy articles regarding game programming using both, Silverlight and XNA technologies.]

This is a game I've really enjoyed playing on the PC on the past, and now it's great to see it published for the XBox 360.

The proposal is simple in design and still incredibly fun to play. So give it a try, relax, and enjoy the smooth puzzle-like gameplay.

I'l leave you with a short video of the game:

One of the best parts is that it only costs 200 points ... a nice Christmas present, indeed.

Cheers!
~Pete

Monday, December 15, 2008

DRAWABLEGAMECOMPONENT TEMPLATE

If you have been using XNA GS for a while now, you should know what game components are.

What is more, you should also know that thanks to the integration of XNA GS with Visual Studio, in order to add a new component you just:

  1. Go to the solution Explorer,
  2. Browse the list of projects,
  3. Right click with you mouse over the selected project,
  4. Select Add -> New Item,
  5. Choose "Game Component" from the list of available components,
  6. Click the "Add" button, and
  7. Voilá ... your new game component file is included in the project.

This is great!

Now, and again: if you've been using the XNA Framework you should know that there is a specification of the game component class for those that will be drawed to the screen: "DrawableGameComponents".

Unfortunately, if you want to create one of those components there's no shortcut, meaning either you create it by scratch or use a game component file as your source file and then modify it accordingly. In short, there is no DGC template integrated into VS, yet.

To change this, however, you could just create your own DrawableGameComponent template by going in VS to "File -> Export Tamplate", and then choosing the item you want export as a template.

After following the whole exporting process you can get and also integrate your new template to the list of items that you can pick when using VS "Add New Item" feature.

The problem with this solution is that your new template will be listed by default under the "My Templates" section of the "Add" dialog control, completely unrelated to the "XNA Game Studio 3.0" items section. Maybe you're fine with this solution generated "by default", but if you don't, then you have to tweak a little your recently generated template, change its location and one more thing that I will explain in what follows.

First, I have uploaded a class template for the drawable-game component here:

http://www.megaupload.com/es/?d=74ITZDJX

This template contains all the proper files that will helps us to better integrate it into VS.

Thus, follow whis steps:

  1. Download the above-mentioned template .zip file,
  2. Optional: open the .vstemplate file to find how the trick works,
  3. Search for the "ItemTemplates" folder in the directory where your Visual Studio 2008 version is installed, and
  4. Copy the .zip file into that folder.

Usually, the "ItemTemplates" folder is located in "%vs90comntools%\Common7\IDE", so say if you're using VS08 Standard, Pro or Team edition, you'd probaly find something like "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates".

We are almost done, now. There is just one more little procedure we must follow before reaching our goal:

  1. Go to Start -> Microsoft Visual Studio 2008 -> Tools,
  2. Open "Visual Studio 2008 Command Prompt" as an Administrator,
  3. Execute the following self-explanatory command "devenv /installvstemplates".
  4. When the command finishes, (re)open Visual Studio.

In case you're using the express version you have to browse for the folder in the start menu for that edition and, instead of typing "devenv" as stated in (3.) above you must type "VCSExpress".

If everyhing goes ok, everytime you want to add a new item template you should see something like:

Or better yet:By the way, you can use your own icon design if you don't like the one I provided in within the zip. To replace it, just delete the "old" one and include your own in the zip file, respecting the old name (that is, the name requested by the template XML file).

Well, that's pretty much it. I hope you find this useful. And yes, you can repeat this same procedure for every item template you want to include under the "XNA Game Studio 3.0" items section.

Cheers!
~Pete

Tuesday, November 25, 2008

5 DAYS LEFT FOR SUBMISSIONS

To all XNA'ers out there: only 5 days remain to submit your article(s) to Ziggyware's Fall '08 contest.

If you're still in the process of making up your mind whether to enter the compo or not, this may help: you could win an XBox 360 ELITE! And that's only the beginning.

Want to know more? Read about the prizes on this post.

Just, hurry up! The clock is ticking ...

Happy writing!
~Pete

Monday, November 24, 2008

C.N.V. UPDATE: VIDEOS

Uruguay Gamer has published the links to the videos recorded during the closing ceremony of the third annual domestic constest of videogame development held in Uruguay.

On the site you will also find the comments of Chaim Gingold for each videogame.

Note: The presenter in both videos is Gonzalo Frasca, CEO of Powerful Robot Games (one of the most-known uruguayan videogame companies) and main organizer of the compo.

Here's video 1 (the one receiving the first prize is me):

And here's video 2 (here you can see Frank Baxter -ambassador of US in Uruguay- congratulating the grand winner and at the end of the video you will find Chain Gimgold himself):

Enjoy!
Pete

Thursday, November 20, 2008

BEST 3D VIDEOGAME PROMISE

My PC game "The Riegel Battle" (created with XNA GS) has been today awarded first prize in the category "Best 3D Videogame Promise" during the third annual domestic videogame contest in Uruguay.

Even though it wasn't awarded first prize for the whole compo, as a local supporter of XNA, it was a great honor for me to be among the winners.

Along with the organizers, the contest was sponsored by the US Embassy in Uruguay, so ambassador F. Baxter was present today in the closing ceremony to congratulate the winners.

Chaim Gingold (one of the designers of the game Spore) was one of the judges, and it was also present today in the above-mentioned ceremony, not only as a judge but to speak about the design concepts behind Spore's character editor (a great talk, btw).

Here's a video of my entry:

As soon as I get the links to the official pictures of today's ceremony I'll publish them here.

Cheers!
Pete

Monday, November 17, 2008

XNA & EXTENSION METHODS 3

With this third article, I'm closing my introductory series to the world of Extension Methods and XNA.

At first, this article was meant to focus on how to extend the Random class to get new colors, but Ziggy, in his article entitled "Particles Using LINQ" -worth reading, btw- has clearly shown how to achieve this so I will take that great article as a starting point to go a bit deeper in the discussion on the matter.

If you see Ziggy's method named "RandColor" -which from now on I will refer to it as "NextColor" to be in line with the Random class, he's showing one of the new features of the XNA Framework 3: when using floats there's no need to first create a Vector3 in order to then create a Color, anymore.

In previous versions of XNA, to use floats in order to create a color, you would have declared:

public static Color NextColor(this Random rand)
{
    return new Color(new Vector3(rand.NextFloat(), rand.NextFloat(), rand.NextFloat()));
}

But from the XNA Framework 3 and on, this also works:

public static Color NextColor(this Random rand)
{
    return new Color(rand.NextFloat(), rand.NextFloat(), rand.NextFloat());
}

Now, if you see the Particle2D class in the above-mentioned article, you will notice the field named "Color", which is declared as an variable in uppercase; a new extension method could be created for it, as follows:

public static void NextColor(this Random rand, out Color color)
{
    color = new Color(rand.NextFloat(), rand.NextFloat(), rand.NextFloat());
}

Thus, we can use it within the Update method in the referred example to replace this line:

p.Color = rand.NextColor();

By this new line:

rand.NextColor(out p.Color);

Since the type Color is a struct, the advantage of using the latter over the former could be generally deemed as marginal, but eventually you may get to the situation when even the slightest improvement in your code is desired, specially when you're targeting the compact framework.

New question: what if you followed the design guidelines of C#, declaring the color field in lowercase as a private field and instead, a public getter and setter was included in that class, in the form of a public property named "Color".

In that case, the new overloaded method cannot be used since Properties and Indexers cannot be passed as out/ref parameters. Why? Well, just remember that when you're using properties and indexers you're not directly dealing with variables but methods. In that particular case, the first implementation -that is, the one included in Ziggy's article- is the best solution.

Let's face it! You could be tempted to pass the existing instance of Particle2D as "ref" to sort out the above-mentioned constraint, as follows:

public static void NextColor(this Random rand, ref Particle2D particle)
{
    particle.Color = new Color(rand.NextFloat(), rand.NextFloat(), rand.NextFloat());
}

It should compile ok BUT ONLY if you're NOT PASSING to that method the temporary variable created by a foreach loop -as opposed to the base example. This operation is just NOT ALLOWED for the iteration variables of foreach loops. My advice here is simple: avoid this tempting implementation and as I said before just use the one presented by Ziggy. Generally, the simplest solution is the correct one.

One side note: in case you're new to C#, it's important to notice that in this case we are using "ref" instead of "out", since we need an existing (that is, a non-null) instance of the class in order to assign the new color. Otherwise, by using "out" we should have to create an instance of type Particle2D from within the extension method BEFORE assigning the new color to it.

Now, let's move onto an interesting situation. What if:

  1. We are not and will be not inside a foreach loop,
  2. We don't want to expose the whole Particle2D to the extension method, and at the same time
  3. We need to use this method for as many classes that have declared setter properties for colors?

If that is the case, then you should take a look to this implementation:

public interface IColor
{
    Color Color { get; set; }
}
 
public static class HelperMethods
{
    ...
 
    public static void NextColor<T>(this Random rand, ref T instance)
        where T : class, IColor
    {
        instance.Color = new Color(rand.NextFloat(), rand.NextFloat(), rand.NextFloat());
    }
}

As you can see, we are hereby combining the power of Generics with Extension Methods.

But, why the "IColor" constraint? What we are saying here is simple: only types that implement the Color property can call this extension method. And those non-null instances passed to the method as a parameter (remember we are using the "ref" word here) will be handled as IColor types.

Ok, but why the additional "class" constraint? Tricky one. As a corollary of the previous constraint, if we do not specify that only classes are accepted as parameters, then structs can be also passed when calling the method, and for that they will have to implement the IColor interface ... Meaning? ... Tic tac tic tac ... Yeap, boxing. Ugh! That nasty word. Handling structs through interfaces causes boxing. Chilly, isn't it? Now you know it, in case you didn't.

To sum up, as you can see Extension Methods are quite handy, but you have to use them with care if you want to avoid getting into a design trap. As usual, not all the situations can be solved the same way, even though at first it sounds logic to you. You may find your-self saying "Whaaat? Buy whyyy? ...". So, I hope these examples show you what to use and when and what to avoid and why.

Some final thoughts about Extension Methods:

  1. They are great for usual tasks: believe it or not, two common types where I always find my-self repeating usual tasks are TYPE and RANDOM classes, but this feature can be used with as many types as you need,
  2. They are ituitive to use: before this functionality was introduced to the .NET Framework, one usually used to write a static class filled with helpers; please don't misundertsand me, you still have, but now those helpers are presented in a more intuitive and user-friendly way. With Extension Methods, you don't have to look for the methods "by browsing" the static class were you declared and implementem them; instead, you just look on the instances of the types you are using. And last but not least,
  3. They comply with design principles: as said in my first article in the series, we are not breaking any design principles, since we have no direct access to private members of the "extended" types.

In short, if you use Extension Methods with care and wisdom, they can be a true friend at the time of coding your XNA-based game or application: they simply help you extend any types with new methods AS IF these where originally part of those types, what in turn can be handy, for instance:

  1. When you don't want to create a specification of a class, or on the other hand,
  2. When you want to put more functionality into a sealed class somehow -to some extent, of course.

So go ahead, try Extension Methods and share what you find with the XNA Community. It would be great and fun to know what you are using them for!

Well, I hope you have found this series useful. Constructive comments and suggestions are always welcome.

Cheers!
~Pete

Monday, November 03, 2008

XNA & EXTENSION METHODS 2

Continuing with the topic of how to use the handy functionality provided by "Extension Methods" with our XNA-based creations, for this article we are going to need the "FuelCell" tutorial (remember that you shall find this tuto -along with the "TopDownShooter" one- in the help file under the "What's New In This Release" section).

Ok. In the chapter called "Finishing Touches" of the FuelCell' s tutorial, you'll find the following method at the very end of the "FuelCellGame.cs" file:

private Rectangle GetTitleSafeArea(Viewport viewport)
{
Rectangle retval = new Rectangle(viewport.X, viewport.Y, viewport.Width, viewport.Height);

#if XBOX
retval = viewport.TitleSafeArea;
#endif

return retval;
}

If you remember my last article on the subject, you'll be anticipating by now that the Viewport struct could be "extended" so as to retrieve its "unsafe" area with one method call.

If so, you guessed it right! We can use Extension Methods to declare an operation called, say "GetFullArea", and give it the proper implementation.

Not only can we pass again a parameter by reference (using the "out" reserved word) -like we did in Part 1 of this series- but also in this particular case, since we're dealing with a struct, we can afford to implement an overloaded method that locally declares, creates and returns an instance of a Rectangle (I know what you're thinking, but unfortunately, there are no "Extension Properties" in C#, so we need to get the rectangle from a method call).

Using Extension Methods, our solution should look like the following:

using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace MyNamespace.Math
{
public static class MathExtensions
{
public static void GetFullArea(this Viewport viewport, out Rectangle area)
{
area = new Rectangle(viewport.X, viewport.Y, viewport.Width, viewport.Height);
}

public static Rectangle GetFullArea(this Viewport viewport)
{
return new Rectangle(viewport.X, viewport.Y, viewport.Width, viewport.Height);
}
}
}


Now, the GetTitleSafeArea(...) method could be re-implemented like this:

private Rectangle GetTitleSafeArea(Viewport viewport)
{
Rectangle retval;

#if
XBOX
retval = viewport.TitleSafeArea;
#else
viewport.GetFullArea(out retval);
#endif

return retval;
}

Or also like this:

private Rectangle GetTitleSafeArea(Viewport viewport)
{
#if XBOX
return viewport.TitleSafeArea;
#else
return viewport.GetFullArea();
#endif
}


Remember two important things:

  • You'll have to add the proper "Using" statement in the file that will use the extension method (in my example: "MyNamespace.Math"), and
  • You'll have to manually add a reference to the "System.Core" assembly in your project.

This technique can be used to get, say -among other things, a Vector2 containing the width and height of the Viewport (as well as for the display and the client area). I leave it as an exercise for you to try (you'll see it's actually quite easy to implement).

I hope you find this article useful.

'till next time,
~Pete

XNA & EXTENSION METHODS 1

With the release of XNA GS 3, two new tutorials were included into the "What's New In This Release" section in the help file: "TopDownShooter" and "FuelCell" games. For what follows, we'll be referring to the first tutorial game: TopDownShooter.

Sometimes we need to get an instance of a sound effect without playing it. The good news is that it can be done. The bad news is that there's no built-in method provided yet to get that instance in one step.

So, what's next then? Open the AudioManager.cs file provided in the TopDownShooter example. You should find the following code on the LoadContent() method:

// We call Play silently to retrieve a specific instance we can
// use for subsequent Pause and Play calls
SeekerInstance = Seeker.Play(0, 0.75f, 0, true);
SeekerInstance.Stop();
SeekerInstance.Volume = FXVolume; // set the real volume

As you can see, the above-mentioned code gives an idea of what you should use to get the instance of a sound effect "without playing it".

But, what if we want to get that functionality in one method (as if it were provided built-in) without extending the SoundEffect class? Well, in that case since we are targeting the .NET Framework 3.5 we can use the magic of "Extension Methods".

I'm not going to explain what Extension Methods are (to get a first read on the subject, please refer to this page), but how we can take advantage of them for this particular case.

Our goal is to extend the SoundEffect class in a way that:

  1. We do not create a specification of that class,
  2. We get a new SoundEffectInstance without playing it,
  3. We do not generate unnecessary garbage when getting a new instance, and
  4. Our method runs efficiently in the .NET Compact Framework.

Thus, our solution should be the following:

  1. We'll use Extension Methods technique,
  2. We'll mimic the code of the "TopDownShooter" tutorial,
  3. We cannot declare a local reference of type SoundEffectInstance within our method, and
  4. We should pass a parameter by reference of type SoundEffectInstance that can be null.

Therefore, our final implementation should be something like this:

using System;
using Microsoft.Xna.Framework.Audio;

namespace MyNamespace.Audio
{
public static class AudioExtensions
{
private static float VolumeLevelByDefault = .5f;

public static void GetCue(this SoundEffect soundEffect, out SoundEffectInstance soundEffectInstance)
{
GetCue(soundEffect, out soundEffectInstance, VolumeLevelByDefault, 0f, 0f, false);
}

public static void GetCue(this SoundEffect soundEffect, out SoundEffectInstance soundEffectInstance, float volume, bool loop)
{
GetCue(soundEffect, out soundEffectInstance, volume, 0f, 0f, loop);
}

public static void GetCue(this SoundEffect soundEffect, out SoundEffectInstance soundEffectInstance, float volume, float pitch, float pan, bool loop)

{
// Play the sound silently and stop it immediately.
soundEffectInstance = soundEffect.Play(0f, pitch, pan, loop);
soundEffectInstance.Stop();

// Set the passed volume level.
soundEffectInstance.Volume = volume;
}
}
}

As you can see, I'm naming the static method "GetCue" but you can call it, say, "GetInstance" if you prefer. Also, since we cannot yet use optional parameters -we'll have to wait for C# 4.0 for that- you will have to create as many overloaded methods as you need.

Now, in the LoadContent() method of the AudioManager.cs file, all we should use instead is:

// Get the new instance of the seeker sound effect.
Seeker.GetCue(out SeekerInstance, FXVolume, 0.75f, 0, true);

Don't forget to add the proper "Using" statement on the AudioManager.cs, linking to the namespace where the extension method was declared and implemented (in my example "MyNamespace.Audio"), or your code won't compile.

Also, you will need to manually add a reference in your project to the "System.Core" assembly -in case it is not already referenced.


Well, this is it. Now you know how to extend the SoundEffect class to get a new instance of a sound effect in just one method call, virtually speaking ;)

One final note: by using "Extension Methods" we are not breaking any design principles, since we have no direct access to private members of the "extended" type (being the latter, in this example, the SoundEffect class).

Enjoy!
~Pete


Thursday, October 30, 2008

IS 3.0 DAY!

"Are we there, mom?". Apparently we are, according to this post.

Although the Creators' site is down and no official word has been posted on the XNA Team's blog, if you cannot wait then you can follow the direct link published on the above-mentioned post to get the download of XNA GS 3.0 Release version.

Enjoy!

Wednesday, October 29, 2008

Wednesday, October 15, 2008

CONTENT MANAGERS 101

If you have been using XNA GS for some time now, then you will know by heart the benefits of the content pipeline. If not, just to mention a few, here is a brief list for you to check before reading on this post:

  • Improves the process of importing assets to your own XNA games,
  • Faster loading times for pre-built assets (in binary format), and
  • Easy to extend for importing custom content to our XNA-based creations.

Ok, let us go on, now.

I. THE BASICS

On the process of creating your game, having built all your assets at compile time with GS you will have to use a Content Manager to load them at runtime. Fortunately, as you all may know by now, XNA already provides one for you. What is more, the game project template defines a reference and creates and instance of it on the game class.

This CM will take care of both, the loading and unloading process of pre-built assets. This means that behind the scenes, not only will it handle the instantiation of the assets being loaded but also, when properly requested, it will dispose for you the ones that can be disposed.

For loading, you will have to use a sentence like "this.Content.Load<...>(...);" or "this.Game.Content.Load<...>(...);" and the usual place to put them is inside the overriden LoadContent method of your game class and or drawable game components.

And for unloading, all you have to do is call your CM's Unload() method. Again, being a usual place to include this sentence inside the overriden UnloadContent method of your game class and or drawable game component.

II. BEHIND THE SCENES

Now, If you have been reading carefully you will notice that you can load assets individually but there is no way to unload them individually. At first you may think that this is an unpleasant restriction, but as you may conclude after reading this post -or at least, as I expect you will, this is not. In fact, it helps you manage your assets on a very tidy manner.

Generally, for the sake of performance, efficient memory allocation and best user experience, you design your game so that all the needed assets are loaded at "one time", say, at the begining of each level. So, even if you load the assets individually, that behavior from the perspective of "one-shared time bucket" -to call it some way- shows that you programmed the logic of your game to treat all these loaded assets as a cluster.

The above-mentioned rationale can be then extended to the process of unloading assets. There is no need to assume a priori that each asset will be unloaded individually at different times during gameplay. And therefore, they will be treated as a cluster, in this case during the respective level, and unloaded altogether, again, in "one-shared time bucket", when requested.

You may wonder: "Ok, but what if I want to dispose certain assets during runtime and, at the same time, to keep others in memory?". The answer to that is quite simple actually: just create more than one content manager.

We will get back to this topic in a moment, but first let us consider another important aspect of the Content Manager.

III. THINGS NOT TO DO

Avoid to manually dispose your assets!!! The CM does not like that you handle the destruction of assets by using sentences like "this.myAsset.Dispose();". In fact, the CM does NOT monitor if you do, and thus, it could and will get confused when that happens.

Let us see an example. Say you have a Screen1 and Screen2 classes and:

  1. Both share the game's CM,
  2. Both load the same pre-built texture on their respective local Texture2D fields,
  3. Screen1 is created and shown first, and
  4. Screen2 is only created and shown after Screen1 is manually disposed.

If Screen1 manually disposes the texture (either using the Dispose Pattern or by calling Dispose within the UnloadContent method) without calling "this.Game.Content.Unload();" first, when Screen2 tries to draw the texture on screen you will get an exception stating that the texture has being disposed, even if Screen2 loaded that texture. As I told you before, the CM gets confused with situations like this.


Therefore, avoid these implementations:


protected override void
Dispose(bool disposing)
{
if (disposing)
{
if (this._myTexture != null)
{
this._myTexture.Dispose();
this._myTexture = null;
}
}

base.Dispose(disposing);
}


... and ...


protected override void
UnloadContent()
{
if (this._myTexture != null)
{
this._myTexture.Dispose();
this._myTexture = null;
}

base.UnloadContent();
}


Being the proper way to unload assets:


protected override void
UnloadContent()
{
this.Game.Content.Unload(); // Or the CM you use.

base.UnloadContent();
}


Please notice that this is also allowed by the CM:


protected override void
Dispose(bool disposing)
{
base.Dispose(disposing);

if (disposing)
{
if (this._myTexture != null)
{
this._myTexture.Dispose();
this._myTexture = null;
}
}
}

protected override void UnloadContent()
{
this.Game.Content.Unload(); // Or the CM you use.

base.UnloadContent();
}


Comply with the above, and you will do good.

IV. THINGS TO DO

Getting back to the question of how to unload assets at different times at runtime, there is one practice that will help us understand why it is sound and thus, advisable, to have more than one CM in our XNA-based games.

When you create a program you declare global variables and local variables. This common practice incorporated to our daily programming tasks is the key that will then leads us to think of global and local assets.

You may consider an asset "global" if its lifetime lasts across all the game, or at least, most of it. In this sense, assets should be deem as "local" instead if it is expected and intended to unload them once a stage in the game has finished but the game has not and will not, at least for a while more.

Thus, when creating your game, use:
1) A Content Manager for "global" assets: the one instantiated by default within the Game class (which you can access using the Content property), and
2) One (or more) Content Manager(s) for "local" assets: say one content manager per level, per screen, or per whatever category that fits your game's design.

Again, group your assets in clusters based on lifetime, and you will know which one is global and which ones are locals. If all your screens will use one spritefont in common, then there is no reason to load and unload it for every screen; just load it once and hold it in the collection of global assets. If a ship model will be used in only one level, handle it locally to that level.

As you can see, using more than one Content Manager is a sound practice: easier to apply, easier to debug, easier to mantain and easier to extend.

Sometimes there is no need to have more than one CM for all the game, depending on the game of course, but still it is a good practice to know and get accustomed to, since in the end it helps us manage our assets at runtime in a more tidy and convenient manner.

So, my recommendation is: get used to it. The sooner, the better.

V. CONCLUSION

The Content Pipeline is a great tool to import assets to our XNA-based games which is complemented with the proper manager to handle that content at runtime: the ContentManager class.

By using instances of this class wise and properly, we could get (more) efficience in the fields of implementation, debugging, mantainability and extensibility.

In order to achieve this goal certain practices must be applied:

  1. Use one instance of the ContentManager class for global assets,
  2. Use at least one instance of the ContentManager class for local assets, and
  3. Do not manually dispose assets; instead, call the Unload() method of the CM.

I hope you find this post useful. Comments and suggestions are welcome.

Cheers!
~Pete

Tuesday, October 14, 2008

IT'S OFFICIAL!

We have an official release date!

The XNA Team has announced that the final version of XNA GS 3 will be out this October, 30th. Read the announcement here.

The wait is almost over.

Cheers!
~Pete

ZIGGYWARE'S CONTEST UPDATE

Head over Ziggyware's XNA Article Contest site since new prizes have been announced today!

Wireless headset, extra wireless controller, Milkshape 3D licenses ... read it from the source page.

~Pete

Sunday, October 12, 2008

NEW XNA ARTICLE CONTEST AT ZIGGYWARE

Ok, guys. Ziggy's raising the bar of prizes.

The new "Ziggyware Fall 2008 XNA Article Contest" gives away an XBox 360 Elite for the first price!!! And, as it also comes with a one-year suscription to the XNA Creators Club, the winner will have no excuses to produce a game with XNA GS for the 360 platform.

Simply put: Amazing!

Now, what do you have to submit? As usual, write and submit an XNA related tutorial for XNA developers. No ideas? Don't worry. There's plenty of examples to read on.

So, go ahead: read the rules, make your questions on the forums, put together your ideas, write them down, submit your article and that's it! You could become an "Elite" member of the 360 community at the end of the contest.

Happy writing!
~Pete

Thursday, October 02, 2008

XNA GS CONNECT UPDATE

In preparation to the extreme makeover that the 360's Dashboard will experience later this year, Michael Klucher has announced a new version of XNA Game Studio Connect.

This version will allow us to also run XNA Framework 3.0 games. So, this is a perfect time to start porting our projects to XNA 3.0, don't you think?

Head over Michael's site to know how to get the upgrade, which is a manual process.

'till next time,
~Pete

UNOFFICIAL SAMPLES FOR XNA 3 BETA

Hey folks!

Since the moment the CTP was out I spent some time to update all the samples available on the creators site to that early version of XNA 3.0, for my-own use.

Then, when the beta was published, and taking into account that maybe we will see no big changes to it until the final release, I decided to recreate them -complying with the license terms and conditions- so that I can publish them on the Web for those who eventually need them.

One important note: these files are NOT official so use them at your own risk!!! Otherwise, you can wait till 3.0 final gets released and thus, for the official education files.

The only changes in the code that you will see are those related to the 2D projects that used the WrapAngle method (created in the same class that used it). Instead, MathHelper.WrapAngle(...) is now in place. And ... yes! I almost forgot: each zip file contains a Windows-only project.

Well, here they go (hold on to something):

First Wave:

Second Wave:

Yes! Third Wave:
I think ... This Is The Fourth Wave (?)
Ok. Who Am I? And Why Am I Typing This?
No, Seriously ... (Why The Heck Am I Doing This?)
Phewww! At last, I finished ... man, I stopped counting after the first 20 links.

Well, I'm done, so in case you're using XNA 3.0 beta, I hope you find them useful.

Cheers!
~Pete

BLOGGING AGAIN!

Wow! It's been a while since my last post here. The reason: getting my life back to normal after my visit to Seattle/Vancouver.

A lot has happened since my last post. I'm still creating my own engine with XNA 3.0 (the latter is now out in beta), I submitted my demo game for the DBP compo, and we witnessed how a "ninja cat" approaches.

About my entry, well, it was created in 10 days ... the last 10 days before the submission deadline! I'm proud of the result but not proud at all about the code ... that implementation goes against of all my believes and practices in software design. But, it had to be done on time no matter what if I wanted to enter the compo. Why did I start so late? Well, that's a loooong story (maybe I'll blog about it some other time).

Man! There's a lot of great entries this year that really show off the power of XNA. If you want to take a look at them just go to http://video.msn.com/ and search for videos tagged, say, DBP? ... or "Dream Build Play", thanks Lawrence ;)

My favorites are ... well, I'll let you know after the results are in :-D

Ok, I think that's it for now but stay tuned since more is comming next!

Saturday, August 09, 2008

BACK HOME

Yeap, after two weeks abroad, my wife and I got finally back home.

Visiting Vancouver for the first time has been a great experience for us. The city is great and people seem not to know the word "stress". The only minus, at least for us: everything is expensive there. But, what the heck, we were on vacation ...

Seattle's gamefest: as I said in my previous post, a great experience. The talks were very instructive. Sometimes it was hard to pick the ones to attend, but I'm not omnipresent, right? In this sense, I hardly walked around the city, but at least "I've been in the Space Needle".

Overall, some quality time. I hope to repeat it next year.

Cheers!

Wednesday, July 23, 2008

THE GAMEFEST HAS BEEN GREAT SO FAR

Oh man, I'm really excited of having travelled this far to get to Seattle's Gamefest.

I've been talking with many different people (peers, MSFties, MS partners, exhibitors, etc.), giving and collecting cards like crazy, and played a lot of games. In short, having a really quality time.

In this sense, meeting the guys behind XNA GS have been really nice: Shawn, Eli, Michael, and the rest of the guys. Also cool Xna'ers like Chad Carter, Bill Reiss, and of course, "old" XNA'ers (and ex-MSFTies) like TheZMan (Andy).

Also it has been a great opportunity to discuss some crazy ideas and techniques that I have and of course want to implement in the near future, and believe me when I say that the feedback has been encouraging (thanks Shawn).

The talks have been quite handy. Lots of techniques, upcoming features, relevant information, and of course: the yummy 70% that we "indies" could get if we reach the next phase with our games.

So, guys, tomorrow I'll be returning to Vancouver with my wife and sister, so maybe I can post more comments about the conference.

Opps. Have to go. The next talk is starting.

See ya.

Sunday, July 20, 2008

MY FIRST DAY IN VANCOUVER ...

... Well, actually in Canada.

My wife and I are visiting my sister and brother-in-law who both live in Vancouver, BC. After 30 hours of flights we finally got to Seattle where they were waiting for us. Then we have like 4 more hours to travel by car until we finally got to Vancouver.

All our flights were delayed with the exception of the first one, so we had to wait ... we missed one local flight in the US ... we were rebooked by the company ... more wait ... lost our luggage in one of the connecting flights ... finally found it on destination on the baggage claim, you know ... the usual stuff with long-international flights.

In the end, it was an interesting experience, specially for my wife, since it is the first time she leaves the Southamerican continent. For me, I have travelled around the world so I'm accustomed to deal with delays, connections, baggage, etc. Actually, I kinda missed it.

Next monday, I'm going to Seattle and attend the Gamefest for the first time. I'm really excited.

So guys I hope to meet you there.

Tuesday, May 13, 2008

VS 2008 & .NET 3.5 SP 1 BETA RELEASES

I was reading Scott Guthried's blog this morning so I found a great surprise: the first Service Pack beta release for both, Visual Studio 2008 and .NET Framework 3.5 is out.

One of the things that amazed me while reading through the new features we'll find in the final release has the following title: "WPF Interoperability with Direct3D".

But why does this means a lot to me -or should mean a lot to us XNA-based game developers?

If you ever attempted to integrate a D3D-based game/application into a WPF-based project, you may know that one of the hard burdens to surpass to get that job done is called "Airspace", a strict rule that prevents both type of applications to co-exist in the same region of the screen, at least without a simple solution.

And I say simple here because to "bend" this rule a little bit to make the user believe that a real integration exists -meaning, as if there was not Airspace at all in the first place- either you had to use a decorator-pattern-based implementation or a solution where you intercept all windows messages in order to "bake" all pixels rendered by D3D into an image that can be later used by any WPF control ... if you want to know more about this rule and or get one of these solutions or both of them just do a simple Internet search with the words "DirectX WPF Airspace" :)

Well, as this is becoming a built-in feature now, it means that we can stop worrying about finding or choosing the optimum way to integrate D3D and WPF, what in turn means that we don't have to constraint our D3D-based projects to WinForms controls anymore and thus we can let our imagination fly to create a rock-solid kicking @$$ game-level editor using WPF and XNA -specially now that GS 3 integrates into VS2008.

Really great news ... although we have to wait a bit more to get our hands on this feature until the final SP is released ... :)

Cheers!
Pete

Tuesday, April 01, 2008

HAVING DRIVER PROBLEMS WITH 64-BIT VISTA?

I have received today a newsletter from CNET.com with a list of programs to watch during this year 2008.

To my surprise one of the programs -called "Magic 64-Bit Vista Wonderland"- claims to solve all driver-incompatibility issues with 64-Bit Vista OS.

My version of Vista is 32-bit, however, I decided to post a link to the program for those of you who need to resolve driver issues. The file is free to download and only 11k! C'mon ...

... Btw, use it at your own risk!

[!ekoj s'loof lirpA na si siht :gninraW]

Wednesday, March 05, 2008

NOT THAT EMPTY ...

There's a great series of articles regarding game development with XNA being posted at this blog: "Running on Empty".

So far, 16 out of 25 articles have been posted covering a lot of aspects of game development both, in theory and in practice, not only to get started but also to help you implement advanced features such as "physics".

But the best is yet to come since the remaining articles will cover more advanced topics like "parallel split shadow mapping", deferred shading and "split space ambiet occlusion".

Happy reading!

Wednesday, February 27, 2008

MEET ME AT THE SAVOY

Hi guys!

As you may know the pictures of each of the three winners of The Code Project's VS 2008 Compo (sponsored by Microsoft - Defy All Challenges) are being cyclically shown on the "Defy All Challenges" site.

I guess now it's my turn to appear on the site (finally!): http://www.visualstudio2008.defyallchallenges.com/.

Cheers!

Saturday, February 23, 2008

WHAT'S THE MEANING OF "XNA"?

Interesting question ... if you are taking a long brake with a cup of coffe or a beer on your hand as well as allowing your eyesight to go out the window into deep space (I mean both "windows", your computer's OS and your office/home's one).

A couple of days ago I watched "The Da Vinci Code" on DVD and some "late nights" ago -given that I was sleepless- a rerun of "2001: Space Odyssey" on Cable, so as you can guess I soon remembered the meaning behind "HAL" -the computer of the ship- that some guys used to argue. What is worse and sad, I suddenly started to look for patterns in almost everything: "23, 23, ...".

With the recent announcements that we can create games for Zune, and being mainly influenced by the first-mentioned film above, I started to think over the meaning of the word "XNA", if any.

I know it has been officially claimed that there is no real meaning behind the 3 letters, but WHAT IF those letters resulted from other 3 letters ... (?)

Following this crazy idea I played around a few minutes "shifting" the letters a couple of places back and forward and hereunder you will find what I got:

V W X Y Z
L M N O P
Y Z A B C

I don't have a clue what "VLY" and "YOB" could stand for, but let's take a look at the remaining two arrangements:

  1. WMZ : "Windows Mobile Zune", and my favorite
  2. ZPC : "Zune PC Console".
Now, which platforms will XNA be officially supporting on this mid-to-yearend 2008? ... wait ... processing ... wait ... got it! ... Yeap ... Windows (PC), XBox360 (Console) and Zune (errr ... Zune?) ... XNA sounds way better than WMZ and or ZPC.

Coincidence? Maybe ... :)

Watch this space!

[I know I have lost my mind but you still have a way out ... just avoid the combo of films: "The Da Vinci Code" and "2001". Don't worry, better posts are coming soon. I promise!]

Thursday, February 21, 2008

XNA GS 3: THE LUCKY NUMBER!

Being an old timer, it's incredible to see how fascinating the world of XNA is moving ahead. Since Managed DX first appeared, there also appeared the first steps of a big company to introduce C#, and managed code in general, into the game-development industry.

After all the uncertainty around the future of managed code in games when the doom of MDX 2 was unveiled -specially for all us who had embraced c# and MDX for our game projects, a new word started to being rumored with higher and higher strength: XNA.

Since the first beta of XNA GS was released, this baby has been growing up at a steady and solid pace. In fact, with this recent great announcement, MS has confirmed that is betting a hugh stake on the project and if you ask me, it's a winner bet. Other big companies are trying to copycat the idea, but they aren't moving that fast and that well, plus they're still attached to C++ ... and I love C#!

Being an indie, knowing that in a few months I'll have the possibility to sell my games for the XBox 360 as well as produce games for Zune is really exciting. It's very difficult and expensive to make a game project to reach the "going gold" phase, and MS way may prove to be an affordable means to show off our creations, get a contract with a publisher and why not, directly sell our games with an interesting profit, why not?

I don't know about you, but I was waiting to hear (or read) something like this all these years. Thumbs up for the XNA Team! Way to go ...

Cheers!

Monday, January 14, 2008

KUDOS FOR THE WINNERS!

The winners of The Code Project's "Visual Studio 2008 Competition" have been announced:
  1. Legion : Build your own virtual super computer with Silverlight by Daniel Vaughan, and
  2. Silverlight 1.1 Fun and Games by Sacha Barber.

In addition to the prizes for finalists, these guys will receive $10k and $2k, respectively.

Congrats guys!

Monday, January 07, 2008

MY ARTICLE IS ON THE FINALS!!!

Someone pinch me please since I must be dreaming ... I made it into the finals !!!

I would like to thank all the readers that supported my article "XNA & Beyond: The Path To VS 2008". I really appreciate your comments, your messages and your votes.

Also, thanks a lot to the judges for picking my article and of course, The Code Project team. I cannot express in words how happy I am, but trust me when I say this emotion is huge.

And what can I comment about Visual Studio 2008? Best of the best ... it rules!

Finally, I would like to thank the XNA Team for giving us this incredible framework that is getting better and better as we speak: XNA Game Studio.

Well, I don't know whether I'll get beyond this nomination to the finals, but having reached this far gives me renewed energy to keep on writing articles.

Happy new year 2008 everybody!!! This is a great way for me to start the year :)

Cheers!
Pete