Wooohooo! Am on Channel9!

The interview that I had when I visited Microsoft for the Lang.NET 2008 has been posted to Channel9. Its a conversation between Charles, Dragos (from the Volta team) and myself on open source, .NET, Mono, Moonlight and other fun topics.

Posted on 29 Feb 2008 by Miguel de Icaza

Mono and the Game Developers Conference

Last week some of us from the Mono team at Novell went to San Francisco for the Game Developers Conference. As some of my dear readers know, I was not much of a gamer a year ago, and I do not claim to understand this industry.

Mono is currently being used by a major publisher [1] to script a new version of a popular franchise (the new edition) and Mono is also the engine that drives Unity3D for scripting and SecondLife is beta testing Mono now on their beta grid.

Other than being fascinated by Unity3D and SecondLife, we had not really paid much attention to games. But in the last nine months we started to get a constant stream of requests to license the Mono runtime to power more and more games.

When Joseph Hill joined Novell in January as Mono's product manager we started to revisit some of these request. People wanted to get a proprietary license for Mono to use on the PlayStation, the XBox and the Wii and some folks also wanted Mono under non-LGPL terms (as it turns out, important to prevent cheating).

Three weeks before the GDC conference, our in-house expert on the game industry Michael Hutchinson told us that this conference existed. In a couple of days we booked some space on the show and we got things in place, we were going to promote Mono as an accelerated scripting engine.

Mono in Games

As it turns out, .NET-based tools and .NET-based scripting of tools are pervasive in the game industry.

As for the games themselves, engines are typically written in a combination of C++, C and assembly language and the high-level code is written with scripting languages. Lua is the most popular language to embed in a game (a procedural C-like language) and Python, variations on Lisp and a never ending stream of evolved batch languages.

People want to reuse Mono on games for a few different tasks. These are some of the reasons that we know about:

  • Speed: as games become more complex, and people spend more money on software that takes advantage of GPUs, optimizing compilers and even special hardware for physics the weakest performance spot on a game has typically been the language that has been used to implement the high-level portions of the game.
    In a world that is increasingly green, it is a waste of perfectly healthy computer cycles to interpret your code when you can use an optimizing JIT compiler to run your code.
  • Mainstream Language Support: In some cases, game companies have created their own languages, evolved or modified existing languages (modified versions of Lua are common). Some people would like to get access to more mainstream languages to develop their game logic.
    In the short term, jumping from procedural languages to object oriented languages is a first jump.
    Hopefully they will drink the functional kool-aid and use some of the C# functional features, or even F# to write their games.
  • Code Sharing: C# or .NET code that is today written to run on servers, or as part of the tools being used to create games can now be easily be reused on the game itself.
  • Mainstream Tool Support: Many games engines are already being developed with Visual Studio. Game developers can use the same tools to develop and debug the high-level game play scripts that they use to develop and debug the game engine.

Luckily, developers that have been writing Lua code for years will be happy to know that they can compile their Lua code to run on Mono (and get the performance boost they need) by using the Lua2IL compiler.

Update: The always great Lua developers have pointed out that the new thing is not Lua2IL but LuaCLR.

Mono and XNA

Mono does not really attempt to compete with Microsoft XNA

Microsoft's XNA is an end-to-end solution for game developers that want to create games for Windows, the XBox and the Zune, the XNA approach is to write manage code on *top* of XNA.

This works for certain kinds of games, but in the game developer space, some developers need to support more than one console and the high-end games (am sure there is a technical terms for these) end up licensing game engines, audio engines, graphics and physics from all kinds of middleware vendors.

In those cases (even when targeting the XBox) C# and .NET would not be available to the game developer.

So we basically think of the Mono runtime merely as a fast scripting engine with all of the ECMA/ISO CLI benefits and not really as providers of gaming APIs.

There has been some discussion in the #mono channel recently about whether we would create or endorse a gaming API developed by a third party. Like blessing Tao or OpenTK as the standard way of building games for Mono.

Although there is some value in having a blessed set of libraries for Mono, and I have no problem if people want to call their libraries Mono.Gaming, at this point the team at Novell is not able to dedicate any cycles to this effort (we can provide spiritual support, along the lines of yelling "Go team! Go" from the sidelines).

Intrinsics and Parallel Code

Am personally fascinated by running computational code on the GPU or taking advantage of special CPU instructions at the runtime level. Last year I wrote a bit about how we could implement this in Mono (Microsoft has already an implementation) and later we even made it part of our interviewing process.

Gratuitous Cell Processor imageAt the conference some people asked as to whether it would be possible to take advantage of the PlayStation3 six SPE processors. During the conference I had no idea that there was already a project using Mono on the PS3 with Linux that already does this, but the idea sounded fascinating.

It is particularly fascinating because the SPEs on the PS3 do not have the same limitations than GPU computations have, these are full blown CPUs (with some memory limitations) but still general purpose computation devices.

Paolo pointed me to CellDotNet: A project to make it possible to run .NET code on the Cell architecture.. CellDotNet is basically a JIT compiler (written in entirely in C#) that can compile CIL bytecodes into native code for the PS3 SPE processors (this is a project from Klaus Hansen and Rasmus Halland).

They have ported the SciMark benchmark to use some vector operations in the SPE. Currently I am unable to report the numbers as I do not have a PS3 running Linux, but I am expensing a PS3 as we speak to be able to report these back to you dear readers.

What makes CellDotNet all the more interesting is combining C# new functional features with the the Parallel Extensions to .NET.

Two good articles to get a grasp on what this offers are: Optimize Managed Code For Multi-Core Machines and Parallel LINQ: Running Queries On Multi-Core Processors.

PLINQ is built on top of the Language Integrated Query (LINQ), and although it has been promoted mostly as a technology to do database queries, the Parallel LINQ extensions basically supports map/reduce inside C#.

These libraries are only available as a technology preview currently for .NET and they do not exist yet for Mono. Hopefully we will get these implemented at some point.

[1] Our contract with said major publisher does not allow me to disclose who they are or the the game they develop on my blog. But it allows Novell to publish the information on the Novell site. After a year of asking Novell people to put this information on the web site, the information has not yet been posted. So the mystery as to what this is will sadly continue.

Posted on 26 Feb 2008 by Miguel de Icaza

Lang.NET talks available

The Lang.NET 2008 talks have been published.

They require Silverlight 1.0, but Moonlight compiled from source with ffmpeg support is able to play those presentations back.

If you are in a rush, see the following post for details on downloading the WMV file (so you do not need to install Moonlight from source on Linux).

Posted on 24 Feb 2008 by Miguel de Icaza

Mono Hackweek Summary

Some of the Mono folks have blogged about their work for last week hack-week:

Paolo and Zoltan rearchitected the Regular expression library in Mono and got a 9x performance improvement in regular expression matching. The work had two components: redesign of the opcodes in the regular expression engine, and generating native code using Reflection.Emit. At least for the Language Shootout case, the new regular expression code is the second best (Tcl is faster, but apparently Tcl does not cope with Unicode regexes).

Wade worked on MythTV under XGL and making Tomboy Scale.

Andrew added Zeroconf/Bonjour support to Giver (a tool used to easily share files with friends or nearby users). And he also worked on Tasky a simple task management tool that integrates with Remember the Milk. He also wrote a command line tool to remotely control Tomboy. screencast.

Mike added support to importing data to his Exert Project (fitness/workout log software) that he started last Hack Week.

Sebastien revamped and added various new rules to Gendarme, our analyzer for CLI assemblies to spot errors and common programming mistakes.

He also improved its APIs and performance. He also started to fix some bugs in our class libraries based on the analysis done by Gendarme.

Jonathan ported his XMPP/VB.NET client to Mono:

And also got MonoDevelop running natively on Windows:

Jonathan Pryor spent the week polishing various loose ends. Including the release of his fantastic NDesk.GetOptions command-line parsing library and providing documentation to various components in Mono.

Atsushi worked on the implementation of WebHttpBinding (part of 3.5 WCF) and various other parts. See his blog for details.

Mark polished his MathMap composer tool.

Marek did some work towards replacing System.Reflection.Emit with Cecil. After some discussion we believe we can keep both backends, one to keep things as usual, and another to be used with MonoDevelop (so MCS provides the actual parsing for the editor intellisense and compile-as-you-type support).

Jackson worked on a couple of interesting demonstrations with Aaron, which hopefully they will be able to demo soon.

Carlos spent his time improving System.IO.Serial, there were a handful of events not implemented that he worked on.

Andreia and Marek worked on a Gtk# native client for Bugzilla.

Stephane created a new Gtk.Print/Cairo dialog for F-Spot and worked on support for TimeZones in F-Spot (code has not been commited yet).

Everaldo worked on packaging Mono for Maemo4. He has promised a number of blog posts detailing the work on GarMono, and the new packages that will be included on it.

Rolf continued to replace SRE with Cecil in the VB.NET compiler.

Lluis worked on improving Mono.Addins and creating an add-in for authoring add-ins in MonoDevelop.

Paolo early on also extended C# to allow inline-IL assembly language code (similar to __asm__ in C or C++ in some compilers). See the blog post for the various samples of C# with embedded IL.

Chris worked on a scheme compiler.

Jeff learned more about Regular Expressions than he wanted to. Update: Jeff wrote an add-in for MonoDevelop to do Evolution plugins in C#.

Update: I had not finished reading all the status reports on the mailing list. Dick Porter wrote bluetooth support for F-Spot. There is a bug in the system underlying bluetooth C libraries that prevents it from working correctly out of the box, but hopefully that will get fixed.

Update: Mike Krueger improved extensively the search functionality in MonoDevelop, it now implements Emacs/Mozilla-like searching and he also wrote an assembly browser/decompiler that is plugged right into the solution browser.

As for me, I spent the week going insane over the incredibly frustrating T61p problems with performance. Inspired by Marek's encouragement to learn LINQ and functional-style programming, I started a project that I abandoned quickly to implement a managed spreadsheet.

At least I learned two lessons: am more comfortable writing tokenizers using the regular call-back system than the automatically generated state machine from generators. I also learned that OOXML is very easy to parse, but it would be nice for PDF files to have hyperlinks in the spec.

I am probably missing a few things, but I did not catch all the blog posts this week.

Posted on 23 Feb 2008 by Miguel de Icaza

Game Developer's Conference

Some of us in the Mono team are in San Francisco for the Game Developers Conference at the Moscone Center.

For more details see Joseph's post Mono at the Game Developers Conference.

Posted on 20 Feb 2008 by Miguel de Icaza

Politics as Theater

My friend Jon Perr (he was Ximian's Marketing VP) did a fun presentation at Ignite Portland.

The presentation uses an unusual format: you talk for 5 minutes, and 20 slides are displayed, each for 15 seconds (they advance automatically).

Watch his presentation here. The slides contain more data than the 15 seconds allowed, so you can read that here (also check the notes).

Posted on 18 Feb 2008 by Miguel de Icaza

ThinkPad T61P Speed Problems

I recently upgraded to a ThinkPad T61p. I did not reinstally my OS, but instead just moved the old hard drive into the new machine.

The new machine is supposed to run at 2.4Ghz when plugged to the AC power, but it keeps going down to 1.2Ghz when am trying to get some work done (start a build: cpu speed goes down; Start firefox, cpu speed goes down). When am idling, the CPU speed will happily go back to 2.4Ghz. It can get as bad as 800Mhz, and in fact, it tends to boot in that mode at 800Mhz so booting takes forever.

The machine is cool, unlike the last laptop it does not feel warm at all (perhaps because it never performs better than a PC/XT).

I have Googled and Googled and various people seem to be having this problem across some other machines and Linux distributions, but there does not seem to be any solution posted. This is also not a new problem.

gnome-power-manager shows that the speed policy is "Always Maximum Speed":

This is what cpufreq-info shows:

I have tried:

  • powersave -f, it sometimes makes the machine go to 2.4Ghz, but it will happily go back to 1.2 a few seconds later.
  • Setting the minimal frequency in /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq by writing 2401000 to it. This sometimes works, but sometimes I get:
    		root# echo 2401000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 
    		sh: echo: write error: Invalid argument
    		
  • Calling: cpufreq-set -c 0 -d 2401000 -u 2401000 -g userspace this again works sometimes but when the CPU insists on sticking to 1.2Ghz it will just produce an error.
  • Variants on cpufreq-set's governor: I tried userspace, and performance. They both seem to fail sometimes, and work sometimes. When they work, the processor speeds only stays for a few seconds before it goes back to slow speed.
  • Tried disabling the speed stepping support in the BIOS. Although /proc/cpuinfo then reports that the CPU is running at 2.4Ghz, regular benchmark programs show that the machine is actually running at 1.2Ghz (building mcs goes from 2.7 seconds to 4.7).
  • Tried killing powesaved, gnome-power-manager to make sure they wre not interfering, they still do not work.

If you got some ideas, drop me an email, I will post any solutions

Posted on 13 Feb 2008 by Miguel de Icaza

MonoDevelop goes to MacOS X

We have released an updated Mono 1.2.6 package for MacOS X that contains Imendio's Native Gtk+ for OSX, Gtk# and MonoDevelop with Mac support. It is now available from our downloads page.

MonoDevelop on OSX.

MonoDevelop has pretty much the same feature parity than Linux does. There are a few missing features that we hope to resolve in the future, and there is plenty of room to improve.

Our recent efforts to better support the OSX stem from our belief that some Windows expats will want to continue building .NET applications using the Mac. And once they have updated their applications to run on the Mac, the code will run just as well on Linux.

Also, we believe that Unity3D developers will find auto-complete a useful tool when writing extension scripts for Unity. No templates or integration yet, but hopefully we will have those in the future.

This is only our first step.

MonoDevelop for Windows

Eventually, we would also like to bring MonoDevelop to Windows. Not to compete with SharpDevelop as they are focused on being a great IDE for Window developers. Our focus will be in bringing Stetic (our Gtk# GUI designer) to developers building cross platform applications.

Posted on 07 Feb 2008 by Miguel de Icaza

Updated Mono VM

Joseph blogs about our updated Mono VM. This new release is based on OpenSUSE 10.3 (instead of what we had been using which was based on 10.2).

It includes various new .NET and Mono applications that we had not shipped before (and that you can find the Mono:Community section of the Build Service).

Posted on 07 Feb 2008 by Miguel de Icaza

Lenovo ThinkPads preloaded with Linux

I was doing some shopping today for a Lenovo ThinkPad T series, and noticed that they are finally offering them with SUSE Linux Enterprise Desktop 10 preinstalled.

(At least in the US).

Posted on 07 Feb 2008 by Miguel de Icaza

Election Results

Larry Lessig has a fantastic presentation, in the very best Larry Lessig style, of why he supports Obama over Hillary. Chris has a transcript of the presentation for those reading blogs from work.

While reading CNN summary:

But the two-term senator from New York surpassed the one-term senator from Illinois when voters were asked about experience, with 91 percent of voters saying she "has the right experience," versus just 5 percent who said the same thing about Obama.

Both John F Kennedy and Bill Clinton were younger than Obama is today when they became presidents. It seems odd that this fact is not mentioned more often. (Update: Raphael pointed out that I used the wrong word here; Sorry, not a native speaker and all that).

And Wonkette goes through the checklist: Hillary Pre-Election Day Cry For Points: Check:

With Super Tuesday coming tomorrow, and polls showing Hillary Clinton in a dead heat with Barack Obama in states like, let’s see... Connecticut... it seemed like a good opportunity to CRY again. Not that this has anything to do with anything, but Hillary Clinton did cry in New Haven today while discussing children’s health care, one of the various things that she cares about. We’re ashamed at Hillary for this: If she had planned it around mid-afternoon, it might be a fresher topic for the evening news cycle.

Which is at odds with the speech I heard from her appearance in Massachusetts two nights ago when I jumped in a taxi. She was yelling repeatedly "am ready to lead" with a loud and strident voice. Which makes the perfect timing for the crying all too suspicious.

Larry Lessig's post underlines an important point about the way that Obama is conducting his campaign vs the way Hillary is. Hillary will have a debt with all the lobbyist, there will be favors to repay, concesions to make, special initiatives to pass through congress.

The video with Hillary's position on taking lobbyist's money is educational. Not only she is very happy taking their money, but she also twists facts when she says "They represent real Americans, they actually do". She should have added "The top 1% of Americans", you know, the Americans that actually count.

This is the complete context for the debate where the previous video was taken from. Edwards and Obama interventions are brilliant, "we do not have to start for the next election to start reforming, we need to start a grass roots movement to start reform today". Edwards and Obama went down this path: they did not take lobbyist money. Watch the full thing.

Obama as a president would not have those ties, he refuses to take money from the lobbyists.

Posted on 06 Feb 2008 by Miguel de Icaza

Moonlight Talks (Paris Tech Days, Las Vegas Mix 08)

Next week I will be in Paris for the Microsoft Tech Days talking about our work on Moonlight. JB Evain will be doing a tutorial on Moonlight on Monday as well. Sadly, due to all the work we have right now in Mono-land, I will only be in Paris for a very short time before I have to head back home. But hopefully Mono-ers and Opensourcers can have some dinner on Sunday night. Drop me an email.

I will also be speaking in depth at the Mix 08 about Moonlight. This will be a more detailed talk about Moonlight than the talk at Lang.NET which was more of a potpourri of Mono stories.

Posted on 04 Feb 2008 by Miguel de Icaza

MathMap

Only recently I found out about Mark Probst's MathMap plugin for the GIMP. I ran into it when he posted about a new feature in it called the MathMap Composer.

Check out this video demostration of MathMap's Composer.

I would have put a good screen capture of it, but Google Video seems to have regressed and no longer lets user skip over parts of the video.

Posted on 04 Feb 2008 by Miguel de Icaza

Mono Does Robotics

Shawn at Cogmation has written us to notify us that Mono is being used as the scripting engine for their robotFoundry application.

From their testimonial page:

We needed a portable cross-platform, architecture compiler system that would allow us to develop code on one OS or architecture and deploy it on another with out recompiling. The problem with using gcc was that for every target OS or architecture we would need a separate cross compiler. Additionally maintaining and developing this toolset would be a large task.

Initially Python was selected as our cross platform language. Python was great but we were always concerned with its speed, especially in real-time applications.

We discovered Mono while we were evaluating 3D engines. Mono was successfully being used to develop video games and it was extremely fast. We performed a small test and compared the speed between Python and C# mono and were shocked at how fast mono was compared to python. In addition to the speed increase and portability, we now had the ability to allow our users to write scripts in any .Net language.

Switching to Mono has given us the ability to write very fast cross platform applications and has provided us with a multi-language scripting interface, and the integration of Mono within our application suite has proved to be a huge success.

(Emphasis added).

From the product description:

robotFoundry is a powerful graphical coding environment for robotics. Use drag and drop modules to add functionality to your code, quickly linking them to create program flow and robot controls. Generate code with a click, and transfer your code to your robot or robotSim with another click.

Code for a physical robot or simulated robot at the same time - switch between them at any time to generate code for the robot or robotSim to run identical code. Choose from pre-existing robotFoundry robot templates, or add components to create your own. Many modules are available, ranging from simple controllers such as line trackers and wall followers to basic building blocks like variables, mathematics and logical operators. Choose your own level of programming, and allow robotFoundry to take the coding out of your coding.

Additionally their robotSim lets you simulate your robot software in a simulated virtual world. RobotSim is built using Unity3D which is also scripted with Mono:

RobotSim: Simulated Packbot with ARM

You can use robotFoundry and robotSim to write code for your Roomba or your iRobot Create without burning the batteries:

RobotSiming a Roomba

Posted on 03 Feb 2008 by Miguel de Icaza

Dave Winer Posts

Dave Winer has a couple of great posts on the campaign:

Here he points out:

Most of what Chris Matthews says is mindless trash, but today he pulled out a great analogy immediately after Ted Kennedy's stirring endorsement of Obama.

He compared Hillary Clinton to the character Salieri in the movie Amadeus. Until Mozart came along he was the leading composer in Vienna, but he was just a workman, a technician. Mozart had inspiration, feeling, the spirit. Salieri, even though he lived a long life and Mozart died young, is a footnote to Mozart's lasting greatness.

Matthews nailed it.

This is a great nugget that encapsulates perfectly how I feel about Hillary.

Dave also wrote: Bill Clinton as Trent Lott 2.0, some parts that I liked:

It was an interesting election until the Clintons started calling Obama the nice young African-American candidate.

[...]

The problem for Clinton is actually much worse, we now saw how she'd govern. Let's say a young African-American Senator from Illiinois got in the way. Would she argue the issues with him in a respectful way? Why bother when you can smear him into silence.

[...]

What a fantastic way to recover from Bush, who so completely represented the greed and arrogance and uglyness of America, to reinvent ourselves in the image of our best, in the image of hope.

(Emphasis added).

Posted on 01 Feb 2008 by Miguel de Icaza
This is a personal web page. Things said here do not represent the position of my employer.