Paul's profilePaul's spacePhotosBlogListsMore Tools Help

Blog


    April 29

    Slightly obscure .Net - What does the ?? operator do?

    It's all to do with something introduced in .Net 2.0 called "Nullable Value Types".  I like that the shorthand declaration is like a question... I'm a bool?  Well that means this bool really has three states, true, false and not set.  That kind of thing is useful when dealing with databases, which can have null columns in a table.  Or perhaps there is an option for the user which is either true, false, or whatever the default is.  You see this pattern (although not using Nullables) in the ThreeState checkbox - where the third state is "Indeterminate" and the checkbox is shaded and unchecked while in that state.

    Below is a small snippet illustrating use of the ?? operator with an int? type.

    using System;
     
    namespace NullableNoddy
    {
        class Program
        {
            static void Main(string[] args)
            {
                int? nullable = new int?();    //Declare.  new Nullable<int>(); is equivalent.
     
                Console.WriteLine("nullable is {0}", nullable);    //Not set, so nothing is output after is
     
                int test1 = nullable ?? 1;    //Nullable is null (HasValue is false), so 1 is used
                Console.WriteLine("test1 is {0}", test1);    // test1 is 1
     
                nullable = 2;    //Set value using normal int
     
                int test2 = nullable ?? 1;    //Nullable is set (HasValue is true), so current value used
                Console.WriteLine("test2 is {0}", test2);    // test2 is 2
            }
        }
    }

    If you are interested, the MSDN has a good launch point in to deeper documentation: http://msdn2.microsoft.com/en-us/library/1t3y8s4s(VS.80).aspx

    April 28

    Fable 2 Mentioned in OXM Podcast and Blog Pondering

    Well this being the first game I've been on the team for professionally... even if I'm just helping out on the tools side... I get goose-bumps every time I hear someone talking about it in the media.

    OXM Podcast 111

    I'm trying to figure out how often I should blog too.  Once a week enough?  Twice a week?  I am thinking twice a week is probably enough content for a semi-professional blog - which I guess this is trying to be.

    I have also decided the format of the blogs will try and stick to around the title and not veer too far off that.  The length of each blog entry I'll try and keep to something you can read in a couple of minutes or less.  Any more then that and I'm probably abusing your time, and well it could probably be broken up in to multiple parts anyway.

    April 22

    Buddying - Code quality control without the paperwork

    Every line of code that is entered in to the Mainline (release branch) either through integration of a branch to main... or a smaller change set directly on that branch, gets seen by at least one other coder.

    In fact, many of the developers also monitor the diffs (differences between what was there and what is in there now) - and have them mailed to them, so the potential of someone seeing something wrong and alerting the submitter early to something wrong is increased.  Of course, having diffs mails to you also exposes you to parts of a large system you might not otherwise see.

    The quality of these buddying sessions relies on three things:

    1. The ability of the coder to communicate
    2. The ability of the buddy to communicate
    3. Size of the change set

    The best buddies sessions come from when a coder is open to criticism from the buddy, the buddy being able to constructively critique the code without putting the coder on the defensive (and resist rewriting it in his own image!), and the change list is reasonably small so the buddy doesn't glaze over towards the end.

    It is a good way of spreading knowledge, a great way of getting to know your team, and awesome for stopping some real howlers getting in to a build.

    I guess this is somewhere between pair "extreme" programming and normal programming - and personally I really enjoy the balance it gives.  It makes you think really hard about what you are about to submit, because you know you are going to have to explain it.  Of course, some times your buddy might come up with something you don't necessarily agree with - and you have to talk it out... or even bring in another party to sort out the dispute.  But those times are way outweighed by the pleasant experience of knowing your code is much less likely to break something.

    Often, during a buddy the coder will self-critique, or realize something while explaining it to the buddy.  Buddy goes away, coder fixes, buddy comes back and everyone feels better about that code.  Any rank of developer can buddy any other rank too.

    So when something is checked in, it will have your name on it, and that of your buddy.  What is important though is that as far as my experience here thus far - it is not used as a big bat to splat a developer or two with if something goes wrong because of that change.  Obviously if it's broken, you fix it... but if the coder is away or unavailable, perhaps the buddy can fix it.  It is also not used as some kind of metric here... not as far as I can tell anyway... it is just about the quality of the code.

    I tried to set up something similar at a different employer with some colleagues... however it got twisted.  Management took over and wanted complicated forms to be filled out and signed... basically there was an undertone of blame and shame over code quality... it was a little too beaurcratic for my tastes.  It made the developers feel watched, defensive and resentful... as some people were immune... some had absolute veto... etc.  Bring in an all powerful third party company that could veto anything in house and well... cue a massive dip in the development department morale.

    So "buddying" can have a very positive effect on bugs introduced, spread knowledge and encourage discussion among a team.  When executed correctly, everyone is happy!

    April 21

    Tutankhamen Exhibition at the O2 in London

    The Tutankhamen exhibition was awesome.  For whatever reason I just assumed it would have the casket and mummy of the boy king - but I think in the back of my mind I knew that stuff wasn't travelling around anymore.

    Still the stuff they had on show was fascinating.  Unfortunately for my ever-suffering wife, I was mesmerised by the workmanship and ancient religious rites linked to the artifacts... so we did spend a great deal of time there.

    There were classes of school children running around too, drawing pictures and pestering their teachers (and at some points adults just wanting to look at the things!) - I think some were really taking it all in.  Others were more interested in someone dropping a tissue, then playing some kind of impromptu soccer game with it until one of their teachers stopped them.

    A couple of things stood out - one was the mini casket used for holding the Tutankhamen's liver... there were ancient spells carved out inside that little mini version of what one day I really must try and see.  For Amiga people who liked deluxe paint, you'll know the casket I want to see! :-)

    The most expensive part of the trip was the travel... despite not living that far away from London.  Danni manage to find a four star hotel for 38GBP including tax... and it was a lovely room.  We ate out in Covent Garden, using some 2 for 1 vouchers that we got with the tickets, which mitigated that cost some what.

    We got a few pictures of things around London - it was my first time to Canary Wharf - and it seemed kind of futuristic to me with it's heavy use of glass on shiny metal.  Also it was my first visit to what was the Millennium Dome... I wonder if the architects were going for a kind of Crown shape.  It was cool to think of that scene at the beginning of one of the bond films exploding around that place.

    Windows Vista SP1 Installed on Laptop

    Installed the Vista Service Pack 1 on the laptop.  I did try and download the full install for all languages, because I keep the laptop en-uk where possible... even if it does have an American background (and keyboard!)

    For some reason the install from MSDN wouldn't have any of it, and gave me an error code I didn't write down.  On reflection, probably should have just to have a record of it.  Anyway using Windows Update it installed just fine - and although I may be trying to *will* this... it does seem more responsive and faster.

    April 20

    Windows Vista Wireless Networking - Why can one profile see and connect to wireless networks... but not mine?

    I had a strange problem happen to me over Christmas, where my wife's profile on the laptop could see wireless networks but mine couldn't.  This was very frustrating, as I had to log in as her - and then switch to me with that network connect to the hotel still open.  Any network that was paired seemed to be fine.

    First of all I broke out regmon, then got a message saying it was replaced by the excellent process monitor (download).  With that amazing tool at my disposal, I discovered a locked down registry was not my friend.  During opening up the blank "Control Panel\Manage Wireless Networks" Window, this was one of the lines in the log:

    6653 17:32:26.8356089 Explorer.exe 4000 RegOpenKey HKCR\CLSID\{88D96A05-F192-11D4-A65F-0040963251E5}\Progid ACCESS DENIED Desired Access: Query Value

    Looking up that value in regedit.exe - I found it was the COM Component for "XML DOM Document 6.0".

    That sounded kind of important to me.  Possibly some way internally of collating results or displaying them?  I don't know, only guessing.

    So right clicking on that {88D96A05-F192-11D4-A65F-0040963251E5} folder I found Danni's user there and not mine... and not the Administrators group either.  Ah ha! So I added myself with read privileges and restarted.  Next time I opened up that "Control Panel\Manage Wireless Networks" Window, I could actually see the wireless networks again in my own profile.

    I could have also added the Users group with read only access and that probably would have done the trick too.

    Windows Vista Hidden Network Settings

    Did you know about what the Alt button on the keyboard does in Vista?  Apparently magical things sometimes.

    Some programs... I'll use XNA Game Studio Connect as an example... like to have the network interface being used to connect to your Xbox 360 to be the first network interface.  I believe it's something to do with UDP broadcasting, and possibly getting back the reply over an interface you aren't expecting.

    In Vista you can reorder the network cards by using the special advanced menu that pops up when you use the Alt key:

    • You will need admin rights to the machine
    • At the start menu type and execute: ncpa.cpl
    • If you can't see a file menu with "Advanced" on it on the new window (Control Panel\Network Connections) then select the window and press ALT
    • With any luck the advanced menu has appeared... select "advanced settings" from that
    • A dialog pops up, the top list allows you to change the order of the adapters
    April 18

    The Tower of Cam

    (Posted on Lionhead the other day, figured I'd post it on my blog too)


    Since the last time I’ve blogged, a certain senior developer whom I shall call “Sam” (he blogged a little while back) has had a webcam set up on his desk (Fable 2 Cam). 

    Now and again it points towards my screens and off in to the distance you can see artists in the gloom, working away making Fable 2 look incredibly cool… surrounded by everything from Star Wars action figures to Pokemon and Scooby Doo.  Who wouldn’t want to work in a place where there’s an epic battle between ships of the Empire and Rebel Alliance hanging from the ceiling?

    Very recently dev Sam has constructed a tower for that web-cam.  In true engineering tradition that of course involves cardboard and sticky tape.  I am sure it will not be long before version two of that tower comes along… perhaps it even deserves a little picture somewhere. :0)

    If you are lucky and watching the webcams… now and again you might see a test level running on my dev-kit - but G o o d [Good] luck making anything out with the cam resolution! ;0)

    Recently I have continued work on the editor bits of the LHTS (Lionhead Text System), plus some other parts to do with triggers for level exits.  Georg checked in gigabytes of final recorded speech to our repository… and on Monday Louise did a little demo to the team with that content in.  It is great hearing *actor to be announced* in Fable 2, especially sounding a little corrupt… I didn’t really think of him like that before ;0) Next up for me is adding extra bits to the stuff that allows the editor to update the game running on the 360 with data live.   Should be interesting!

    GDC 2008 Presentations are up!

    Here’s an email I received the other day.  This seems like a good way of testing out the email blog stuff of Live Spaces :0)

     

    From: David Weller
    Sent: 14 April 2008 18:56
    To: XNA Game Studio Discussion; XNA Academic Evangelism
    Subject: GDC 2008 Presentations are up!

     

    I’m pleased to announce the availability of the GDC presentations on MSDN  for public consumption, effective immediately!  The quality and quantity of the presentations was second to none, and we should all thank the speakers for their effort in creating and presenting these decks.  I would also like to personally thank Mitch Walker and Mark Seminatore, who helped insure that the decks were cleaned up and ready for the public. 

     

    Without further ado, here’s the complete list of decks:

     

    XAudio2 - Audio Building Blocks For The Future

    Speaker: Brian Schmidt

     

    Game audio has evolved well beyond simple wave-file playback with 3D positioning. Now, a great sounding game needs programmable DSP effects, submixing of sounds, surround processing and more. XAudio 2 is the new low-level audio API for Xbox 360 and Windows, providing these features and more through a highly efficient software mixing engine. XAudio 2 supplants DirectSound on Windows and XAudio on Xbox 360, allowing you to write code that is easily portable between Xbox 360 and Windows. This session will cover the XAudio 2 architecture and XAudio 2 features. It will also show programming examples for solutions such as occlusion and environmental modeling, how 3D is implemented and its use of data compression.

     

    XDK Update GDC 2008

    Speaker: Cameron Egbert

     

    Microsoft continues to add exciting new features and tools to the Xbox 360 XDK.  Recent additions include XAudio2, XMCore, APIMon, PGOLite, and /Analyze support.  This presentation provides an overview of these new features and discusses best practices for how they can be utilized to create great games.

     

    XNA Game Studio 2.0 for Xbox LIVE Arcade

    Speaker: Mitch Walker

     

    One question resounds as more and more developers discover the productivity gains from XNA Game Studio. How do you make money from the games you create? This talk offers a sneak peek into the XNA Arcade Extensions to Game Studio 2.0 along with details of how professional developers can take advantage of XNA Game Studio to produce commercial games.

     

    Understanding XNA Framework Performance

    Speaker: Shawn Hargreaves

     

    This talk is for programmers who want to understand how the XNA Framework works on Xbox 360, and the implications for writing high-performance code. The talk explains when and why the framework transitions between the Xbox user and supervisor modes, and why should you care. The talk also presents best practices for writing efficient graphics and math code, how to use multiple cores to parallelize your game, and which XNA Framework APIs can be called while doing so. Finally, the talk demonstrates what tools are available for investigating performance on Xbox 360, and how Windows tools can help you understand Xbox 360 performance issues.

     

    The Evolving Windows Gaming Platform

    Speaker: Chuck Walbourn

     

    The Windows platform must keep with the times, and gamers drive the bleeding edge of the technology curve. This presentation covers recent developments in the Windows platform for games with Windows Vista Service Pack 1, Direct3D 10.1, and the on-going 64-bit technology transition as well as strategies for coping with and moving beyond the long-standing 2 GB memory barrier.

     

    Performance Tools Update

    Speaker: David Cook

     

    Everybody’s favorite profiler Pix has gotten even better. Hear about the new additions, including continuous capture, Dr. Pix warnings, optical drive monitoring, and more. Learn how to use Pix to investigate performance spikes, detect anomalies, and improve load times.

     

    Networking with the XNA Framework

    Speaker: Shawn Hargreaves

     

    Playing games by yourself can be fun, but it’s far better when you can play with others, whether cooperatively or head-to-head. Creating multiplayer games using XNA Game Studio, however, requires networking support in the XNA Framework for both Windows and Xbox 360. And that support simply wasn’t there…until now! With the release of XNA Game Studio 2.0, we have augmented the XNA Framework to include support for networked games. Come learn about networking in the XNA Framework, what is supported and what’s not, and how you can enable multiplayer support in your games.

     

    Getting More From Multicore

    Speaker: Ian Lewis

     

    Multithreaded programming doesn’t seem as hard as it used to, but it’s still challenging to wring the greatest amount of performance out of multiple processor cores. From experience with multiple game developers and Microsoft’s internal SDK teams, we’ve found a set of best practices to follow, as well as some common techniques that are best avoided. We’ll present tips and tricks for getting the most out of multiple processors on Windows and Xbox 360, and discuss new Microsoft technologies that can help make high-performance multicore programming a little easier.

     

    Games for Windows - LIVE Just the Facts

    Speaker: Ray Thompson

     

    With Games for Windows – LIVE, Microsoft is extending the Xbox LIVE® gaming and entertainment network to Windows. Learn about the features and find out the basics. This presentation will help you understand what it takes to ship a basic single-player game, and also help you understand the differences between the platforms as you move a game from Xbox 360 to Windows.

     

    CLR Performance

    Speaker: Frank Savage

     

    This talk is for those who want to understand the inescapable performance consequences of the managed programming method: the things you cannot avoid and the things you can. Comparing and contrasting the consequences for the .NET Compact Framework and the classic .NET runtime, the talk explains the reasons for these overheads, the benefits they provide, and what practices minimize the associated costs. Additionally, we discuss some commonly occurring costs, such as boxing, that aren’t inherent to all managed code, and we offer some tips for minimizing those costs.

     

    D3D10 - Getting from 0 to 60 Hz

    Speaker: Kevin Gee

     

    Learn about performance tools and best practices for driving the DirectX 10 renderer in your game from XNA Developer Connection's experiences in the trenches. This talk identifies common issues from developing high-end graphics experiences on Windows Vista using DX10 and outlines approaches to mitigate those issues.

     

    Extending the Content Pipeline

    Speaker: Frank Savage

     

    The XNA Framework Content Pipeline allows developers to use Visual Studio to build their art into resources for use with the XNA Framework and XNA Game Studio. This talk covers how to create new importers and processors using C# to extend the functionality of the Content Pipeline as well as how to debug these importers and processors using XNA Game Studio. We go in-depth into the creation of the code for the importers and processors and do hands-on debugging of the resulting processor and importer to give the audience a clear idea of how to work with and extend the Content Pipeline.

     

    Advanced Debugging with Managed Code

    Speaker: Matthew Picoccio

     

    XNA Game Studio offers a robust debugging experience that can greatly enhance a developer’s ability to investigate a game as it runs. Developers of managed games have many debugging techniques at their disposal, but not all of them are self-evident. This talk covers advanced debugging techniques useful to game developers, including demonstrations of powerful IDE debugger features and other tools provided by Microsoft.