Profilo di AndreFurtaSpace - www.afurtad...FotoBlogElenchi Strumenti Guida

Blog


28 febbraio

[DSL Tools] VS package load failure? Look for corrupted .prf files!

 

For a Visual Studio package developer, one of the most frustrating error messages is the Package Load Failure, that tells that your VS Package was unable to load in the IDE.

For some of my projects, including the FeatureModelDSL, I was able to notice that the root cause of such an error was the eventual corruption of the windows.prf file under C:\Documents and Settings\username\Application Data\Microsoft\VisualStudio\9.0\. Deleting this file (so that it can be automatically re-generated by Visual Studio) makes the package work again.

I’m suspecting a custom toolwindow I have created for such a package might be causing the corruption. To be investigated…

BR,
-- AFurtado

Exporting a XNA Project as a Project Template

 

A XNA project contains a nested project: the Content project. If you export your game as a Visual Studio project template, unfortunately such nested Content project doesn’t get exported by default as well. Therefore, when you create project instances based on your template, the Content stuff is not loaded.

Unless… you do this awesome hacking over here! Kudos for those who published it!

BR,
-- AFurtado

26 febbraio

[DSL Tools] How to handle a model (diagram) Load event

 

Suppose you have a domain concept (class) with a Namespace property, which will be used in code generation. It would be cool if such a property was automatically filled with the value of the project root namespace when the model (diagram) is loaded for the first time, wouldn’t it?

So how to handle the model Load event? The trick is to add a partial <DslName>DocData class to your project, then override the OnDocumentLoaded method. From there, you can get the this.RootElement property and cast it to your root model element.

For instance, that’s exactly how I’m doing with my GameDefinitionDSL (yet to be released):

internal partial class GameDefinitionDSLDocData
{
    protected override void OnDocumentLoaded(EventArgs e)
    {
        base.OnDocumentLoaded(e);
        Game game = (this.RootElement as Game);
        // if game.Namespace is null or empty, update it with the project root namespace
    }
}

This approach follows the “Convention over Configuration” design paradigm, setting an appropriate default value for the game namespace, that can still be modified by the user later.

BR,
-- AFurtado

22 febbraio

Input Mapping DSL: add input mappings to your XNA/FlatRedBall game

[Input Mapping DSL: adicione mapeamentos de entrada para seu jogo XNA/FlatRedBall]

The SharpLudus project bits are finally getting ironed to release. The ArcadEx game factory, under development, is one of the factories created as part of the project, and it’s focused on streamlining the creation of arcade games in XNA. As a software factory, it provides (visual) languages, code generators, frameworks and tools to improve the development experience. Many of its assets are built atop the FlatRedBall game engine.

The first announcement for ArcadEx is the Input Mapping DSL (domain-specific language), a visual designer and code generator integrated into Visual Studio the help you to add to your XNA/FlatRedBall game, very easily, mappings from a Xbox360 controller to the keyboard.

In other words, if any of the players does not have a Xbox360 controller available, you will still be able to handle their input from the keyboard, while still programming against the controller buttons. Simplifies your code; saves you time. The input mapping does the magic for you.

InputMappingDsl

The project is also a nice example on how to replace the default DSL designer by a custom designer in the Microsoft DSL Tools.

PS: the project is open source, and the code is also available. Feedback is always welcome.

Thanks!
-- AFurtado

The statements or testimonies I offer in this post represent my own personal views.
I am speaking for myself and not on behalf of my employer, Microsoft Corporation.

English - Portuguese

Os bits do projeto SharpLudus estão finalmente sendo ajustados para lançamento. O ArcadEx, um fábrica de jogos em desenvolvimento, é uma das fábricas criadas como parte do projeto e é focada em simplificar a criação de jogos de arcade no XNA. Como uma fábrica de software, ele fornece linguagens (visuais), geradores de código, frameworks e ferramentas para melhorar a experiência de desenvolvimento. Muitos dos seus recursos são construídos com o motor de jogos FlatRedBall.

O primeiro anúncio para ArcadEx é a Input Mapping DSL (linguagem específica de domínio), um designer visual e gerador de código integrado no Visual Studio que ajuda você a adicionar ao seu jogo XNA/FlatRedBall, muito facilmente, mapeamentos de um controle do Xbox360 para o teclado.

Em outras palavras, se qualquer um dos jogadores não tiver um controle do Xbox360 disponível, você ainda estará habilitado a interpretar a entrada do usuário a partir do teclado, enquanto ainda programa usando os botões do controle. Simplifica seu código; você economiza tempo. O mapeamento de entrada faz a mágica para você.

InputMappingDsl

O projeto é também um exemplo interessante de como substituir o designer padrão de uma linguagem no DSL Tools por um designer customizado.

PS: p projeto é de código-fonte aberto, e o código também está disponível. Comentários são sempre bem-vindos.

Obrigado!
--AFurtado

Os relatos e opiniões deste post apresentam pontos de vista pessoais,
não refletindo necessariamente a opinião da Microsoft Corporation.


21 febbraio

Programmatically checking valid identifiers

 

Have a string and need to check if it’s a valid C# identifier (to use as a method name in code generation, for example)? Try this code:

Microsoft.CSharp.CSharpCodeProvider.CreateProvider("C#").IsValidIdentifier(myString);

I recommend checking other useful methods of the CodeDomProvider class as well.

BR,
-- AFurtado

19 febbraio

[echo post] Mobile phone with a built-in projector

 

Not bad to have a projector in your pocket! (wait until the end of the video)

 

 

More here.

BR,
-- AFurtado

18 febbraio

SharpGames mini-game competition

 

Friends from SharpGames (the Brazilian XNA games community) just released a video with the games that were submitted for the mini-games challenge. All games have less than 100 lines of code, and that makes some of them really impressive!

 

It’s at least 10 times less source lines of code than the first game I’ve ever created in my life: Alien Attack, 10 years ago, in C programming language.

alienattack

BR,
-- AFurtado

The statements or testimonies I offer in this post represent my own personal views.
I am speaking for myself and not on behalf of my employer, Microsoft Corporation.