Jump to content

Please help test Phaser 1.2


rich
 Share

Recommended Posts

Hi all,

 

It was always my intention to release 1.1.5 quickly with nothing but bug fixes in (of which I've done a few already) and use the 1.2 branch to integrate the latest version of Pixi. However 1.2 has been progressing so fast that I'm tempted to jump directly to it. The advantages the new version of Pixi bring are substantial - dramatically increased rendering, less memory overhead, tints, blend modes and more.

 

For me one of the best changes is that they've dropped using a linked list internally. It's just a simple array now. This has cut the Phaser Group class down by over 600 lines of code! And it's a lot faster now too. Phaser.Group now extends a DisplayObjectContainer, rather than having one as a child, which resolved a load more issues. So I'm very happy with this - moving children around is really fast now, making z-index sorting a breeze.

 

I've created a brand new Phaser.Image class, which is like a Sprite but with no physics body, animation support or attributes like 'health'. It's much smaller now and perfect for logos, background or your own buttons (as it fully supports input events).

 

I've also recoded Sprite too and dropped LOTS of code from inside of it. I've done away with all of the _cache stuff and all of the point objects (like topLeft, bottomRight, etc). Pixi introduced a new getBounds function which I now use instead (if needed). The Sprite class is now considerably smaller as a result and does a lot less processing every frame. Yet I've added a few features - for example it now has a hitArea property (which comes from Pixi) that allows you to set a geometry shape as its hitArea for any clicks/touches, so you can give a circular button a Circle object as its hitArea. And it works properly even when rotated and scaled. I'm very pleased with this feature alone to be honest :) But the new performance is what really excites me and I've not even touched the new Pixi SpriteBatch feature yet!

 

Right now I'm trying to hook the physics Body back into Sprite, and there's some work to be done across Tile Sprites too, but otherwise I'd love for people to start playing with the 1.2 branch. I'm pushing to it several times a day as I want all changes to be reflected in the repo quickly, so it can be tested and fixed as we go.

 

As with all updates I work on, the new examples are always in examples/wip. But if you've time please pull from the repo and have a play. You won't be able to port old games over just yet (not until physics is restored) but that shouldn't be many days away.

 

https://github.com/photonstorm/phaser/tree/1.2

Link to comment
Share on other sites

I've made some substantial progress with this branch, to the point where I'm very confident it will replace the planned 1.1.5 release. I've got loads from 1.1.4 working under it now, so I've finished re-doing Sprites, Groups, Text and more. I would say it's definitely in a state where it can start being tested though.

Link to comment
Share on other sites

I dropped this into a new project I started experimenting with.

The criteria was:

 - Each sprite needs its own constantly active tween on position.

 - Tweens destination is randomly chosen from predefined locations when it reaches its current destination.

 - FPS needs to remain above 30.

Messing around with 1.1.4, I managed to get 400 PIXI.Sprites in a Phaser.Group tweening between points at 30fps.

As soon as I dropped in Phaser 1.2, I was able to up this to 600 little dots and keep my 30fps without any changes.

For Science, I changed the PIXI.Sprites into Phaser.Images, and it had no negative impact on the fps.

 

So, looking good!

Link to comment
Share on other sites

Once I port SpriteBatch over I expect you to increase that fps rate again :) (definitely in WebGL mode anyway! it's blazingly fast).

 

I've actually got a large majority of p2 physics integrated into 1.2 now. The Body class is totally replaced running under a p2 world. Still work to be done, but extremely promising so far. Pixi.js 1.5 went live just now as well, which is awesome as it implements several fixes I had made locally.

Link to comment
Share on other sites

Unlikely. I'm getting much better results from p2 than SAT.js, in terms of actual speed re: comparisons - I'm well aware that the random separation issues in 1.1.4 are my fault, not SAT.js's :) (it does what it's supposed to do really well in most cases). I have considered rolling back to an earlier AABB physics build but I'm not sure it's worth it to be honest. In 1.2 physics is disabled by default, even for Sprites. So if you don't need any of that it's not clogging up the system unlike it does presently.

Link to comment
Share on other sites

Hey, there's a new parameter when creating a Group called addToWorld. If true the Group is added to the World,if false to the Stage (above the World).

 

Cheers! Also with TileSprites is there an issue with them at the minute? I tried to create one and inside the TileSprite Object it seemed to have a problem where the .body is undefined? I'll do a quick test now with a TS on it's own, but the error seemed to come from within Phaser.

 

EDIT: Just threw up an error report on the Git repo.

Link to comment
Share on other sites

hello there!

i would love to help testing phaser 1.2 but i just learned how to use 1.4 to make a super mario bros like jumpnrun and now it seems my knowledge is obsolete..

 it took me an hour to find out how to get gravity working again and my testMario moving left and right.. still found no game.physics.collide() replacement :(

 

is there some sort of 1.2 api / reference / howto / demo / documentation / example.. or am i supposed to read the docs for p2.js or just the phaser1,2 source code like i'm doing right now ;-) ?  

Link to comment
Share on other sites

I've not even touched particles yet, so they won't work (on my list for tomorrow).

 

Also if you used any of the old physics things like 'collide' or 'moveToObject', etc - they are all now gone too for the moment.

 

Today has mostly been working on tilemaps and springs, both of which I have working to a degree now.

Link to comment
Share on other sites

first of all.. thx for your work.. i really like phaser (i decided to stay with version 1.1.3 for my work with my students because of the functional arcade physics) and i can't wait to use phaser 1.2 !!

 

i also already found out (thx to your examples at   http://labs.phaser.io/ ) how to enable physics on my objects.. but then they floated around like in space..  

so i read more of your source code and tried a lot of things and found out that setting the gravity for the whole world works  game.physics.gravity=[0,-60];

i don't know why but the objects still move to the left of the screen very slowly ?! i have to set it to [18,-60]

 

now i need to tell some objects to be 'immovable' (which doesn't seem to exist anymore) also everything keeps rotating so i set

player.body.rotation=0; on every update cycle because player.body.setZeroRotation(); still rotates the body eventually.

 

also i found out that the rectangle around the body with physics.enabled is always in the original size and ignores scaling .. is this behaviour intended? should i manually size down the rectangle somehow?

 

another thing i found out is that the collision detection is not that straight anymore..  things seem to first fall into the other objects and then move out of them slowly.. but it's the same way on all p2 examples

 

here is a link to my test case  http://test.xapient.net/phaser/  if you like to try it ;-)

 

thx again and keep up the good work!  (my student also love phaser )

Link to comment
Share on other sites

Thanks for your feedback :) Some answers:

 

1) Sprite.body.fixedRotation = true will stop you needing to reset rotation every update, which is also probably leading to other problems.

 

2) "immovable" is known as 'static' in a real physics system :) So you can either set the body.mass to zero, or body.static to true to enable this (be sure to use latest release from today though)

 

3) physics bodies cannot scale I'm afraid. The original rectangle that is made is made at the size of the sprite at the time, so if it needs scaling do that before enabling physics. Or call setRectangleFromSprite whenever you scale. Same goes for any of the other functions (setCircle, loadPolygon, etc).

 

4) How are you moving them? I've noticed that if you set velocity directly it's not very happy, but if you apply a force it works and collides as expected.

 

5) I'll look into gravity later.

Link to comment
Share on other sites

hey thx!

so i tried your suggestions..  

 

1) rotation is now fixed!

 

2) 'immovable' works with paddle.body.mass=0;  and in the latest git pull (right now) also with paddle.body.static=true;

 

3) i scaled the sprite before applying physics.. it works now!   thx again!

 

4) with the zip file from yesterday i could move my player with  player.body.moveLeft(200);  in todays git pull this doesn't work very well ^^ i need to give it 2000 instead of 200 BUT the body.velocity.x works now !! :)

 

-- can you tell me why the coordinate system is the other way around now?  it seems 0,0 is in the lower right instead of the upper left?

 

-- gravity works in the git pull from 5 minutes ago :) without the strange force to the left ..  moarrr testing tomorrow :)

 

--  phaser.min.js is still 1.1.5 in the git repo?  or is it just the comment?

 

--  one strange thing i noticed was that my player sticks on the side of another object and is not falling down when i keep pressing the keyboard button that moves the player towards the object.. you can try it here..

 

it's on my playground again :)

http://test.xapient.net/phaser/   

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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