What is it?

It's an Xbox Live-style acheivement toast (popup) that you can use in your XNA game. It does not alter your GamerTag acheivement points or in any way integrate with your XBox Live experience - but it is cool. Here, take a look:

AcheivementToast-001.jpg
Video at http://www.youtube.com/watch?v=OTJ1wlqLLeQ
Note: Imagine I spelled 'Acheivement' properly and you'll enjoy the above screenshot much more...

How do I add it to my game?

The code is packaged as a DrawableGameComponent which you must add to your Game object. The draw order must be set high enough to draw on top of your other game stuff. See the code snippet below on how to instantiate and load the AcheivementToast class for your game.... (Normal stuff omitted)
internal sealed class TestGame : Game
{
    // Private variables
    private readonly Toast _toast;

    private TestGame()
    {
        this._graphics = new GraphicsDeviceManager(this);

        // Add the toast component
        this._toast = new AcheivementToast(this);
        this.Components.Add(this._toast);

        // Set the draw order
        this._toast.DrawOrder = 20;

        // This draws an initial toast, just for fun...
        this._toast.Enqueue("GamerTag signed in", "(Not really....)");
    }
}

How can I add it to my game?

There is no installer for my GameFx component, but it has source and precompiled downloads - see https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=johnnylightbulb&ReleaseId=8160 So go get the code, graphics, and XACT files and add them to your game. Note, however, that the Acheivement Unlocked.wav file was released by Major Nelson with a 'not for commercial use' tag line, and I found some logo images from Google images that you will not be able to use verbatim if you want to sell your game with this component. The other graphics, however, such as the neato background colored/glowing player rings/and animations are completely mine - so you can do whatever you want with them.

Get the complete source code and graphics here: http://www.codeplex.com/johnnylightbulb/SourceControl/DirectoryView.aspx?SourcePath=%24%2fjohnnylightbulb%2fJohnWells.GameFx&changeSetId=7203

What's the status on the source code?

The AcheivementToast class inherits from the Toast class, which uses Animation.Controller and Animation.Sequence classes I wrote. I think they're pretty nifty, but are certainly overkill for the need. I had intially written the entire animation/fade/fold thing as a bunch of if's and it only took 300 lines. I expanded and created the Controller/Sequence thing and I'm surely past 1000 lines now, but it's slightly more flexible. Really, what this thing needs is some sort of Silverlight/Flash for XNA project to really get it done right. Something that can let you design in some external environment and run from within XNA - which is kind of where I was going.

Anyways, the code is stable and fast and should be more than usable as-is, and who knows, you may even wish to customize it if you want. For now I'll put a release-candidate label on the GameFx library as I don't know of any troubles, but if there are just drop by the discussion board.

Last edited Nov 4, 2007 at 3:41 PM by Johnnylightbulb, version 7

Comments

No comments yet.