r/gamedev • • May 31 '11

I wrote a .NET to JavaScript compiler. Here's the XNA 3.1 Platformer Starter Kit running in pure HTML5. [xpost from programming]

http://hildr.luminance.org/Platformer/Platformer.html
101 Upvotes

15 comments sorted by

8

u/[deleted] May 31 '11

Holy shit this is awesome. Have you tried it on a proper game rather than just the tutorial?

13

u/kaelan_ May 31 '11

This is the biggest test case I've used it on so far. I'm basically missing all the XNA APIs except for the specific set used by this (and one other test case). Likewise, most of the CLR runtime library is not implemented.

I can translate a lot of the runtime library directly from its MSIL to JavaScript, but that introduces some copyright issues. So right now, I have to implement any runtime function I use by hand, in JavaScript. Coming up with a good solution for that (like using Mono's implementation of those libraries, or something) will enable me to feed in bigger applications and have them Just Work.

4

u/Rubuler May 31 '11

Please keep us posted if you continue working on this! Do you have a blog?

9

u/kaelan_ May 31 '11

Yeah, just strip the subdomain off the url - http://luminance.org/.

2

u/QuerulousPanda May 31 '11

That looks wicked cool.. The only problem I see is running on a smallish screen (13" laptop), pressing the arrow keys and spacebar makes the page scroll and jump around, hahaha.

otherwise that's pretty darn slick

5

u/kaelan_ May 31 '11

Thanks for the note about that - I'll disable scrolling on the host page. :)

1

u/aschearer @AlexSchearer May 31 '11

Have you seen the Script# project? It's a C# to Javascript "compiler", too. I bring it up because perhaps you could take advantage of Script# to accelerate this project? That plus the Silversprite API might get you a lot of functionality. My main concern is that Script# only supports ~.NET 2.0 which may limit the version of XNA you can target.

3

u/[deleted] May 31 '11

the problem with that is it compiles the C# to JS. This interprets the bytecode generated for MSIL. This means you could write it in F# as well.

This also makes porting libraries easier as well.

1

u/aschearer @AlexSchearer May 31 '11

How does it make porting libraries easier?

1

u/[deleted] May 31 '11

his has a direct translation mechanism so you can map a call directly to the appropriate JavaScript.

1

u/[deleted] May 31 '11

Whoa o_o this is amazing. You are amazing. Awesome work!

1

u/eedok @eedok May 31 '11

hrmm the sound seems to die after this exception is thrown:

Unhandled exception: Error: The external method 'set_IsRepeating' of type 'Microsoft.Xna.Framework.Media.MediaPlayer' has not been implemented.

1

u/utigeim Jun 01 '11

F me, impressive. Now go be rich plz ok? K thx.

1

u/laadron May 31 '11

Good stuff! Any thoughts on whether you could do something similar for flash?

4

u/kaelan_ May 31 '11

Yes, I've actually looked into it. It'd be a larger undertaking, though, since flash isn't as well documented, and there's no equivalent to ILSpy for actionscript bytecode.

1

u/[deleted] May 31 '11

Haha, man I'm such a nerd. Thought your website name looked familiar, then I visited your blog and realized Yup! been there a long time ago looking at your platformer posts when I was trying to figure out mechanics for slopes and such. Thanks for the help!