Jump to content

Phaser/Pixi + Ash.JS


johnnyangel
 Share

Recommended Posts

Hi folks.

 

I've been a long time follower of PhotonStorm in the Flash world.  Played plenty of their games and such.  

 

I've been working on a Flash-to-JS port of a game of mine.  Currently it uses RequireJS, EaselJS and the JS port of the Ash Entity Framework.  It works OK but EaselJS a) doesn't seem to be all that performant and B) doesn't render at all on any iOS device or via PhoneGap.  I'm wondering if any folks here have had any luck using Phaser or Pixi along with RequireJS and as a bonus question, maybe used it with Ash?

 

The things that I loved about EaselJS was the virtual parity in terms of APIs with Flash's displayObject.  Coming from a flash development background, I felt at home with most of the APIs.  I have dug around in Phaser's code but the API docs don't render for me.  Any thoughts on this?

 

Thanks in advance.

Johnny

Link to comment
Share on other sites

Do the docs work for you if accessed from here: http://gametest.mobi/phaser/docs/Phaser.html ?

 

I understand the appeal of emulating the Flash API, I really do :) But I also feel that it may lull you into a false sense of "I'll code it like I would have done in Flash", because the API is the same, yet that may not be the best way to go about it. Things that were quite trivial for Flash (in terms of processing cost) can sometimes be the opposite for HTML5, and the same is true in reverse too.

 

Several of my clients use requireJS to embed and set-up the games, but I don't use it for actually developing Phaser games. Others here may.

 

Good luck with your conversion!

Link to comment
Share on other sites

Yes those API docs work.  The ones that are bundled with the download had some reference to D:\wamp\www\phaser\src/IntroDocs.js.  

 

I completely agree with your statement about the Flash API and have wondered if maybe that's why EaselJS seems so under-performant.  To change from EaselJS to Phaser/Pixi would be trivial I hope.  Though I do wonder how easy it would be to handle some of the mouse/touch interaction of individual entities.

 

Would Phaser play nicely with Ash?  I love Ash as a game framework however it is a low level framework such that I still have to write much of the system logic.

Link to comment
Share on other sites

Oh that D:\ thing is just JSDoc being funky parsing the doc files, as long as the drop-down menus work then you've got all the docs.

 

Phaser has pretty decent support for mouse/touch interaction on any Sprite, to a pixel-perfect level if needed (it's optional though, as it's quite expensive on mobile), and proper drag/drop and multi-touch support. So I wouldn't be too worried about that aspect of it honestly.

 

As for integrating Ash I'm afraid I really couldn't say, it might be trivial, it might be a real ball-ache! I really don't know, sorry.

Link to comment
Share on other sites

Ok so I think Ash & Phaser can play nice together.  One thing I'm having a hard time finding is how to manually update the Game update loop.  All I tell at the moment is that I would have to either remove the Game.raf or pause/play manually.  Is there a better way of doing this?  Are there any planned APIs such that we can delegate the render update loop to another framework, library or util?

 

Having it automatically kickoff might work for Phaser-only applications, but in my case not so. I want to use Ash to help supplement much of the game logic and use Phaser mostly for rendering, physics, etc.

Link to comment
Share on other sites

one thing I notices is that if I use game.raf.stop() then manually call game.raf.updateRaf(time) that inside the game.update(time) the subsystems are not called to update.  I'm not sure what that implies but I would assume alot of things wouldn't update as expected?  

 

Link to comment
Share on other sites

If you're disabling raf then you need to call Game.update and pass it a timestamp so it can then update all of the other subsystems. If all Ash is doing is supplementing game logic then it makes a lot more sense to have the core game loop call it, then have it dictate when the update happens imho. Even so, calling update will work.

Link to comment
Share on other sites

honestly I don't see how you'll get ash and phaser to play well together.

 

ash, being an entity framework, is designed to run the game loop in its own way, and to eschew the OOP way of organizing data and behaviors into objects in favour of completely separating them. (http://www.richardlord.net/blog/what-is-an-entity-framework)

 

phaser, on the other hand, is an object-oriented framework. its objects contain the data and the logic for how they operate, which runs exactly counter to how entity frameworks are designed.

 

so even if you manage to munge the two together, it seems to me that you'll end up with a frankenstein's monster...

 

just my 0.02 monetary units :)

Link to comment
Share on other sites

@jcs

Well I'm hoping you're wrong but that's something that concerns me.  It might be that I need only parts of Phaser.  Or as Rich stated, it might be rather than force a Phaser.game instance into an Ash application, I might try to reverse it such that parts of Ash are used in a Phaser app.  Ash is much more flexible in terms of how you implement it.  I've just been accustom to building alot of what Phaser offers from scratch.  Man I really hope these 2 can play nicely.

 

I got some stuff figured out so I will report back once I get some stuff going.  Thanks for the input guys.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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