Home | Rules and Guide | Sign In/Create Account | Write a Post | Reddit | #LD48 | #ludumdare on irc.afternet.org (Info)

Ludum Dare 30 — August 22nd-25th 2014 — Theme: Connected Worlds
  • Judging Ends: in 14 days, 17 hours, 18 minutes, 3 seconds
  • [ Real World Gatherings | Ludum Deals | Warmup Weekend (Games) | MiniLD #53 | Wallpaper (1) (2) (3) | Mailing List ]

    [ Play+Rate | Edit | View All Games | My Game ]


    C++ to JavaScript!? Unpossible!

    Posted by (twitter: @mikekasprzak)
    April 27th, 2012 2:10 pm

    Even I don’t believe it myself.

    So I did a writeup about the blasphemy I did last weekend: Creating an HTML5 (JavaScript) game in C++. You can read it here:

    http://www.toonormal.com/a-technical-look-at-c-gamedev-in-the-browser/

    Also, there’s a newer “Post Compo” version of the game out now. There’s no new content, but it should run better for everyone.

    NOOK - New Post Compo 60 FPS version

    So ya, maybe HTML5 isn’t as good as Flash yet, but it’s getting there. :)

    EDIT: Oops, Ludum Dare link is here, just in case you want to rate it: http://www.ludumdare.com/compo/ludum-dare-23/?action=preview&uid=19

    4 Responses to “C++ to JavaScript!? Unpossible!”

    1. mildmojo says:

      Every time I see one of these articles about porting a C++ game to JS with emscripten, I’m more amazed that it’s even possible.

    2. Canard Sauvage says:

      I’m more amazed people are really doing this. I can only think about one reason: Because we can.

      But honestly – C++ is only for system programming or highly optimised games. Why would you ever wanna do something like this?! It’s just crazy!

      • PoV says:

        0. Like you said, highly optimized games can ‘in a way’ be brought to the browser now. ;). Adobe Alchemy and NaCl are a better solution for this when it comes to raw performance, but now we can do a smidgen of it without any plugin dependencies.

        1. It’s portable. Same code can run as-is on every platform, from Consoles to Mobiles, without paying for expensive middleware. And now Web is part of the toolkit.

        2. Type safety. While I do enjoy some of the flexibility regarding types in JS, I’m not bothered by rigid and explicit types.

        3. Operators and Overloading. When dealing with vector and matrix math, it’s SO MUCH NICER to have operators set up to multiply, add, divide, than calling MyVector = add_Vector2D(Vec1, Vec2).

        4. Existing codebases. I have a suite of container types with no equal across many languages. I can compress or uncompress data in to a variety of formats with a single function call. I can bring the game logic behind a mobile game to the browser as-in, no changes required.

        5. It’s crazy. :D

      • Raptor85 says:

        In my case…..
        1. Because to me working in javascript is a royal pain, I can fare more efficiently write C++ code than javascript as the language just “clicks” better for me (that and 10+ years of experience in it doesn’t hurt)

        2. I can use my existing code and libraries where working in “pure” javascript or the other solutions I would have to rewrite everything from scratch, which also means now my native version and browser version need to be maintained seperately

        I haven’t had much success porting my SDL stuff into this yet but when it does work this will be a godsend for developign web games/web versions of my existing work.

        About alchemy and NaCL too, alchemy being that it runs on air is a non-option for anything but windows really, adobe cut linux support completely on it and only the old 32 bit binary is on “unsupported” life support mode, and NaCL is currently chrome only, so while they’re better performance-wise html5 is the overall better solution as I can be fairly sure it’ll run everywhere as opposed to just a small subset of windows users who either have air or chrome installed.

    Leave a Reply

    You must be logged in to post a comment.


    All posts, images, and comments are owned by their creators.

    [cache: storing page]