Monday, February 05, 2007

XNA project names

if you've been playing around with XNA projects, you may have found that it can be surprisingly tricky to change the name that is displayed in the "My XNA Games" screen.

the trick is that the name is stored in the Assembly Information of the project. to change the name, go to the Project Properties screen and the click the "Assembly Information" button. this will open the Assembly Information window.


- Assembly Information window

Monday, January 29, 2007

youtube loses value under google

when Wired magazine recently highlighted Google's acquisition of YouTube, they made an admirable effort to try and explain the 1.65 billion dollar beating that Google accepted for the deal. the article YouTube vs. Boob Tube effectively mentioned a number of YouTube's hits. for example, the evolution of dance, and Noah takes a photo of himself every day for 6 years.

undoubtedly, these videos are great, but there's a problem. of the best videos that Wired could find a few of them are already gone.

even Wired's links to the afformentioned value-add videos are not immune; the first embedded video in the article has been removed "due to terms of use violation." I'm not even sure what they were trying to show me.

Thursday, January 25, 2007

XNA beta code migration

these are some quick and dirty notes on migrating XNA GSE beta code to GSE V 1.0.

when you are migrating, refer to the XNA GSE documentation (in the Programs folder for GSE). the migration information is under Getting Started with XNA Game Studio Express -> Migrating from Beta 1 to Beta 2 (see below). this information also applies to the release version.

-------------------
GameTime
-------------------
double dblMS = (double)this.GameTime.Milliseconds;

becomes:

GameTime gameTime = new GameTime();
double dblMS = (double)gameTime.ElapsedGameTime.Milliseconds;

-------------------
loading Texture2D
-------------------
mTex2DSprite = Texture2D.FromFile(this.gfx.GraphicsDevice, @"..\..\light.dds");

becomes:

mTex2DSprite = content.Load(@"..\..\light") as Texture2D;

-------------------
VertexPositionColorTexture
-------------------
VertexPositionColorTexture parameters are in a different order

mVertSprite[0] = new VertexPositionColorTexture(pos, uv, Color.White);

becomes:

mVertSprite[0] = new VertexPositionColorTexture(pos, Color.White, uv);

-------------------
DrawUserPrimitives
-------------------
gfx.GraphicsDevice.DrawUserPrimitives
(PrimitiveType.TriangleStrip, // triangle strips
2, // two primitive objects
mVertSprite); // use sprite vertex

becomes:

gfx.GraphicsDevice.DrawUserPrimitives
(PrimitiveType.TriangleStrip, // triangle strips
mVertSprite, // use sprite vertex
0, // vertex offset
2); // two primitive objects

-------------------
EffectStateOptions
-------------------
EffectStateOptions is gone

mfxTex.Begin(EffectStateOptions.Default);

becomes:

mfxTex.Begin();
-------------------

from the documentation:

Migrating a Beta 1 project to Beta 2
"Create a new project by selecting New Project... from the File menu. Select Windows Game, name your new project, and click OK.

Add classes from your old project to your new project by selecting Add Existing Item... from the Project menu. Navigate to your Beta 1 project, select the class or classes to import, and click OK.
Add resources from your old project to your new project also by selecting Add Existing Item... and choosing Content Pipeline Files from the Files of type: drop-down box. You can select models, textures, effects and sounds to add to your project. See "Importing a resource into the Content Pipeline" below for more information.

Migrate code from your old project's Game1 class to your new project's Game1 class, including your Update and Draw methods. Use LoadGraphicsContent to load automatic and manual resources (note: "automatic" was called "managed" in Beta 1).

The Game Designer from Beta 1 does not exist in Beta 2. Use the Game constructor to set properties on the GraphicsDeviceManager (formerly GraphicsComponent).

Some code changes will be required before your Beta 1 code will compile properly in Beta 2. See "Framework Changes" below for a list of some of those changes. "

other resources:

Migrating an XNA Application from Beta 1 to Beta 2

Thursday, January 11, 2007

pimps at sea invite

one of my oh-so-hilarious former microsoft colleagues just sent me an Xbox 360 invite to play Pimps at Sea (Alpha) - which, of course, is Halo 3.

and, of course, I don't have a copy of the Halo 3 Alpha DVD.


jerk!

Wednesday, January 10, 2007

microsoft bob lives

thanks to the miracle of Virtual PC, I am able to run the Microsoft Bob operating system. here are some screenshots (click images for full-size versions).

this UI was meant to revolutionize the OS business, but it fell flat on its cute puppy face. you may notice though, that the dog survived. you can find him in Windows XP.


- the Microsoft Bob OS sign in screen

the idea for Microsoft Bob was that you click on the picture that represents that task that you want to do. want to call someone? click on the phone.


- the main room in the OS

there is even a Microsoft Bob box in the company museum. within Microsoft culture, the project has become the archetype of failure.


- how deep was this mouse hole?

Wednesday, January 03, 2007

my kittens hate nazis

lucky guy that I am, santa brought me a copy of call of duty 3 this Christmas. here's my sob story for the day.

being a fan of the xbox 360 achievements, I've been working through some of them. today I was trying for the close combatant award which requires that you finish a mission without firing a shot - only melee attacks and grenades are allowed. I was on the last checkpoint and about to launch into the final assault when one of my cats nuzzled up to the controller and managed to press the trigger. my rifle fired and that was it for my hard work; I had to start again from the beginning. :(

I guess she was just too eager to get into the fight.

Thursday, December 21, 2006

showing a bitmap in XNA

I've seen some crazy complicated samples online for something that should be very simple - showing a bitmap in XNA. I even found one article that suggested using pointers. ha!

here's the simple version that I used to show augmented reality markers on my TV. unfortunately, it seems that the TV scan line is going to prevent this from actually working as an AR demo.

#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
#endregion

namespace Xbox360Game1
{
public class Game1 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
ContentManager content;

//Added for bitmap
public static Texture2D SpriteTexture;
public static SpriteBatch SpriteBatch;
public Point Velocity;
public Point Location;
public Point Size;

public Game1()
{
graphics = new GraphicsDeviceManager(this);
content = new ContentManager(Services);
}

protected override void Initialize()
{
base.Initialize();

//Added for bitmap
SpriteBatch = new SpriteBatch(this.graphics.GraphicsDevice);
}

protected override void LoadGraphicsContent(bool loadAllContent)
{
if (loadAllContent)
{

//Added for bitmap
SpriteTexture = content.Load("base0_128");

}

base.LoadGraphicsContent(loadAllContent);
}

protected override void UnloadGraphicsContent(bool unloadAllContent)
{
if (unloadAllContent == true)
{
content.Unload();
}
base.UnloadGraphicsContent(unloadAllContent);
}

protected override void Update(GameTime gameTime)
{
// Allows the default game to exit on Xbox 360 and Windows
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();
base.Update(gameTime);
}

protected override void Draw(GameTime gameTime)
{
graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

//Added for bitmap
Location.X = 100;
Location.Y = 100;
Size.X = 512;
Size.Y = 512;
Game1.SpriteBatch.Begin();
Game1.SpriteBatch.Draw(Game1.SpriteTexture, new Rectangle(Location.X, Location.Y, Size.X, Size.Y), Color.White);
Game1.SpriteBatch.End();

base.Draw(gameTime);
}
}
}

Wednesday, December 20, 2006

'Canada's Best' books

has anyone else seen the "Canada's Best" list that Chapters compiled?

they asked 150,000 irewards members to list their favourite Canadian books of all time (both fiction and non-fiction). however, this is a bit misleading since they don't actually say what the resultant sample size was.

it's clear to me that the entries are heavily biased towards books that were published in the last few years. for example, jPod (#11) is listed ahead of Microserfs (#58). I have a hard time seeing how that could happen unless the people who voted for jPod haven't read Microserfs.


also, some of the best books are clearly missing from the list. for example, Whale Music by Paul Quarrington should obviously be included.

BTW - two authors have ten books each in the list of 100 books: Atwood and Coupland.

here are my favourite book lists:
favourite geek books
favourite fiction books

Wednesday, December 13, 2006

debug xbox 360 without xbox?

it didn't take long for me to realize that the GSE XNA xbox 360 project forces a deployment to the xbox 360 when you debug or build. so how do you work on your xbox 360 game when you're in the coffee shop?

there doesn't seem to be any way to disable the deployment, so - unless you take your xbox with you - it's a bit of an issue. even adding Any CPU as an additional platform in the configuration manager didn't work. I found a forum post about debugging without the xbox 360, and it seems that the current solution is a bit of a hack:

"You can start a new Windows Game and link all the files from the 360 project. It would probably take about 30 seconds to set up. After you create the Windows Game project, right click on the project in the Solution Explorer, select Add Existing Item, select all the files in the dialog, click the arrow on the Add button and select Add As Link. Any changes made in either project will be reflected in the other."

there is a second solution in the post (manually altering the project file), but it isn't recommended.

Monday, December 11, 2006

xbox creators club live!

the xbox 360 creators club is up and running. this option allows game developers to use the XNA game development platform to create and run xbox 360 games.

although the game studio express (GSE) dev environment is free, the creators club requires an xbox live subscription and a creators club membership.

refer to the XNA blog (and the GSE docs) for details about setup. once you have everything installed, you can connect your xbox 360 to your pc and begin to work your magic.

this screenshot shows an xbox 360 project deployed and running on an xbox 360. the project is running in debug mode and a breakpoint has been hit - all while still listening to the iPod connected to the 360... nice.


- debugging an xbox 360 project - click for full-size version

Wednesday, November 29, 2006

vs.net cross language debugging

the attached image shows a solution with an unmanaged C++ wrapper (for a C++ .lib) and a C# application project.

whilst debugging, you can cross the language barrier and debug into both projects. in the attached screen, a breakpoint in C++ is being hit, but the application running is the C# app. cool hey!


- C++ breakpoint hit while debugging C# project

of course, this is all old news, the actual reason for this post is debugging issues with this sort of debugging.

the most common error is: "The breakpoint will not currently be hit. No symbols have been loaded for this document".

first steps from a newsgroup post:

1. Verify that you are in debug mode and not release mode.
2. Verify that the timestamp of the .pdb file is the same as the .dll or .exe that you're generating. If they are not, remove all of the binaries
and recompile your entire solution.
3. If the additional assemblies you are trying to debug are not part of your solution (i.e. other projects), go under the properties for the solution and be sure to include the "Debug Source Files" and "Debug Symbol Files" locations of the additional assemblies you're trying to debug.

despite all of this, when I started debugging, everything worked fine in the C# code, but the breakpoints in the CPP files show "No symbols have been loaded for this document." When I look at the modules, the status for the CPP DLL is "Symbols loaded." but there is an exclamation mark and the error "The module did not load at the default load address."

I was running in debug mode for both projects. I tried rebooting. I tried deleting all the debug files and rebuilding. and I also tried the steps in this help doc: How to: Debug in Mixed Mode.
this included adding /ASSEMBLYDEBUG to the native DLL project - I also tried w/out this statement.

I tried changing the debug build dir for the C++ project to be the debug dir of the C# project, but that didn't help.

it turned out that my issue was with my function import. I had the wrong entry point specified, so the code wasn't being called properly. why this problem manifested as it did, I don't know. I get the same behaviour as before (e.g. the breakpoints are still inactive at first), but when the debugger gets to the CPP files with breakpoints, they work.

the rest is from the article: How to: Debug in Mixed Mode

"The following procedures describe how to debug both managed and native code, also known as mixed-mode debugging. There are two scenarios for doing so, depending on whether the DLL or the application is written in native code:

The calling application that calls your DLL is written in native code. In this case your DLL is managed, and both managed and native debuggers must be enabled to debug both. You can check this in the Property Pages dialog box. How you do this depends on whether you start debugging from the DLL project or the calling application project.

The calling application that calls your DLL is written in managed code and your DLL is written in native code.

Note
The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To enable mixed-mode debugging in a native EXE calling a managed DLL
In Solution Explorer, select the project. On the View menu, click Property Pages. In the Property Pages dialog box, expand the Configuration Properties node, and then select Debugging. Set Debugger Type to Mixed or Auto.

To enable mixed-mode debugging in a managed EXE calling a native DLL
In Solution Explorer, select the project. On the View menu, click Property Pages. In the Properties Pages, click the Debug tab. Under the Enable Debuggers group, select the Enable unmanaged code debugging check box.

Note
For the debugger to attach to code written in C++, the code needs to emit DebuggableAttribute. You can add this to your code automatically by linking with the /ASSEMBLYDEBUG (Add DebuggableAttribute) linker option."

Monday, November 27, 2006

st john water polo

this weekend, I played in a water polo tournament in st john, new brunswick. I play for dalhousie university (in halifax, nova scotia); we were playing against teams from st john and tracadie.


- a nice offensive foul in the hole


- yes, it's a rough game :)

truly canadian road sign

this sign is in fredericton, new brunswick. it must be the most canadian sign on the planet.



- no left turn to tims

Wednesday, November 22, 2006

Fatal error cannot open LIBC

When migrating Visual Studio projects from VS 2003 to VS 2005, I encountered the error:
Fatal error cannot open "LIBC".

I thought I'd post the solution to make it easier for others to find.

To remove the error, navigate to Configuration Properties -> Linker -> Input. Then, add "libc" or "lib.lib" under Ignore specific library. In earlier versions of VS it was set to libc.lib.

I found the reference on this page about migration issues: Migrating to Visual Studio 2005

Wednesday, November 15, 2006

quick update

wow, how time flies. I haven't written anything here in ages. the reason for this is simple. I'm working hard on the augmented reality book for pragmatic, and I have also started on a new project that will be announced soon.

Monday, October 30, 2006

xbox 360 mods banned?

it looks like ms has been banning people for using mod chips on their xbox 360s. they are doing this because, at this time, the only reason to use the 360 mod chips is to play illegal copies of games or remove the region protection so that one can run games from other regions.

this has nothing to do with modding actual games. modding games - as I've written way too many times - is great as long as you're not doing it to cheat. any chance I get, I'll remind everyone that modding is not the same as cheating! if you go on xbox live and play a mod, then hell ya - you're cheating. but that's not what most good modders are doing.

many modders are out there creating cool mods that they enjoy on their own LANs. i.e. when everyone knows that they're playing a mod. they're not trying to level up like a wuss or play an illegal copy of fusion frenzy.

Saturday, October 28, 2006

halo 3 info coming

go to 1up.com for impending info. about halo 3.

they aren't giving out much info. yet, but they did let slip that the mongoose is back and there will be a new type of grenade called the spike.

Wednesday, October 18, 2006

schools ban tag

this topic is way off my regular routine, but it's just so ridiculous that I can't resist. some schools in the US are banning tag and other "contact sports" during recess. although this story makes me shake my head, I've seen this sort of logic applied to university students - more about that in a second.

first of all, calling tag a "contact sport" is enough to show the lack of logic in these bans. the people responsible say that they have made these decisions in the name of safety. I used to work with young children, and I used to lifeguard. no matter what you do, kids will still fall down and get bumps and bruises. the plain truth is that kids get hurt - they get hurt a lot. BTW - when I was growing up, I saw far more injuries in gym class than I saw during recess.

personally, I agree with the idea that kids need to learn how to play safely together. as Manhattanville College education professor, Rhonda Clements said, through play "They learn to change and to problem-solve." as for the argument that unsupervised kids can't be trusted to resist the temptation to resort to full contact, I have two points to make:

1. my understanding is that all schools have some sort of supervision during recess. so it's not true to say that the children aren't supervised at all. if there are schools out there that have no supervision during recess, then that should be addressed. kids need to be protected from the outside world far more than they need to be protected from one another.

2. if this is really a move to curtail bullying, then it should be dealt with properly. don't punish all of the kids because of the bullies.

now onto the university example. while working at a residence advisor, I was unfortunate enough to be working when the administration decided to enforce a ridiculous student party policy. at the residence in question, party organizers were already obliged to fill out paperwork and ask for permission before they could host a party - after the rule change, things crossed the line of reason. one of the new rules was that no more than 25 people could attend a party at any time. that's 25 people out of a house of about 200 and a residence of over 1100.

the new rules had one effect, the parties moved off residence grounds. and maybe that was the point all along. if the party isn't at the residence, then the administration isn't responsible for what happens there.

in other words, let the kids play somewhere else.

Monday, October 16, 2006

Xbox 360 saved my iPod

as with many other first generation iPod owners, I find that my device is pretty much useless unless it is plugged in. there is a flaw that has significantly limited the battery life. this problem is so prevalent that a successful class action suit was launched against apple - although they are trying to weasel out of paying my settlement.

but then along came the Xbox 360 and its out of the box support for iPods and other music sources. all I had to do was plug my iPod into one of the Xbox 360's USB ports and presto! I actually have a use for my iPod. it's now a fixture in the living room - not exactly what they had in mind when they made it, but it works.

despite the great press, there were other issues with the original iPods, and some of them have been addressed. for example, it used to be that the "On The Go" playlist was erased every time you connected your iPod to iTunes - now that was annoying. but it was fixed fairly quickly. other problems have not been addressed. a good example is gapless playback. I doubt this occurs on the solid state iPods, but if you have a hard drive version, you probably know what I'm talking about. there is an almost inexplicable delay as the iPod searches the hard drive for the next song. there is even an online petition to try to convince apple to add this feature. issues like this are the reason why I bought a creative MuVo for running. the MuVo is great, and the fact that it stills works after I accidentally ran it through a wash cycle, makes me even happier that I bought it.

microsoft is about to launch the zune portable media player to compete with the iPod. lots of people have said - in a knee-jerk fashion - that microsoft is wasting their time, that there is no way that they can compete with the iPod. well I tend to agree with one dimension of those statements, it will be tough to compete with the almost religious fervor that surrounds the iPod. I'll admit that I was disappointed by the original iPod. other than the size of the drive, I didn't think that it was as useful as my 1998 diamond Rio.

from that experience, I feel that I gained an objective view. but for many people, the iPod was their first MP3 player, so they didn't know that things could be even better. I can see that iPods have cool interfaces - but also that these interfaces aren't as easy to use with 6000 songs on the device. I can see that iPods are important to apple, and I'd like to see great companies like apple do well. but, I can also see that there are plenty of features that aren't available on iPods, if other players offer those features, I wonder what the devout will say?

iTunes 7 appears to be trying to address the gapless issue - at least in iTunes - because I'm currently waiting as it's "Determining Gapless Playback Information" for the 5929 songs on my iPod. oh wait... the battery died near the end :P

but I don't want to complain... thanks to the Xbox 360, I can actually use my iPod for something other than car trips.

Thursday, October 05, 2006

AR book screenshot

I thought I'd share this figure from the augmented reality (AR) book that I'm working on for the pragmatic bookshelf. it's in a section about setting up a webcam for AR - the little critter is a dilute calico field mouse... er, I mean kitten.




update: sadly, this image was cut :(