Re:BananaBread: 3D first person shooter game compiled to JS+...
by pmr_ on Tuesday August 28, 2012 @02:58PM
(#4445276)
I'm wondering: Was the technique of compiling from C++ to JS primarily for code reuse? I always perceived the ability to code in something else besides C++ as one of the main advantages of the whole "Games on the Web" thing.
Re:BananaBread: 3D first person shooter game compiled to JS+...
by azakai on Tuesday August 28, 2012 @03:04PM
(#4445301)
Code reuse was a major reason, yeah. It was much, much easier to compile a full open source game engine (that was worked on for many years!), instead of writing a new one from scratch.
Another benefit is C++ compiled to JS tends to be faster than handwritten JS, because it avoid things like GC and property accesses and focuses on things JS engines can easily do fast, like typed array accesses.
Re:BananaBread: 3D first person shooter game compiled to JS+...
by idm on Tuesday August 28, 2012 @01:16PM
(#4444779)
It took a few tries on OSX/Chrome (no relevant errors from the console to report) but it seemed to be more reliable when running inside a "fresh" tab as opposed to one I had already reloaded several times.
Having played it, I must report back to say: this is stunning. It's wicked fast. Wow. Just wow.
Re:BananaBread: 3D first person shooter game compiled to JS+...
by azakai on Tuesday August 28, 2012 @12:32PM
(#4444520)
Strange, works for me on Firefox and Chrome. Can you look in the error console? Debug output goes there, could help narrow down the problem.
Edit: The "troubleshooting" section on the page might help.
Edit2: If that doesn't help, try clearing the cache and reloading, I've seen that fix things on Chrome, not sure why.
Edit3: And specifically for Chrome, make sure pointer lock is enabled, it's disabled by default.
Edit4: I think I can reproduce this, once every few runs it stalls like that, because Chrome fails to decode audio sometimes. Reloading fixes it for me.
Re:BananaBread: 3D first person shooter game compiled to JS+...
by azakai on Tuesday August 28, 2012 @12:51PM
(#4444619)
Thanks, that's very strange. It looks like the correct output during startup, and then it just stops.
It's not too surprising there are bugs here, this is one of the first examples of its kind on the web, and I'd expect issues in browsers and in the game itself. However it does work for me in multiple versions of Firefox and Chrome so I don't have a good guess as to what the problem could be in your case.
For a future version I'll try to put in more debug output, perhaps that will help.
Re:BananaBread: 3D first person shooter game compiled to JS+...
by RobotCaleb on Tuesday August 28, 2012 @01:29PM
(#4444852)
It did work once I tried Firefox. Pretty cool. Although, having to change my settings every time I went in (keys, mouse invert, mouse sensitivity) got old fast.
Clicking into one of the text boxes (mouse sensitivity) and hitting backspace caused the browser to go back in my history. :(
Re:BananaBread: 3D first person shooter game compiled to JS+...
by azakai on Tuesday August 28, 2012 @03:00PM
(#4445283)
See the troubleshooting section on the page - pointer lock is disabled in chrome by default, you need to enable it to run the demo (you can do so in chrome://flags).
Another benefit is C++ compiled to JS tends to be faster than handwritten JS, because it avoid things like GC and property accesses and focuses on things JS engines can easily do fast, like typed array accesses.
Having played it, I must report back to say: this is stunning. It's wicked fast. Wow. Just wow.
Was playable in low-ress mode, though sometimes laggy, on my 2010 MacBook Air with Chrome.
Edit: The "troubleshooting" section on the page might help.
Edit2: If that doesn't help, try clearing the cache and reloading, I've seen that fix things on Chrome, not sure why.
Edit3: And specifically for Chrome, make sure pointer lock is enabled, it's disabled by default.
Edit4: I think I can reproduce this, once every few runs it stalls like that, because Chrome fails to decode audio sometimes. Reloading fixes it for me.
Debug build is up at http://dl.dropbox.com/u/80664946/index.html which tells you what is causing startup to fail in the error console.
It's not too surprising there are bugs here, this is one of the first examples of its kind on the web, and I'd expect issues in browsers and in the game itself. However it does work for me in multiple versions of Firefox and Chrome so I don't have a good guess as to what the problem could be in your case.
For a future version I'll try to put in more debug output, perhaps that will help.
Clicking into one of the text boxes (mouse sensitivity) and hitting backspace caused the browser to go back in my history. :(
I've seen the "go back" bug myself a few times. Not sure yet what causes it, I think I saw it with the middle mouse button on Linux primarily.
Maybe next time ;)
(However, we haven't implemented saving the config file for next run yet, so it will just be for that run.)