Writing XBox 360 games with F# and XNA Game Studio Express (courtesy of Jack Palevich)

Whoa! F# for games on the XBox 360!?  Microsoft XNA Game Studio Express got launched today, and is available free to anyone with a Windows XP-based machine at http://www.msdn.com/XNA. This is based on Visual C# 2005 Express Edition and the Microsoft.NET Compact Framework. Jack Palevich on the XBox team has written three tutorials on How to Write XNA Game Studio Express Games with F#:

Part 1: How to Write XNA Game Studio Express Games with F# – Part 1 Getting Started


Part 2: How to Write XNA Game Studio Express Games with F# – Part 2 Using F# with Visual C# Express


Part 3: How to Write XNA Game Studio Express Games with F# – Part 3: Running on the Xbox 360

Here’s Jack’s FAQ:

Q: Can I use this call-a-DLL approach to write Xbox 360 XNA Game Studio Express games for other non-C# CLR languages like Iron Python or Visual Basic?

A: Unfortunately no, not for those two specific languages, not yet anyway. (Sorry!)  The reason is that the Xbox 360 version of the XNA GSE CLR is based on the .NET Compact Framework 2.0. This is a problem for Iron Python and Visual Basic because those particular languages rely on CLR features that are not present in the .NET Compact Framework 2.0. Therefore you currently get a runtime error when you try and run your Iron Python or Visual Basic code on the 360. It’s possible that future versions of either the languages or the Xbox 360 GSE runtime will fix this problem. (But don’t hold your breath — nobody has promised anything in these areas. Only C# is officially supported for XNA GSE games.)

Note that this limitation to run on top of the .NET Compact Framework only applies to the Xbox 360 version of your game. Although I have not tried it, I believe that it should be possible to use a variation of the techniques in Part 2 to run Iron Python and/or Visual Basic XNA GSE games on Windows.

Q: Have you written an Xbox 360 game in F#?

A: Yes, a small game “Dandy Dungeon”. I haven’t had time to clean up the sources for publication yet. You can find the sources to an early non-XNA version of this game on hubFS.

Q: Why are you messing around with F# anyway? Isn’t C# cool enough for you?

A: I love C# (and I do most of my day-job programming in either C# or C++), but I’m attracted to F# for it’s brevity and its neat-o functional programming language features. It’s also a lot of fun to watch the language evolve and improve.


Comments (3)

  1. Lars Nilsson says:

    Very nice! Have been waiting to hear of someone putting XNA and F# together.

  2. Don Syme’s WebLog on F# and Other Research Projects has three recent entries on F# which I would like

  3. katrinajenkins@hotmail.com says:

    I have just bought a copy of call of duty 3 on the xbox 360 in France cann you change the language to english? We cant work it out.


    Katrina Jekins