October 2005 - Posts

Seattle Code Camp

Well another great code camp - seemed like folk I spoke to had a good time. I met some folks who I had met at Portland code camp. Nice to see several of them remember me, even though I had forgotten all of their names - I am so sorry but next time keep your name badges on so that I can at least pretend I remembered. The ZBuffer is showing up more and more on people's searches - I met a lady called Ingrid who had been doing some managed DirectX who had been using the site and at least one guy was excited to have finally met "The ZMan".

One downside was that the game programming talks were not so well attended as in Portland. My shader talk was just 2 people (and Jason showed up for half of it). One of those folks was Chris's son who very sportingly came to my talk for a second time after seeing it once in Portland. Mark - I'm not sure how much you understood this time but I guarantee that it's the 3rd time through that will make things click :-) I managed to crash the projector or something and the second room we tried had been 'hibernated' so we had several false starts and moves which didn't help. I'm thinking my prerequisites are too harsh on folk - when you say there will be math involved some people get scared. Next code camp I'm going to do something more beginner oriented. Of course it's always hard to compete when you have Microsoft celebrities like Brad Abrams and others repeating PDC talks without having to pay PDC prices (code camp is free remember) - I gather Brad's talk was standing room only

1000 points of Kudos for DeVry University - these folks donated all of the space and facilities for FREE and its not even Christmas.

Tuesday fun and games

Well its 1:30am, the ZChick and the ZHounds are fast asleep and the ZMan has just finished the analysis of the .Net 2.0 Managed DirectX release. It certainly took a lot longer than I expected and was much more manual labour than I like to do. On the positive side I got to see deep parts of the namespaces that I didn't even know existed so it was a worthwhile learning experience.

Later today after I have caught some Zzzzzzzzzz's I will be heading up to Microsoft to film a Channel 9 video with some of the Coding4Fun team. Since the Ask ZMan column isn't really great video material I've helped out with a more 'tactile' Coding4Fun demo project which involves XInput and the new Xbox360 controller that I talked about the other day. You will have to wait for the video to be release to see what it is. Well maybe I will take it along to Seattle Code camp this weekend.

It will be odd going back as a visitor but hopefully will get to meet Scoble.

A new world record for....

..cinnamon rolls. And the ZMan and ZChick were there to see it.

Not coming from America where the biggest ball of string and the biggest thermometer are common place I find this sort of thing fascinating. So when I found out that the House of Bread, in Mill Creek, WA was attempting a new world record I knew where I would be on Saturday 15th October 2005.

And here it is - I believe the unofficial weight was 246.5lb...

Biggest Cinnamon Roll

We had to stand in a line for 30 minutes to get our chunk of it (terrible planning on my part - there was a short line and we said "we'll come back when its shorter". When we got back it was 3 times as long!) and it tasted damn fine. How many of you can say they have eaten part of a world record!

Oh yeah, Managed DirectX.... errr.... well I'm almost finished with the DirectSound API analysis. Will be up before I go to bed tonight.

 

Secrets of Xbox APIs

As part of the XNA initiative Microsoft have been sharing things that used to only be in the XDK and bringing them into the PC based SDK. I believe PIX was the first of these crossovers and in the October SDK we find 2 more - XACT and XInput.

For anyone who has written any DirectX applications you will know that its never as simple as calling a single line of code no matter how much that seems to be the sensible way. This is due to the level of integration with the hardware and the fact that game developers need to be able to set each and every flag differently to get the required performance for their games.

I spent yesterday and half of today working on a project which I will reveal more about on Tuesday. It needed some gamepad input and it was suggested to me that "it might be cool to use the XInput stuff". Well I'm always up for some beta madness so the laptop still has .Net beta 2, so that will work with the .Net 2.0 Managed DirectX beta assemblies that wrap the new (but released so there is some stability in the mix) XInput API. Of course XInput only reads from the all new Xbox360 controller for Windows (available to buy soon I am assured) which is a bit of a problem unless you attended Meltdown in which case they gave all attendees a controller. So beta controller, beta driver, beta API on an old  beta of the framework in a beta IDE. Sounds fun.

Well it turns out thats not the fun (or really the point of this blog entry). It turns out that while the rest of us have been struggling with DirectInput the XBox team have been able to write code like this: (I typed this from memory since the real code is on another machine - so it may not compile but its close enough)

State state=Controller.GetState(0);
if (state.AButton) doSomething();
if (state.BButton) doSomethingElse();
moveSprite(state.LeftThumbX, state.LeftThumbY);
Controller.SetVibration(0, new Vibration(state.LeftTrigger, state.YTrigger);

AND THAT'S IT.... no initialisation code, no disposing, no shutdown, no cooperative levels.....

No wonder they can write such great games on the XBox. Given this pattern I suspect the API is powerful enough to write code like this:

HaloGame game=new HaloGame(new Version(1.0));
game.play();

Which means the upgrade process is as simple as changing the constant! No wonder they don't let the XDK go public there would be riots in the streets.

Back to reality for a moment, unless you have a Xbox360 controller there isn't much you can do with XInput right now apart from read this. In fact unless you want to support only Xbox360 controllers you are still stuck with using DirectInput. Its probably for the best anyway given the state of the .Net 2.0 Managed DirectX assemblies. Rest assured I will be writing up an Ask The Zman column on this experience - and the smart folk among you might even be able to guess the publication date.

Not AssDiff

Hmmm, just after typing that last blog entry I came across a Diff add in for .Net Reflector which does the sort of differencing I am looking for at CodingInsanity. Seems to work nicely for the small diffs between the usual SDKs. However I can't try it for the new assemblies because of that problem where they are all merged into one file. I've already tried ILMerge in an attempt to turn the old set of DLLs into a single one but the resultant DLL wasn't something that TxRef could handle so I'm not sure how successful that will be.

Seems like its a good job I didn't continue with AssDiff today and worked on some other stuff instead. Need to spend some time looking into this as a solution rather than writing my own.

AssDiff

Mike V commented that maybe I need a tool to do the DirectX assembly differences for me. Interestingly enough that's what I worked on yesterday.

The process I go through is not all manual and generally the changes between SDK versions are small so its relatively easy e.g. Feb 05 changes. I start by installing the assemblies to a VirtualPC that I have set up with a pure version of Windows XP. That way I don't have to worry about any old versions and other things getting in the way and I can see exactly what files get put where. Then I take a copy of the assemblies and the framework code so that I can 'diff' them at any time in the future.

Of course you can't just use WinDiff or other similar programs on assemblies and get useful output. So I use a tool called TxRef to generate an textual outline of the assembly. If you've ever used .Net Reflector then imagine taking the tree structure for all the classes, methods and parameters and writing it out to a text file. TxRef is something that I acquired while working at Microsoft. Its created somewhere deep in the .Net team and is an internal only tool. Normally I would not even have mentioned it here because I know people will just ask for a copy that I can't and won't give out. However yesterday I found out how you can get a copy for yourselves. Just go and buy Framework Design Guidelines (yes there's an affiliate link in there - send a few $$$ to the Zman) and there is a copy, source and all, of the same TxRef tool I borrowed.

Now once you have the TxRef output for the before and after images you can use WinDiff (comes with Visual Studio) or my new favourite Beyond Compare to see what has changed.

This time however had a few challenges.

Firstly TxRef works on a single file at a time. The Managed DirectX team has merged all the code into a single DLL so how to compare the new single file with the 5 old ones. For the most part I could create individual files by cutting at the namespace boundaries, but D3DX.dll actually puts its stuff in the Direct3D namespace. So I had to manually merge the classes into a single file - keeping the alphabetical order so that WinDiff would have a slight chance of finding matches.

Secondly, the changes were so great that none of the WinDiff tools could match the 2 files. There are just too many line that have either a { or a } and the windiff tool matches them even if it shouldn't. This is where Beyond Compare came into its own. I can look at the 2 files side my side and mark the correct left and right matches and it automatically lines everything else up.

After this its just a case of scanning down the files for relevant changes and typing them into a useful format. This is the manual part of it that can go wrong - after a few hours your eyes start to bleed and you can miss stuff!

But its still too much hard work and lets face it I would rather be coding than typing. So after a bit of thought I've started on a project to automate the whole process. I figure I have spent 20+ hours creating the diffs you have seen so far, with another 2-4 still to go, and I know I will have to do it all again in December when the next SDK comes out. So logic says if I can write something in less than 24 hours I will be in profit. Even if it takes longer I get more .Net programming practise and hey maybe someone will pay me $20 for the program in the future.

There's nothing to show yet other than the fact that I decided to call it AssDiff - for no other reason than it makes me laugh every time I type it.

What I did on my blog vacation

Sorry for the gap folks - been keeping myself busy elsewhere. I'll just catch you all up very quickly.

  1. Ran a 5k race in under 26 minutes. Just to save you some time with google yes that's more than double the current world record and no I don't care. I'm too old and unfit to be worried about the competition e.g. the 12 year olds, the 75 year olds, the dads pushing 2 kids in a stroller who pass and beat me every time. However knocking over 1:40 off my last race is something to brag about.
  2. Went to PDC. Had a successful Birds of a feather session, met Bonk/Robert, Dirk, Benjamin, Casey, Jeff, Johan, hung out with the Coding4Fun guys & contributors (Dan, Brian, Ed, Kent, Matt and the Phidgets team) and maybe scored myself a small graphics related coding job and a possible speaking engagement.
  3. Went for a few days break in Cannon Beach, OR (famous for the rock where scenes from The Goonies were filmed).
  4. Relaxed too much after my week and a half off. Apparently fear of managers and deadlines is the only thing that has motivated me to go back to work in the past - now I have neither I'm finding that its hard to get going again after a break.
  5. Ran my 1st 10k race ever and did it in under 55 minutes. Once again,  its a smidgin' off the world record and I was again beaten by many many people, but I still don't care. 6 months ago I was running an occasional 13 minute mile on a treadmill and thinking it was sufficient exercise. Now I'm running 10k's in under 9 minute miles and I'm able to move and talk comfortable after I finish.
  6. More work in the garden/yard. A trench for the 2nd great wall of Zman has been partially dug before the Seattle monsoon season begun. The area around the 1st wall has been levelled, dug, composted and is awaiting topsoil and grass seed.
  7. The October SDK came out (have to get some technical content for Jason) and the anticipation of the .Net 2.0 assemblies was rapidly killed when it became apparent that somehow 40% of the namespace had gone missing. There are a lot of changes but I'm about half way through documenting an overview. The tools I have used in the past were just not sufficient this time so its been harder to determine all the changes. Hopefully it helps someone though (god forbid I'm doing this and nobody is reading it - please someone email me if you'd rather see pictures of the wall!)

So that's it. Memories of the time off and vacation are fading and I've almost convinced myself that I need to do some work so expect more soon.

Search

Go

This Blog

Syndication