rich

Phaser 2.2.0 "Bethal" is Released (+ 2.2.1 Update)

Recommended Posts

After hundreds of hours of hard work, 13 Release Candidates and changes pretty much across the whole board - Phaser 2.2 is out!

 

2.2.1 Update

 

There were a couple of small but really important bugs that slipped in at the last minute, one involving alpha not working in Pixi.js in WebGL mode, and the other a Tween Manager update. These have been rolled into a 2.2.1 release which is now live. Everything else remains the same as with 2.2.0, no API changes took place, so it's a safe direct update.

 

What's new in 2.2.0?

 

One of the nicest and most surprising things about a truly open-source project like Phaser is that you never know who might jump on for the ride. I've been extremely lucky with the support I've received over the years - fellow developers both fixing bugs and reporting issues, all helping to make Phaser  stronger as a result.

 

But sometimes a single individual can come along and make a substantial difference all on their own. A quick glance at the Change Log for this release will show many different contributors, but one stood out more than any other: Paul Stickney. Thanks to his contributions alone Phaser is now sporting a powerful new Scale Manager, nicely updated API docs and many other fixes and features across the board. The Scale Manager, a core part of any HTML5 game has had its own book published about it: A Guide to the Phaser Scale Manager which is available now.

 

One of his other major contributions was in updating Signals, the event system used inside Phaser. Before Phaser was creating thousands of Signals in a busy game, most of which sat idle. Now they've gone on a diet in terms of memory consumption and hide behind a proxy causing them to not even be created unless needed. This has cut down on the amount of objects being generated every frame dramatically.

 

As you may have noticed we've bumped the release version to 2.2 from 2.1. This is because there are some API breaking changes and some core fundamentals have been updated as well. The biggest change here is the move to a proper fixed-step internal game loop. The logic and rendering are now fully decoupled, with both Arcade Physics and Tweens having been updated to use this new system. This is by no means a panacea for overloading low-powered mobile devices. However it will help prevent issues arising from devices running Phaser games at different speeds just because it has a slower processor.

 

Also given a large update is the Tween Manager. This is now hooked in to the new timestep code, smoothing out tweens when the frame rate drops. New features have been added, including the ability to pause and resume a whole timeline of tweens and tween chaining has vastly improved.

 

The Change Log is indeed extensive. I would say that if you are *already* working on a Phaser game, and a good way through development, then you should carry on with whatever version you used before. But for all new projects definitely take the leap into 2.2 and I hope you enjoy splashing around in its new features :)

 

Thank you to everyone who beta tested 2.2 with us in one of its many Release Candidate incarnations. Your feedback helped fix issues that would have been otherwise troublesome to find and it's a process we'll carry on with for future builds.

 

2014 has been an amazing year for Phaser and I'd like to take this opportunity to thank everyone who has been involved, one way or another. Your support has been fantastic and we've built great things. Here's to 2015.

 

Cheers,

 

Rich

Share this post


Link to post
Share on other sites

Just to say that I'm aware of the issue with "alpha" not working on any display object. Was an upstream Pixi issue introduced very recently, which Mat kindly just fixed and is already in phaser dev. I'll likely do a small point release tomorrow to resolve this.

Share this post


Link to post
Share on other sites

p2 always used a fixed step update anyway (internally, of it's own making) so it doesn't change how that works. Ninja hasn't been updated for this, no.

 

I'm reading the source code and I'm really happy with what I see on the implementation of physics. At least by what I understand and please correct me if I'm wrong, the physics step runs in the updateLogic method, which runs just enough times to keep with a desired fps, which its kind of like if it had its own clock. Even though before p2 could run with a numerically fixed step, the step method was called the same number of times that the rendering methods; so using a slower p2.frameRate in the same machine would make the game physics movements aparently go faster. It seems now the p2 clock is also properly decoupled which is a lot nicer; I can just use a p2.frameRate that is proportional to the desiredFps to solve my time accuracy problems.

It still would be nice if the rendering took into account each sprite's velocity in order to interpolate its position accross multiple render updates between two logic updates, but the overall change in how the update works is very cool and makes precise mechanics much more easier to implement.

So thank you again; I'm really glad for Phaser 2.2.

--

P.D.

Also, I'm probably wrong, I'm still learning about videogame programming and programming in general, so sorry if I'm wrong. I'll say this any way for if it helps somehow:

Line 774 of Game.js, which is

this.updateRender(this._deltaTime / slowStep);

seems to pass to update render what is equivalent to updatesThisFrame, not elapsedTime. I doesn't seem to be used or to affect something, but I thought there's something weird with that and it might help somebody. I know I'm probably wrong, so please forgive me if i'm being a fool.

Share this post


Link to post
Share on other sites

Hi,

We used to be able to set the alpha of a sprite > 1. It gave a very nice looking effect (in WebGL). It seems that now the alpha behavior changed, and we lost this effect. Is there a way to get something equivalent?

 

Cheers!

Share this post


Link to post
Share on other sites

We used to be able to set the alpha of a sprite > 1. It gave a very nice looking effect (in WebGL). It seems that now the alpha behavior changed, and we lost this effect. Is there a way to get something equivalent?

 

This was almost certainly unintentional - an alpha below 0 or above 1 makes no sense. If you could demonstrate the effect we could maybe suggest an alternative (and proper) way to achieve it?

Share this post


Link to post
Share on other sites

This was almost certainly unintentional - an alpha below 0 or above 1 makes no sense. If you could demonstrate the effect we could maybe suggest an alternative (and proper) way to achieve it?

Quite certainly :) Noticed this by mistake once.

 

 

Actually I've just done a little test; it seems to boost the contrast of the sprite. Interesting... this is pixi-level functionality so I think you'd maybe need to take a look over there to see what's changed.

 

I shall look into it. Just prefered to post here first.

Share this post


Link to post
Share on other sites

Hey Rich, I'm still having an issue with the update. Here is the error and call stack:

 

Uncaught TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': No function was found that matched the signature provided.phaser.js:70314

c.Tileset.drawphaser.js:69247

c.TilemapLayer.renderRegionphaser.js:69368

c.TilemapLayer.renderFullphaser.js:69440

c.TilemapLayer.renderphaser.js:68773

c.TilemapLayer.postUpdate

 

I've been experimenting but have not had luck narrowing down the problem. Aside from the obvious fact that it is from rendering the tile layers.

Share this post


Link to post
Share on other sites

Hey Rich, I figured out the problem and wanted to relay the info back. I was using tilesets in Tiled that were functional and not meant to be displayed. So, I would just not load the tileset image and that was working to create the tile but prevent it appearing at all. In this version (of Phaser or PIXI, I'm not sure), something changed where an unloaded tileset will now crash instead of just not being drawn.

Share this post


Link to post
Share on other sites

You mention the fixed-step internal game loop, and that logic and rendering are now fully decoupled.

 

I assume that "logic" means the State.update() function and "rendering" means the State.render() function?

Also, where can I set the "size" of the step? I wish that the update function would be called once per second without any extra code. Is that possible?

 

And yeah, I love this release. Many useful changes/additions for my project! :)

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.