Python and Farseer: 2d Physics in Silverlight
Silverlight is a Microsoft browser plugin competing with Flash for rich internet applications and games (amongst other things). The most interesting thing about Silverlight, to me at any rate, is that it allows client-side web applications that run in the browser to be written in IronPython - including full access to the browser DOM.
Silverlight is now maturing, with version 3.0 released only recently. Silverlight runs natively on Windows and the Mac on Firefox, Safari and Internet Explorer browsers. The Mono version for Linux, Moonlight, has reached the level of compatibility where it is capable of running DLR applications - like my IronPython examples.
There are now lots of interesting open source libraries for developing Silverlight applications. One of them is the Farseer Physics Engine:
The Farseer Physics Engine is an easy to use 2D physics engine designed for Microsoft’s XNA and Silverlight platforms. The Farseer Physics Engine focuses on simplicity, useful features, and enabling the creation of fun, dynamic games.
Tarn Barford has posted a blog entry on developing Silverlight applications with IronPython and Farseer - including a demo with source code available:
I limited the example for this post to a very simple, but interactive 2d physics demo. Clicking any of the objects in the simulation creates a spring between the object and the mouse cursor until the mouse click is released or leaves the simulation view area.The Farseer physics engine is a lot of fun to use, it’s easy to get into and you can do some really cool stuff with it.The source code is sent as plain text and compiled (or interpreted) on client. As the XAP is just a normal zip file, it can unzipped by almost any zip tool. Inside is all the plain text source code, compiled assemblies and manifest file.It’s awesome to be able to develop Silverlight applications with physics libraries using a high level language and light weight development environment. Happy hacking.
Comments
Post a Comment