rich

Phaser 2.5 + Pixi v3 Build for testing

Recommended Posts

Hi all,

After a bit of experimenting I've prepared a build of Phaser 2.5 that contains Pixi v3.0.9 - the latest stable build.

The way it works is that I've taken the Pixi v3 build file and just include that directly. I then hook into this as needed. This means that the file size has increased quite a lot. The min.js is now 926KB for the full-monty version (all features, P2 physics, etc). This gzips down to 220KB. The Arcade Physics min.js is 763KB, which gzips to 182KB.

It also means you can no longer choose to do things like 'remove Graphics' or 'remove TileSprites' from a custom build. It will remove the Phaser side, but the Pixi files will still be left in. Better than nothing though.

However as a result of the merge you get all the benefits and new features that Pixi v3.0.9 brings to the table, so I guess it's a trade-off for you to decide about.

I've tested lots of the Phaser Examples and most of them work. There are some known issues at the moment: Videos don't render for example, and Filters mostly work, but some of them have issues I've not tracked down yet. Oh and on Retina screens the canvas appears scaled-down (1:1 resolution). On the whole all the usual suspects are in and rendering just fine: Graphics, Tilemaps, Sprites, Physics, Text, Bitmap Fonts, etc.

If you want to give this a test then grab it from here: https://github.com/photonstorm/phaser/tree/pixi3/build

I'd be curious to know how you get on with it. It's entirely possible your game won't run at all, and if it crashes I'd like to know where :) If you do anything that modified the Phaser internals (and by proxy the Pixi internals) significantly, then that probably will no longer work either.

Still - several of you asked for this, so here you go! Eat your hearts out :)

Cheers,

Rich

Share this post


Link to post
Share on other sites

Thanks for this build Rich.

Error on text.destroy()

var style2 = { font: "10px bariol_boldbold" };
var text2:Phaser.Text = this.add.text(0, 0, "1234567890%", style2);
text2.destroy();

 

Буфер обмена-1.png

Share this post


Link to post
Share on other sites

I am also getting the same error when chaging state:

Phaser v2.5.0-dev | Pixi.js 3.0.9 | WebGL | WebAudio     http://phaser.io ♥♥♥

Uncaught TypeError: this._destroyCachedSprite is not a function    phaser.min.js:20
c.Component.Destroy.destroy @ phaser.min.js:20
c.TileSprite.destroy @ phaser.min.js:22
c.Group.removeAll @ phaser.min.js:18
c.Group.destroy @ phaser.min.js:18
c.World.shutdown @ phaser.min.js:18
c.StateManager.clearCurrentState @ phaser.min.js:17
c.StateManager.preUpdate @ phaser.min.js:17
c.Game.updateLogic @ phaser.min.js:18
c.Game.update @ phaser.min.js:18
c.RequestAnimationFrame.updateRAF @ phaser.min.js:23
window.requestAnimationFrame.forceSetTimeOut._onLoop @ phaser.min.js:23

Note that I'm not destroying explicitly any sprite.

Share this post


Link to post
Share on other sites
26 minutes ago, rich said:

A new build is now uploaded which has the Destroy issues fixed in it. Should be a drop-in replacement, so please give it a go!

Tested the new build and it worked ok with my game ;).

Both phaser.min.js and custom phaser build with arcade physics were ok.

 

I had to change

sprite.worldPosition.x

to

sprite.world.x

Also, for every

game.add.tileSprite(0, 0, game.world.width, game.world.height, 'my_image');

I get the following warning (it's just a warning, it still works):

The TilingSprite class has been moved to extras.TilingSprite, please use extras.TilingSprite from now on

 

I didn't fully understand your first post regarding custom builds.

I actually use this build:

grunt custom --exclude gamepad,bitmapdata,graphics,text,bitmaptext,retrofont,rope,net,debug,create,flexgrid,color,ninja,p2,tilemaps,particles,creature,video --filename phaser --uglify

that gives me an awesome 405kb build (versus a 746kb for the arcade physics build, which is also not bad).

Will I be able to do a custom build of the 2.5 version when (if it will) be released as stable?

 

Thanks ;)

Share this post


Link to post
Share on other sites

I did some more testing, this time on mobile.

I tested in a cordova/crosswalk (both latest stable versions) application on android tablet and phone.

I noticed an overall fps drop.

With phaser 2.4.4 I get near 60fps on both devices.

With phaser 2.5 I got near 30fps also on both.

It only worked ok with canvas (Phaser.CANVAS).

With WebGL (Phaser.WEBGL) the images were blurry and with no color.

 

Share this post


Link to post
Share on other sites

Hmm TileSprites work fine for me without throwing any errors. Very weird!

My comment about the Custom builds means that in Phaser 2.4 if you exclude say Graphics from your custom build, it doesn't include any of the Pixi Graphics files either, saving lots of space. But with the way I have to do it for Pixi 3 all of the Pixi Graphics files remain in there no matter what, they cannot be excluded now. Only the Phaser Graphics file is removed. Basically it takes up more room.

Share this post


Link to post
Share on other sites

Tested it in my Metroid remake and the tilemap wont scroll. As expected it's only a graphical bug, the collisions works as expected where the tiles should be and the sprites scrolls correctly.

What are the benefits of integrating Pixi 3? Performance?

Share this post


Link to post
Share on other sites

Stress testing (mostly straight blitting, a little masking and render targetting) on windows7 Chrome, I get these FPS:

Canvas:    Pixi2-41, Pixi3-40

WebGL:    Pixi2-15, Pixi3-5

 

Notes (with Pixi3 in WebGL mode):

- the render target isnt quite right, of the gfx drawn into a render target the position is offset and the scaling too small

- I get this warning "FXAA antialiasing being used instead of native antialiasing"

Share this post


Link to post
Share on other sites
1 hour ago, nkholski said:

Tested it in my Metroid remake and the tilemap wont scroll. As expected it's only a graphical bug, the collisions works as expected where the tiles should be and the sprites scrolls correctly.

What are the benefits of integrating Pixi 3? Performance?

I've just uploaded a new build which should solve that, but let me know if not please.

Share this post


Link to post
Share on other sites
1 hour ago, stupot said:

Stress testing (mostly straight blitting, a little masking and render targetting) on windows7 Chrome, I get these FPS:

Canvas:    Pixi2-41, Pixi3-40

WebGL:    Pixi2-15, Pixi3-5

 

Notes (with Pixi3 in WebGL mode):

- the render target isnt quite right, of the gfx drawn into a render target the position is offset and the scaling too small

- I get this warning "FXAA antialiasing being used instead of native antialiasing"

Most people are reporting it to be much slower, which is hardly encouraging.

The FXAA warning - is that coming from Chrome itself, or from Pixi?

Share this post


Link to post
Share on other sites
11 hours ago, rich said:

Most people are reporting it to be much slower, which is hardly encouraging.

The FXAA warning - is that coming from Chrome itself, or from Pixi?

I'm on a different machine today, but with the same code and browser and OS and WebGL mode, I'm not getting the FXAA warning and the FPS has jumped up to 59.  I'm pretty sure the FXAA warning was originating from phaser.js.

My stress tester app is nothing specific, it's just a 'normal' game but I don't use much of the capabilities of Phaser, like physics or tilemaps as these appear to bog it down, I just mostly use plain drawing and the scenegraph - so my app is a fairly good for testing the performance of the underlying renderer and I loop the render call to stress it out (currently it took 33 render loops before the FPS showed any movement away from the max).

I've also juist noticed that text isn't being updated in WebGL mode, it gets set correctly when created but subsequent updates to the text aren't appearing.

Share this post


Link to post
Share on other sites

Phaser with pixi v3 it's a great news!!!
I tryed run my current project on iPad, it's doesn't start. 
Show me next error

56b9a9f553951_2016-02-0911-56-17WebInspe

On desktop game was start, but I'm using this.game.load.atlasJSONArray (atlas was create with texture packer) and my sprites bounds calculate incorrect, for example:
56b9ab34325ce_2016-02-0912-02-14Pac-Xon.

Share this post


Link to post
Share on other sites
On 2016-02-07 at 0:53 AM, rich said:

I've just uploaded a new build which should solve that, but let me know if not please.

Whatever you did fixed it. I'm unable to see any changes in performance compared to 2.3.x (60fps as before) and everything seems to work alright, but I literally tested it with my left hand only having a sleeping baby on my right arm. I'll test it more thoroughly when I get a chance.

Share this post


Link to post
Share on other sites

I'm still not sure this endeavor is actually worth it. Perhaps someone could show me something that Pixi 3 has that is a big benefit over Pixi 2? So far I seem to be  getting the same FPS rate as before, with nothing but an increased file size (and broken filters) to show for it :(

Share this post


Link to post
Share on other sites
3 hours ago, rich said:

New build uploaded with fix for SoundManager unlock in.

Thanks for this!

Should I just call this.game.sound.unlock() on first interaction, or does it happen automatically under the hood?

Can't readily test it on iDevice unfortunately, hence asking.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.