hhumph Posted October 11, 2013 Share Posted October 11, 2013 Hi - I've just started working with Phaser and I was wondering if anyone has any experience of integrating this into something like backbone? What are your experiences? Is it worth the effort? Thanks,Helen Link to comment Share on other sites More sharing options...
Mike Posted October 11, 2013 Share Posted October 11, 2013 My first thoughts are that backbone is not a code for developing games and... i think that what you need are more game oriented codebases.Also as there aren't many big html5 games everyone has their own style of dealing with objects and modularity and so on... check this: http://addyosmani.com/writing-modular-js/ So imho it's better to stream your efforts for using some pattern with Phaser or something which is good for you Link to comment Share on other sites More sharing options...
mwatt Posted October 13, 2013 Share Posted October 13, 2013 I agree with Mike (above). Backbone is most pertinent when you are doing MVCish stuff, particularly with RESTful access to a server on the backend. Most games are client only and don't have a lot of table data (though there are certainly exceptions). For structure suggestions, here are a couple of other links that discuss hand-rolled modules without having to go whole hog with AMD and RequireJS or even just CommonJS: http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.htmlandhttp://www.htmlgoodies.com/html5/client/javascript-game-code-organization.html#fbid=N35a_4NiiTn It is also pretty common to create modules that consist of "classical, oop-like" JavaScript objects (with function constructors, prototyped methods and new). You can store a constructor like this in a single global namespace variable to minimize namespace pollution, same as you would do with non-oop closure type modules. You can find these articles and other pertinent articles in the design section or via the search page of my site at:http://uberiquity.com Link to comment Share on other sites More sharing options...
abiyasa Posted October 16, 2013 Share Posted October 16, 2013 Hi, I have experience combining Backbone with CreateJS and Ash.js. I use Backbone.js for managing screens (title, game, and pause screen) and also the game UI. The game logic itself is a separated module (not using Backbone) and used only in game screen. Have a look at https://github.com/abiyasa/ashteroids-js ;-) It's not necessary to use Backbone (or other your favorite MVC framework) but there are some advantages:- Screens and Game UI are implemented & styled using standard HTML & CSS through templating system.- You can apply those pretty HTML5 & CSS3 effects for your game screens. You can event use jQuery or other JS UI library.- You could have web designer to help you designing the screens- Separation between screens and the game logic- Since this is a SPA (Single-page-application) you only need 1 html file (index.html) for all screens. Link to comment Share on other sites More sharing options...
hhumph Posted October 17, 2013 Author Share Posted October 17, 2013 Thanks for your replies and your help in explaining the advantages and ( mostly ) disadvantages of using MVC in game dev. I've decided to attempt using the same kind of route as Abiyasa and use backbone to handle my screens and during gameplay kick off phaser in it's own module away from backbone. Hopefully this will mean I'll get the best of both worlds. Thanks again!Helen Link to comment Share on other sites More sharing options...
Recommended Posts