Delta Engine

Delta Engine Blog

All about multiplatform and game development

Dungeon Quest Updated with Source Code now

Hey! Finally some News about Game Development again. All this Silverlight and VS2008 stuff is nice, but XNA has become pretty popular recently (lots of posts in blogs, more articles everywhere and a lot more news).

Anyway, I wanted to release the Dungeon Quest Source Code for several months now, but I never found the time to package everything up, do some cleanup and release it. Recently some people have requested the source code and emails keep coming in. To finally make everyone happy, here is the new Dungeon Quest version with some nice additions, much cleaner code with quite a lot of refactoring and some nice unit tests (see below). This version also does not require PS3.0 anymore, you can now run Dungeon Quest on a PS2.0 graphic card!

First of all: The downloads, all of them can be found on XnaProjects.net too:
  • DungeonQuestSetup.exe (40 MB): Game installer for Windows with everything you need to play.

  • DungeonQuestSourceCodeAndContent.zip (103 MB): Full Dungeon Quest source code with all content files.
    Please note that the collada files (xml text format) and the sound/music are very big (extracted ~200 MB).
    This download also contains the full game in the bin/debug/ directory, you only need to download this file
    for development and testing.
    Contains solution and project files for VS2005, VC# Express (XNA Express) and Xbox 360!

  • DungeonQuest.wmv (21 MB): Higher quality version of the YouTube video below

Here is the good old YouTube video from the game to give you a first view if you don't know about Dungeon Quest yet.



If you want to drive into the source code I highly recommend starting all the unit tests in Program.cs after checking out the directory structure of the project:

  • UIManager.TestUI();
    Show the graphical user interface of the game (boxes for health, player values, rpg levels, etc.)

  • ShaderTests.TestNormalMappingShader();
    Test the normal mapping shader, for more shader tests check out the XNA Rocket Commander and XNA Racing Game projects.

  • ColladaModel.TestCaveColladaModelScene();
    This tests the big cave collada file (80 MB) and renders it with the cave shader. Looks very nice.

  • ColladaModel.TestLoadStaticModel();
    This is straight from the SkiningColladaModelsWithXNA project from February. This test show shows a static collada model.

  • AnimatedColladaModel.TestPlayerColladaModelScene();
    Also from the SkinningColladaModelsWithXNA project. This shows the player or the goblins running, dying, staying, etc.
    This is a useful unit test to test animations for skinned collada models.

  • PostScreenGlow.TestPostScreenGlow();
    Test post screen glow, more details can be found in the Rocket Commander tutorials and most of my XNA projects.

  • PlaneRenderer.TestRenderingPlaneXY();
    Test to render a plane on the ground, which is also used in some other tests. Also good for testing shaders.

  • ShadowMapShader.TestShadowMapping();
    Test Shadow Mapping unit test, pretty complex stuff, but kinda nice for this game. More details can be found in my book, this is a complex topic and involves a lot of finetuning to get it right.

  • EffectManager.TestEffects();
    Since DungeonQuest uses some effects for fire, smoke, blood, etc. it has a simple effect system build in. Use this test to see whats possible and to extend the effect system.

  • StringHelper.TestConvertStringToFloatArray();
    An example of a dynamic unit test, which can also be started from NUnit or TestDriven.Net (right click if you have the addin installed).

  • Sound.TestPlaySounds();
    And another test to play the sound effects used in the game, just press A, B, 1, 2, 3, etc. to play sounds.

  • ColladaModel.TestCaveColladaModelSceneSplitScreen();
    This test shows how the engine supports split screen support, but it was never fully implemented into the game itself yet.
    To finish this the game logic + handling input from 2nd player has to be implemented.

Some Screenshots from the last post on my blog about Dungeon Quest:


Ok, let's get started. What is this guy doing there. He doesn't look very friendly, maybe it is better to hit him in the head!


First quest completed. This key is important to open the door to the second level.


Nonstop fighting action. Well, at least if you don't lose your way.


This is how it looks like after I got angry. I told those guys, don't start any fights!


Ohh no. I did not use all my skills (see right side) and this Ogre killed me too quickly. I guess I have to start over.


The credit screen when the game ends. Notice my book :)


No reason to stop, let's start over and try again. The fight is continuing. The game is not that hard, you just have to use all skills and avoid being hit by fireballs or big enemies when you have low hit points.

I hope you like Dungeon Quest and that the source code can be useful for your XNA projects. Enjoy!

Migrating from Silverlight 1.1 alpha to 1.1 alpha refresh and that lovely AG_E_RUNTIME_ HTML_ACCESS_RESTRICTED error

When you have some Silverlight 1.1 alpha code and want to use it with the new Silverlight 1.1 alpha refresh bits, you should make sure to replace all assemblies and recompile any libraries you have. You still might get quite a few errors because of some minor changes in the javascript code. I haven't fixed all issues yet, but the main one was replacing the Silverlight.js and fixing the .js files for html (or aspx) pages to the new syntax. Sys.Silverlight is now just Silverlight, the version is now not longer called 0.95, but 1.1 and enableHtmlAccess has to be set to "true" instead of just true before.

When you get the 2211 error code with Silverlight 1.1 alpha refresh with that nice AG_E_RUNTIME_HTML_ACCESS_RESTRICTED error follow this steps:
  • Replace Silverlight.js with the newer version from alpha refresh (you probably have done that already)
  • Replace Sys.Silverlight.createObjectEx with Silverlight.createObjectEx in all your .js files
  • Also replace all version="0.95" with version="1.1" in all .js files!
  • Finally replace enableHtmlAccess: true with enableHtmlAccess: "true"
    This change is very important and will finally get rid of the Html access restricted error above.
    If you like the error, you can "enable" it again by setting enableHtmlAccess to "false" ^^

There are probably much more little changes and fixes, but this should get the simpler pages up and running again.

Silverlight 1.0 RC and 1.1 Alpha Refresh released

After VS2008 beta 2 is available now, Silverlight was also updated. For Javascript development the Silverlight 1.0 RC means you are not longer in beta mode and the version will stay the same. For .NET development Silverlight 1.1 is still in alpha, which propably means there are still a lot of features missing, a lot of bugs in there and it is still hard to work with it. However, over 2000 bugs where fixed since the Silverlight 1.1 Alpha release 3 months ago.

For Silverlight designers: Blend 2 was also updated to an August CTP, a lot of small improvements here too. The best thing here is the ability to create and compile user controls and some nice changes to the Storyboard editing process.

Download links:
Seen first on:
Scott Guthrie also has a nice blog entry about VS2008 Intellisense improvements, a lot of small improvements, which might impress you if you have never used Resharper and CodeRush before. It is always nice to see the overall coding experience becoming easier, even if it is in small steps.

VS 2008 and .NET 3.5 Beta 2 Released

Great News, read all about it on Scott Guthries Blog:
http://weblogs.asp.net/scottgu/archive/2007/07/26/
vs-2008-and-net-3-5-beta-2-released.aspx


It features major improvements to ASP.NET Ajax, Linq, the build in Webdesigner and CSS/Javascript.
Seems like nothing for Silverlight yet, still awaiting some updates there :)

Have to check VS 2008 out now ^^

Silverlight Error Codes Explained!

Side note: FX Composer 2 RC1 is out. Check it out, works even better now.

I worked a bit with Silverlight 1.1 (alpha) over the last few weeks and I noticed a lot of annoying
javascript error messages with just stupid error codes and no stack trace for the exceptions.
This is definately the worst thing about Silverlight, you have to do a lot of trial and error testing,
unit testing and debugging silverlight is also hard to do.

I wrote down all the errors I have encountered and some solutions to them, which might be
helpful to other people coding Silverlight too. Now whenever I get an error I just look into this
list and follow the steps from top to bottom and this way I save a lot of time ^^ maybe I will
also rewrite the javascript on_error code that throws these errors to a more useful version.

Silverlight Error Codes:
  • 1001: usually AG_E_UNKNOWN_ERROR (yeah, thats really helpful)
  • some element is null while loading a control
    Fix: Check all controls constructors and fields, set breakpoints there!
  • Namespace duplicate found (usually error code 2254)
    Fix: Check all namespaces, make sure each name and namespace is only set once

  • Control has no default Constructor and can't be instantiated
    Fix: Provide a default constructor with no parameters, it can be empty!
  • NullReferenceException (or other exceptions) happend somewhere
    (usually in the Control constructor somewhere)
    Fix: Catch the exception or set breakpoints to find it, then fix it.
    Often it is also useful to comment code out and test if it works again.

  • If this all not helps and the 1001 errors keeps coming up when you use the
    control use the following approach:

    Fix: Comment out the control, the page should now work.
    Comment it in again and check every single property you set, try removing
    as much as possible and test again. If it still does not work, check out
    the control itself, comment everything out here inside the control canvas.
    It should work now except for some errors of missing inner control names.
    Now slowly comment everything in again and try to see which inner control
    did not work. Often a depreciacted, commented out or deleted property is
    used and causes this error. Again try to work with as little as possible
    control properties and increase until the error pops up again.

    This more complex case will hopefully not happen to you in the beginning,
    but the more controls you build, the more likely it is that this one
    will annoy the hell out of you. Keep calm and go forward as methodically
    as possible, it will also help you for future error encounters.
  • Can happen if a TargetName for a Storyboard (or something similar) cannot
    be found. Make sure the target control name is still valid.

  • 2005:    ParserError: Unknown namespace xy
  • The line should tell you which namespace is unknown and this should
    be quite easy to fix. It usually means you have either forgotten to
    add a namespace or add an element into an unsupported location.
    E.g. adding something to a nested Canvas can sometimes cause this error.

  • 2024: ParserError:
  • Invalid attribute value text/python, usually happens in the main xaml file.
    Similar to 2265, use the same fixes.

  • It can also happen when the mime type
    is not available (e.g. in IIS) and .py files can't be used.
    Fix: Define .py as mime type in IIS as 'text/ironpython'
        
  • 2101: can be:
  • LostFocus event (or similar) not supported here
    Fix: Move global events to the main canvas, they are only supported there!

  • 2207: AG_E_RUNTIME_METHOD
  • playing media failed, unable to play it, loading probably failed with 403
    or 404

  • 2210: AG_E_INVALID_ARGUMENT
  • Short: In 90% of your cases the embedded resource cannot be found, make
    sure that the name of your embedded resource is correct in the
    GetManifestResourceStream function in your control constructor. Also make
    sure the file is marked as an embedded resource in VS Orcas!
  • This means the embedded resource could not be found, which means either the
    call to GetManifestResourceStream uses the wrong string OR the resource
    is just not existant because of a wrong content type! make sure the
    control you are trying to access is actually an Embedded Resource and not
    just a Content or Silverlight Page.

    Fix: Set control xaml as Embedded Resource and make sure all strings are
    correct! GetManifestResourceStream should succeed! Using the Silverlight
    1.1 API UI Controls is also helpful because they figure out the path
    for you (just leaving you with misstyping the control name or forgetting
    to set the embedded resource type or one of the million errors below).

    Note: This is very annoying because SourceControl sometimes messes this up
    and just merges 2 files and setting it as Content or Silverlight Page,
    which make this error hard to track, so always check for the correct
    file build action first, it should always be Embedded Resource for controls.
  • Another way this error can happen is when inside the control a namespace
    error occurs (similar to 1001 or 2254), you just get 2210 and trying to
    find why it does not work while all names are set ok and the resource is
    found, etc. One example of this failing is that a namespace or assembly
    used inside a control to reference other controls cannot be found or is
    misspelled (e.g. path does not longer fit, can be stupid things like
    ClientBin/Some.dll should be ../ClientBin/Some.dll)

    Fix: Check all namespaces in the control too, make sure all names are
    correct and files (especially assemblies) can be found the way they
    are specified!

    Advanced Fix: I use reflection to find out about the class name and use
    that same name for the .xaml file, this way I never have to specify
    any name and merging files does not lead to problems as long as the xaml
    file has the same name as the class (which is easy to spot in VS Orcas).
  • Another VERY crazy way for this to happen is when one of your controls is
    using the partial keyword for its control class and overwrites some of the
    autogenerated background fields (through x:Class in the main Canvas of the
    control), it is probably better to always remove the partial and make sure
    the control is all managed by you (like in the SDK samples).

    Fix: Remove the partial in c# and the x:Class in xaml if you get compile
    errors, after that it usually just works :)
  • Older notes (before I figured this out):
    Seems to happen with perfectly fine xaml code, no c# breakpoint is ever
    hit, so this must happen while parsing the xaml. Often also changes to error
    2254 if some name or namespace is wrong, but then gets back to 2210 if that
    is fixed.
  • Someone here traced the 2210 back to “InitializeFromXaml” being called
    with an invalid resource stream (GetManifestResourceStream), which failed
    one line above it:
    http://silverlight.net/forums/t/1755.aspx
    
  • 2251: ParserError, AG_E_RUNTIME_MANAGED_ACTIVATION
  • Probably a security issue, seems to happen on a Max when the xaml file
    could not be loaded or accesses something that is not available (assemblies)
    Fix: Seems to be a Mac bug, will hopefully be fixed in the future.
        
  • 2252: can be:
  • Canvas Load Error, canvas could not be loaded because something is wrong
    it may help to check out the line and error description for more details.
    Fix: Look through the xaml line by line, annoying, but something is wrong
  • AG_E_RUNTIME_MANAGED_ASSEMBLY_DOWNLOAD:
    When this happens the control at the line specified failed to load.
    This can be because it crashed somewhere in the constructor, setting a
    breakpoint usually tells you wether it crashed in C# or already in the
    xaml. If it is in the xaml, you have to figure out the error there (try
    to uncomment, check namings, etc.). If it happens in C# setting a
    breakpoint makes it much easier, but the error is still annoying. For
    that reason you should make sure to test your controls as much as
    possible before using them on a complex page.

    Fix: Set a breakpoint in the constructor of the control and fix the
    exception! Or if that does not help, take a close look at the xaml
    and comment it out to see what works and what does not.
  • More help about 2252 from http://silverlight.net/forums/t/370.aspx
    Assembly loading failed, this can happen because of the IIS being
    misconfigured (unlikely if you doing development) or because the
    path to the assembly could not be found (much more likely).

    Fix: Make sure both the page xaml and the control xaml point to the
    correct directory for the dll and make sure this works from the
    perspective of the page, not the directories the xaml files are in!
    In my case changing ClientBin/.dll to ../ClientBin/.dll often did
    the trick!
  • Another issue can happen when you rename the assembly, but not all the
    .dll links are correct. It can also be problematic if there are special
    letters like - in the assembly, which will get renamed to _, but the
    filename is still with -, see here:
    http://silverlight.net/forums/t/370.aspx

    Fix: Just check all .dll links and make sure both the name and the path
    are correct.
        
  • 2254: AG_E_RUNTIME_MANAGER_ASSEMBLY_DOWNLOAD, can be:
  • Control type not found because a namespace is not set correctly, this can
    happen if you just copy a file from another project and do not change the
    namespace accordingly.
    Fix: Make sure all namespaces are correct (same in xaml as in the controls)

  • Namespace duplicate found, make sure that all namespaces and names only
    occur once.
    Fix: See above 1001
        
  • 2255: AG_E_PARSER_BAD_TYPE
  • An unsupported type was found, which usually means you are specifying a
    control or class for the xaml, which does not exist (anymore). Make sure
    that the x:Class parameter points to an existing class and uses a correct
    namespace.
  • Also seems to happen when there are multiple comment blocks mixed in the
    xaml file or some name contains an invalid character because of that.
    Clear the xaml file and test until it works again, then insert the removed
    code again to figure out where the error is happening. The line/position
    information of this error is usually not very helpful!
        
  • 2265: Error: Parser code
  • Parsing xaml failed, this has been reported after saving some xaml in Blend
    but it could not be parsed in Visual Studio.
    Fix: Try using only parts of the xaml, use smaller files, dunno.

  • Parsing xmal failed, some syntax error.
    Fix: You should be able to spot the error and fix it if it is a smaller
    file, for bigger files comment most of it out and comment it back in until
    it breaks again. Then fix the issue.

  • 3001: AG_E_INVALID_FILE_FORMAT
  • Often a ImageError, which usually means you are trying to load an
    unsupported image format like the .GIF format, which is not supported
    by Silverlight yet.
    Fix: Use .PNG instead of .GIF, etc.
        
  • 3002: AG_E_NOT_FOUND:
  • Error type should describe which kind of resource was not found (usually
    ImageError). Check your constructor and Page_Loaded methods and check
    all the files that are loaded there and make sure they exist. This is
    probably the equivalent of FileNotFoundException, just all the helpful
    information (which file, why, etc.) is missing. Sometimes the error type is
    confusing because it may report an ImageError, but in reality just the xaml
    file could not be loaded, always check the xaml file (name, loading, etc.)!
        
  • 3010: can be:
  • Silverlight installation is not complete yet, restart browser (or computer
    if this error persists).
    Fix: Tell user to restart browser.

Link to the silverlight.net forum (post this here too), 13 known issues
with Silverlight 1.1. It is good to know them:
http://silverlight.net/forums/t/2400.aspx

Other helpful links:
http://blogs.conchango.com/stevenevans/archive/2007/06/06/
Silverlight-Adventures-with-Blend.aspx

http://www.thescripts.com/forum/thread650457.html
http://silverlight.org/forums/t/1422.aspx

Note: I will add more errors to this list for Silverlight 1.1 alpha, but I will probably just
write a new blog entry for newer Silverlight versions. Still pretty excited about the new
VS Orcas Beta 2 release ^^

Xna Project Changer Tool (with VS 2008 support)

I wrote a little tool almost a year ago to help me coding XNA directly in VS 2005 instead of using XNA Game Studio Express, which does not support addins. I wrote a little bit about that back then, but for some strange reason I never published my tool. I also wrote about it in my book "Professional XNA Game Programming" in chapter 1 at the end.

Recently I got some emails requesting this tool and I still had to test it for the final XNA version and I also want to add support for VS 2008 (also called orcas; vs 2008 beta 2 comes next week hopefully, yay!).

This tool does not do much, but it is still very useful like the AnnoyingFilesRemover. I use it almost daily when developing and testing XNA projects. It converts projects from VS Express to VS 2005 and VS 2008 and back, you can also use it for VS 2008 (Orcas) projects, which can be openend in VS 2005 again (and compile if you don't use .NET 3.5, but even that works to a certain degree with the LINQ May 2006 CTP). I will try to update this tool when newer versions of XNA (like the XNA Game Studio 2.0) and VS 2008 (like the beta 2 next week) come out, exciting times are ahead :)

The tool looks like this, the most useful button is "Save and Open Project", which convert and then starts the selected VS version:



And here is the installer plus source code:

PS: VS2005 and VS2008 both do NOT support the XNA Content Pipeline. I suggest just starting to write XNA games in VS2005/VS2008 and then switch to XNA Game Studio Express when you need and want to use the content pipeline (or use a library in VS2005 and write the game with XNA Game Studio Express).

You can also use the also use the XNA Content Builder to create .xnb files yourself:
http://www.codeplex.com/xnadevru/Wiki/View.aspx?title=XNA%20Content%20Builder%20(XCB)

Fixing the Sys.Res. namespaceContainsObject error with ASP.NET Ajax+Silverlight

When you try to implement a Silverlight project into an existing ASP.NET Ajax
website you will just click Add Silverlight link to a specific directory in your
website (don't spam everything into your main directory). Then you might want
to use same the html code from your test sites in the ASPX page, like this:

<head runat="server">
  <title>Some title</title>
  <script type="text/javascript" src="Silverlight.js"></script>
  <script type="text/javascript" src="Default.aspx.js"></script>
</head>


And the SilverlightControlHost somewhere in the body (in the form).
You also might want to move the body onload method to a div panel in case you
are using a master page or you want multiple silverlight controls:

        <div id="SilverlightControlHost"
            onload="document.getElementById('SilverlightControl').focus()">
            <script type="text/javascript">
                createSilverlight();
            </script>
        </div>


You might be able to compile and start that without any problems, BUT if you
already have a lot of ASP.NET Ajax code you might end up with this error (and
a bunch more, most of them with Sys.Res in the error description).

Line: 967
Error: Sys.Res.namespaceContainsObject is null or not an object



The problem is that both Silverlight and some generated ASP.NET Ajax javascript
files use the same javascript object (Sys.Res), but overwrite it and disable the
functionality that is needed. You won't find much information on that with
google, but the solution is very simple! Just put the scripts directly into
your ScriptManager of the site like this and remove the scripts from the header:

        <asp:ScriptManager ID="ScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Path="Silverlight.js" />
                <asp:ScriptReference Path="Default.aspx.js" />
            </Scripts>
        </asp:ScriptManager>

        
Hope this helps and saves you some time.

Silverlight and Web Services

Using a webservice in silverlight can be very problematic. It does not work out of the
box when you just add a web reference and try to use it. You will get a lot of
501 - Internal Server Errors, WebException - Error invoking service, etc.

Instead of repeating what so many people have already reported for Silverlight
and Web services I will just link to them and give you a small comment about
each link. My solution is below (it was something completely different than
the links I present here, but maybe I did not read all of them carefully).

Links:
  • Silverlight documentation about using remoting and webservices. Two solutions are presented, but the help is very short and if you have not done it before there can be many problems that are not discussed here. But this two ways are the standard solutions that almost everyone uses.
    http://www.silverlight.net/QuickStarts/Remote/default.aspx



  • I used another solution to put all websites, web services and silverlight projects onto my IIS 7 server in Vista x64, but I had troubles debugging them. I moved also to IIS because it was annoying to test the website with the fun crashes VS Orcas gives you from time to time and it also has the advantage to show a working version on your colleagues computers by pointing to your computer's IIS.





        In short this is what I had to do to get debugging and executing working for web sites and web services in IIS7 with VS Orcas:
  • Install IIS (Internet Information Services) first, you can find it in the Control Panel -> Programs/Features -> Turn Windows features on or off.
  • Open the IIS tree and select the Web Management Tools (just install all of them). Also make sure you install ASP.NET in World Wide Web Services/  Application Development Features, it will also select all the other required components.
  • Last but not least select the Basic, IP, URL and Windows Authentications in the Security tree below World Wide Web Services.

  • After installing it you probably need to restart (it did not work without restarting at my colleagues computer). With the IIS Manager (in Computer Management) navigate to your Default Web Site and go into Authentication. Only Anonymous Authentication will be enabled, also enable Windows Authentication (and whatever else you need). You should also switch from the Default AppPool to the Classic .NET AppPool in the Default Web Site -> Right Click -> Advanced Settings -> Application Pool, else debugging will probably not work (Ctrl+F5 works fine even when you do not do this).
  • All websites you create from now will use the Classic .NET AppPool, if you already have websites in IIS, make sure to change them too if you want to debug them.
  • If you still cannot debug you probably do not have sufficiant rights for the user account that is used in IIS. I usually create a new account with Admin rights (plus password), set it to the IIS (Anonymous Authentication, click edit to select a new user) and then downgrade the Account until it does not work anymore, then you can set the appropriate rights (directory access, etc.) to the account. If you only use your IIS for yourself, you can also use your own user account for testing and debugging.




My problem however was the inability to access the web service via HTTP.
You can access it via SOAP and call the main page and execute the methods,
but directly calling Service.asmx/Method?Parameter=Value was not possible
and lead to the:
WebException - Error invoking service
and Internal Server Error
exceptions (depending on the mood and the way I used web services, I used
mainly the first method (Plain XML Requests over HTTP) as described here:
http://www.silverlight.net/QuickStarts/Remote/default.aspx

To test this I called the website directly the way described in the article
I used something like this:
http://localhost/TestService/Service.asmx/HelloWorld?SomeText=Hi
This returned a 501 Internal Server Error (IIS7) or 404 The Page cannot be found
(IIS6), which means this kind of HTTP gets is not supported in this web service
right now. To fix this you have to activate HTTP get in the web.config file with the following code:
    <webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>

From the MSDN Help on activating HTTP Get and HTTP Post for web sites and web services.
http://support.microsoft.com/default.aspx?scid=kb;en-us;819267

Hope this helps, make sure to read the articles mentioned above in detail if you still have issues.

Update 2007-07-14: BTW, if you are interested in webservices for ajax and silverlight,
check out this new project from microsoft live labs:
http://astoria.mslivelabs.com/
From the astoria website: "The new wave of web applications are built on technologies such as AJAX and Microsoft Silverlight that enable developers to build better, richer user experiences. These technologies bring a shift in how applications are organized, including a stronger separation of presentation from data.

The goal of Microsoft Codename Astoria is to enable applications to expose data as a data service that can be consumed by web clients within a corporate network and across the internet. The data service is reachable over HTTP, and URIs are used to identify the various pieces of information available through the service. Interactions with the data service happens in terms of HTTP verbs such as GET, POST, PUT and DELETE, and the data exchanged in those interactions is represented in simple formats such as XML and JSON.

We are delivering this first early release of Astoria as a Community Tech Preview you can download and also as an experimental online service you can access over the internet."

RegionAddin to fix collapsing and expanding regions in Orcas and IronPython region support!

I've been working with VS Orcas for 3-4 months now and while most projects are still in C#, I switch over to IronPython more and more, especially if I do anything new like some Silverlight website.

CodeRush is working ok in VS Orcas, but there are still some issues, for example expanding/collapsing regions like in my CR_Commenter plugin does not work at all. Visual Studio's Ctlr+M+M and Ctlr+M+L work, but they are pretty much useless because they either collapse just the most inner region (Ctrl+M+M) or just too much (Ctlr+M+L) and pressing these hotkeys is too complicated anyway.

With CR_Commenter you can press Ctrl+4 to collapse or expand the region you are in or Ctrl+5 to collapse/expand all regions (but not summaries, methods, etc.). This works fine in VS 2005, but not in Orcas, there are also some other issues in Orcas like switch or namespace blocks are not commented anymore. For this reason I started writing a new addin (without using CodeRush this time) last month, but I never found time to finish it.

Instead I wrote a new addin this weekend. It just fixes the region issue and adds support for IronPython, which does not have any regions at all. Now regions for all classes, defs (methods) and if blocks are generated for you and can be expanded and collapsed with the same hotkeys (Ctrl+4, Ctrl+5 or the VS defaults). Please note that I had commenter support for IronPython too and added stuff like #region and #endregion to it too, but it does not feel like Python anymore if you add too much comments and blocks. The beauty of Python is its short and self-explaining code and the more I work with it the more I like it.

RegionAddin Hotkeys:
  • Ctrl+1, Ctrl+2: Comment code like CR_Commenter (not implemented yet, it is commented out, too much features from CR_Commenter missing).
  • Ctrl+3: Build region like CodeRush or CR_Commenter, also commented out, CodeRush's version currently does work much better, but adds comments to #endregion
  • Ctrl+4: Collapse or expand the current region you are in
  • Ctrl+5: Collapse or expand all regions in the current file. In IronPython it has 3 modes: All uncollapsed, All methods collapsed, All classes and methods collapsed
  • Ctrl+6: Regenerate all collapsable blocks in IronPython, this is important because the IronPython language service does not support any collapseable blocks, maybe I will implement that later in there ...

Lets take a look at the region feature of RegionAddin for IronPython, Ctrl+6 generate all regions at once, otherwise regions are created automatically as you write code.




As always here is the full SourceCode and a Installer:
This is version 1, I will improve the addin in the future and provide better versions with more features in the future. Maybe I will also finish the CommenterAddin completely and add more support for IronPython (have to think about how it makes sense). Hopefully the RegionAddin is useful for C# and IronPython right now, it also supports all other C style languages like C++.

MVP again!

Yeah! I have been awarded as a MVP (Most Valueable Professional) by Microsoft in the Windows - DirectX Category again.
Last year I got this award and each year it is renewed (or not) if you are still great enough ^^

I guess mainly my XNA projects and the Professional XNA Game Programming book are the reason to become MVP again.
But lately I have not done much DirectX or XNA programming, but questions from my colleagues and by email keep me fit in that area.

A nice warm thank you to all people happy with my work and publications and thanks so much to Microsoft for awarding me again.