GREAT NEWS: XNA now works integrated with DSL Tools in the same environment!

 

As I’ve said in a previous post, the most important feature of XNA 2.0 for me was the ability to create my XNA games from inside Visual Studio 2005. Why? Because (1) it is not possible to deploy DSL diagrams to XNA Game Studio Express and (2) it was not possible to create XNA game projects in IDEs other than XNA Game Studio Express. In other words, both worlds were disconnected.

Now we can create XNA projects from inside Visual Studio! In fact, after installing XNA 2.0 beta in my machine, the install wizard says that XNA was installed in both Game Studio Express and Visual Studio 2005.

XNA projects are then presented in the VS2005 new project dialog:

But as a DSL designer, I don’t want to create XNA projects at this moment. I want to create a DSL Tools project (Extensibility group, in the left pane) and deploy my DSL diagrams to a XNA project later.

But wait: after creating a DSL Tools project and running it, the experimental version of VS2005 (where the DSL diagrams is supposed to be designed together with XNA projects) does not make it possible to add any XNA projects through its add new project dialog!

But don’t worry. Close the experimental VS2005 instance and, through the steps below, copy to its experimental registry the settings of VS2005 original registry settings:

  • Open the command prompt with administrator privileges
  • run "cd C:\Program Files\Visual Studio 2005 SDK\2007.02\VisualStudioIntegration\Tools\Bin"
  • run "vsregex getorig 8.0 exp"

Go back to the DSL Tools project and run it again. The experimenal VS2005 instance will open again and now the add new project dialog will present XNA project as expected. Sweet!

Just to illustrate the integration between XNA and DSL Tools, I’ve created a very small sample:

Notice that I’ve added two new files to my XNA project. One contains the diagram (drawn in the left), based on my DSL, and the other is a code generator, which reads and diagram and makes it available to the Game class a property containing the name of the first level.

Finally, I’ve changed the Game class to consume the generated code in order to show, in the window title, the name of the first stage. And here you have the result:

Changes to the diagram causes changes in the game without the need to deal with any code at all! You can download the source code of this sample here.

This is the top of the iceberg. We can say that model-driven development is a new (boosted?) feature introduced with XNA 2.0. Imagine the great benefits we could have with model-driven development and game development with XNA! This is the aim of the SharpLudus project, my PhD thesis. Hope to bring more good news soon.

[]s
— AFurtado

This entry was posted in Games. Bookmark the permalink.

Leave a comment