Jump to content

Phaser with Backbone


hhumph
 Share

Recommended Posts

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

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.html

and

http://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

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

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...