Introduction to making HTML5/JavaScript games with Coquette.js
superbigtree.tumblr.com
superbigtree.tumblr.com
I'm not much of a game dev, but doesn't this imply a faulty game loop? Maybe this quote is just hand waving the minute details. This is my reference: http://gafferongames.com/game-physics/fix-your-timestep/ The final implementation of the game loop in that article doesn't always update and render at the same rate.
Do you have any sample code showing your two separate loops or did you get this from some webpage you could show me? My first reaction to what you said is, "won't that cause threading issues because your update could be half done while you're rendering?" Then I remembered JS is single threaded.
JS is of course single threaded but requestAnimationFrame can give browsers the option to batch stuff up and do it outside of the regular javascript execution - I don't know if any browsers actually do this but it's possible. The main thing is that if your rendering FPS is low due to a lot of elements/sprites/whatever on the screen, your game logic loop could potentially still be run at full speed while requestAnimationFrame stumbles along at a lower rate. End result being that you could actually increase your FPS, because the game logic isn't sitting around waiting as long between render frames to update.
Of course, setInterval doesn't guarantee a constant speed loop either, but it's at least designed to be as consistent as possible.
Here's a relevant article: http://www.chandlerprall.com/2012/06/requestanimationframe-i...
if (obj1BoundingBox === this.RECTANGLE &&
obj2BoundingBox === this.RECTANGLE)
return Maths.rectanglesIntersecting(obj1, obj2);
which means it will not work for moving objectsFor most purposes this type of collision is fine. It's a lot quicker too - doing line intersections for every potential collision is quite intensive. Often it's best to reserve more thorough checks for objects like bullets which you know will be moving fast.
ImpactJS
LimeJS
CraftyJS
Cocos2D
It's got links to some awesome stuff, including voxel.js (http://voxeljs.com), a set of tools for building minecraft-like games in the browser.
Relatedly, I've been working on a set of js game modules that rely on node.js/browserify called crtrdg: http://crtrdg.github.io – it's not very far along yet, but I'm having fun with it.
Also check out frozen: http://frozenjs.com/docs/ And pixi.js: http://www.pixijs.com/
and: http://coquette.maryrosecook.com/demos/advanced/
And you can see a demo of the game I made with coquette here: http://sethvincent.github.io/BlockSnot/