Jump to content

Phaser 2.4 Release Candidate 2


Recommended Posts

Hi all,


 


Just wanted to say that RC2 of Phaser 2.4 is now available for download.


 


More details here: http://phaser.io/news/2015/07/phaser24-rc2


 


Even since RC1 there have been some truly significant updates - the rewritten Cache, the new DeviceButton class, etc. The change log seems to scroll on even further now  :)


 


As before please give it a test - pay attention to the "deprecated" list in the change log too, as some things have now been removed. But it'd be great if you could drop it into your games.


 


You'll find loads of new examples in the examples repo too, showing off things like video playback and Text tabs.


 


Feel free to post issues here or on github.


 


Cheers,


 


Rich


Link to post
Share on other sites

Hi, as we started making new game, I decided to go with Phaser 2.4.0 RC2 (I was also looking forward to try it :)). I changed from Phaser 2.3.0 and got some errors related to Typescript defs.

 

First - there is difference between commented defs and uncommented. The uncommented seems to be older, as for example BitmapText does not have anchor defined. Also for example getFrameByIndex is defined as: getFrameByIndex(key: string, frame: string): Phaser.Frame; instead of getFrameByIndex(key: string, frame: number): Phaser.Frame; (which is corrected in uncommented version),

 

In both versions I found missing "inputEnabled" for Phaser.Graphics, as well as "events" for it.

Link to post
Share on other sites

Phaser.Mouse.LEFT_BUTTON/RIGHT_BUTTON/MIDDLE_BUTTON were removed? They'd still be useful when evaluating which button triggered an event (and the values are different than for the buttons bitmask).

 

I think you find them on the Phaser.Pointer class now.  Ahh thanks for correcting me @wayfinder

Link to post
Share on other sites

Hi, as we started making new game, I decided to go with Phaser 2.4.0 RC2 (I was also looking forward to try it :)). I changed from Phaser 2.3.0 and got some errors related to Typescript defs.

 

First - there is difference between commented defs and uncommented. The uncommented seems to be older, as for example BitmapText does not have anchor defined. Also for example getFrameByIndex is defined as: getFrameByIndex(key: string, frame: string): Phaser.Frame; instead of getFrameByIndex(key: string, frame: number): Phaser.Frame; (which is corrected in uncommented version),

 

In both versions I found missing "inputEnabled" for Phaser.Graphics, as well as "events" for it.

 

The Uncommented one is always the most up to date. 

 

Things started getting a bit out of hand when the Component System was added. I do not for example use BitmapText anywhere so finding mistakes is hard. 

 

I have implemented the component system here *edit: back to drawing board*

Link to post
Share on other sites

Nevermind, this was my fault lol  :wub:

I have a problem with RetroFont. Using 2.4.0rc1 and rc2 RetroFont seems to render all characters in the same position at the start of the image. The same code in 2.3.0 works as expected. I am using it in a fashion similar to below.

            var text="A LINE OF TEXT";            var titlefont = new Phaser.RetroFont(this.game, 'knightHawks', 31, 25, Phaser.RetroFont.TEXT_SET6, 10, 1, 1);            titlefont.setText(text, true, null, 10, Phaser.RetroFont.ALIGN_CENTER, false);            var i: Phaser.Image = this.game.add.image(x, y, titlefont, null, group);
Link to post
Share on other sites

I found issue with mouse input in IE10. Here is minimal example - it just creates clickable square. Problem is that on IE10 (or when set IE Edge, which should be IE10 in my case) the game fails in Pointer class in updateButtons method (leftButton = null). It works with IE9 or Firefox (not tried Chrome):

 

post-12887-0-10106900-1437301656.jpg

<html><head>    <title>Test</title>    <meta charset="utf-8">    <script src="js/phaser.js"></script></head><body>    <div id="content"></div>        <script>      var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'content', { create: create });      function create() {            // play button            var g = this.add.graphics(0, 0);            // draw a rectangle            g.lineStyle(2, 0x0000FF, 0.5);            g.beginFill(0xFF8080, 1);            g.drawRect(this.world.centerX - 50, this.world.centerY - 50, 100, 100);            g.endFill();            // input            g.inputEnabled = true;            g.events.onInputDown.add(function () {                console.log("Pressed ...");               }, this);      } </script>    </body></html>
Link to post
Share on other sites

I found another issue: if you create Sprite, let's say like this:

var sprite = new Phaser.Sprite(this.game, 100, 100, "MyAtlas");

then its key property is not set to "MyAtlas", but to undefined.

 

 I found, that it happens in Phaser.Component.LoadTexture.prototype where this.key is overwritten with img.key, which does not exist (shloud it be this.key = img.name? Or is it correct to overwirte it here at all, as you just got img through key and you are immediately overwriting this key with some property of image?):

        :              else        {            var img = cache.getImage(key, true);            this.key = img.key;            this.setTexture(new PIXI.Texture(img.base));            setFrame = !this.animations.loadFrameData(img.frameData, frame);        }       :       :

 Problems are then with methods like: frame = this.game.cache.getFrameByName(this.key, aFrame);, which fail, as key is undefined.

Link to post
Share on other sites

@clark: thanks. I tried new version from GitHub, but it seems there is something wrong:

- my source now does not recognize Point.setTo() method for positions, anchors, ... In previous definition these properties were not only in pixi.d.ts, but also in phaser.d.ts with correct type Phaser.Point (instead of PIXI.Point). Now, as it is missing in phaser.d.ts, the definition is taken from pixi.d.ts, where type is PIXI.Point and it lacks setTo() and other methods,

- next issue is that BitmapText is missing some methods like updateText(), updateTransform() in defs - these were originally in PIXI and in 2.4.0 they seems to be moved into Phaser (from changelog: "Phaser.BitmapText no longer extends PIXI.BitmapText but replaces it entirely.") ... aah, I understand: this method is now private and text should be set only through text property, as it now calls update() automatically... am I right?

Link to post
Share on other sites

The Uncommented one is always the most up to date. 

 

Things started getting a bit out of hand when the Component System was added. I do not for example use BitmapText anywhere so finding mistakes is hard. 

 

I have implemented the component system here https://github.com/clark-stevenson/phaser/tree/dev and removed a bunch of old stuff.  There is tons of changes and I have only been able to test it on a single game (ill try others next week).  With 2.4.0 around the corner, I am concerned about massive scale breaking.  

 

I wouldn't do this right now if I were you - easier to just add in the few properties that things like Graphics needs for input events. There's very little wrong with the defs as they stand right now, I really wouldn't make such a big change this close to release imho.

Link to post
Share on other sites

I found another issue: if you create Sprite, let's say like this:

var sprite = new Phaser.Sprite(this.game, 100, 100, "MyAtlas");

then its key property is not set to "MyAtlas", but to undefined.

 

 I found, that it happens in Phaser.Component.LoadTexture.prototype where this.key is overwritten with img.key, which does not exist (shloud it be this.key = img.name? Or is it correct to overwirte it here at all, as you just got img through key and you are immediately overwriting this key with some property of image?):

        :              else        {            var img = cache.getImage(key, true);            this.key = img.key;            this.setTexture(new PIXI.Texture(img.base));            setFrame = !this.animations.loadFrameData(img.frameData, frame);        }       :       :

 Problems are then with methods like: frame = this.game.cache.getFrameByName(this.key, aFrame);, which fail, as key is undefined.

 

Yes this is now fixed in the dev branch. It was fine for images, but the key wasn't set correctly in the cache for atlas or sprite sheets, but it now is. The way it's overwritten is correct, and the property is correct.

Link to post
Share on other sites

 

Nevermind, this was my fault lol  :wub:

I have a problem with RetroFont. Using 2.4.0rc1 and rc2 RetroFont seems to render all characters in the same position at the start of the image. The same code in 2.3.0 works as expected. I am using it in a fashion similar to below.

            var text="A LINE OF TEXT";            var titlefont = new Phaser.RetroFont(this.game, 'knightHawks', 31, 25, Phaser.RetroFont.TEXT_SET6, 10, 1, 1);            titlefont.setText(text, true, null, 10, Phaser.RetroFont.ALIGN_CENTER, false);            var i: Phaser.Image = this.game.add.image(x, y, titlefont, null, group);

 

The Retro Font examples in the examples repo look fine to me - do they for you? I.e. is it just your code that doesn't display correctly, or do the examples break as well?

Link to post
Share on other sites

The Retro Font examples in the examples repo look fine to me - do they for you? I.e. is it just your code that doesn't display correctly, or do the examples break as well?

It was my fault Rich, everything is A OK with 2.4.0rc2 and RetroFonts. Also everything else I am working on works well in 2.4.0rc2.

Link to post
Share on other sites

I wouldn't do this right now if I were you - easier to just add in the few properties that things like Graphics needs for input events. There's very little wrong with the defs as they stand right now, I really wouldn't make such a big change this close to release imho.

Yeah exactly! I abandoned it, the restructure just jacked the whole file. However, the experiment was successfully implementing the component structure, so I should be able to compare my experiment to each of the respective classes that use them, and then from there boil it down to a handful of missing properties (ie: Graphics missing input) which can be added without ill effect.  I will take a look tonight should not be too bad.

Link to post
Share on other sites

 

I found issue with mouse input in IE10. Here is minimal example - it just creates clickable square. Problem is that on IE10 (or when set IE Edge, which should be IE10 in my case) the game fails in Pointer class in updateButtons method (leftButton = null). It works with IE9 or Firefox (not tried Chrome):

 

attachicon.gifError.jpg

<html><head>    <title>Test</title>    <meta charset="utf-8">    <script src="js/phaser.js"></script></head><body>    <div id="content"></div>        <script>      var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'content', { create: create });      function create() {            // play button            var g = this.add.graphics(0, 0);            // draw a rectangle            g.lineStyle(2, 0x0000FF, 0.5);            g.beginFill(0xFF8080, 1);            g.drawRect(this.world.centerX - 50, this.world.centerY - 50, 100, 100);            g.endFill();            // input            g.inputEnabled = true;            g.events.onInputDown.add(function () {                console.log("Pressed ...");               }, this);      } </script>    </body></html>

 

This is now fixed in the dev branch too.

Link to post
Share on other sites

Hi Rich,

 

I'm seeing two problems in the latest Canary:

 

The first is with sound caching, here are some example errors:

Phaser.Cache.isSoundDecoded: Key "initialize" not found in Cache.
phaser.js:16 Phaser.Cache.isSoundDecoded: Key "click" not found in Cache.
phaser.js:16 Phaser.Cache.isSoundDecoded: Key "start_game" not found in Cache.
phaser.js:16 Phaser.Cache.isSoundDecoded: Key "start_ball" not found in Cache.
phaser.js:16 Phaser.Cache.isSoundDecoded: Key "attach" not found in Cache.
phaser.js:16 Phaser.Cache.isSoundDecoded: Key "collide_balls" not found in Cache.
phaser.js:16 Phaser.Cache.isSoundDecoded: Key "explode_bomb" not found in Cache.
 
 
The second I reported during RC1, still happening now:
[.WebGLRenderingContext-000000285071EDA0]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
I see this error a lot, in fact it hits the error limit pretty quickly.
 
 
Two things to bear in mind:
1.  This does not happen in 2.3.
2. The game seems to play correctly, at least in the eyes of the user.
Link to post
Share on other sites

Rich,

 

I don't use any TileSprites - mostly regular image sprites and some spritesheets for buttons and a couple of spritesheets for explosion animations.

 

I haven't had time to create a minimal test case - my day job is intruding right now. :)

 

As for sharing the code, I would be more than happy to do that, but the project is fairly big.  Should I zip it up and send it to you?

Link to post
Share on other sites

All I'd really need is one of the images known to be causing the problem. Or the bit of code that loads the audio.

 

I'm suspicious this (the webgl error) is just a canary burp, quite GPU specific, as I've not seen it happen across multiple machines - does it actually happen in Chrome stable release? If not then I would put good money on it clearing itself up in due course.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...