rich

The march towards 1.0

Recommended Posts

Hi all,

 

Ok I'm back from holiday feeling refreshed and invigorated. It was good to get away from it all for a while really. The stupid battle with the TypeScript compiler and missing my self-imposed deadline really took it out of me. But I'm now ready to tackle it again and get those final loose ends wrapped up.

 

While I was away I noticed they released a new version of TypeScript, so I guess I'll try that again and see if it's any better than before. Also the TS developers reached out to me and have been offering me suggestions on how to help debug the compiler crashes I was getting.

 

So, it's time to make this happen at last :)

 

Share this post


Link to post
Share on other sites

Great to hear that your holidays was successful ;-) can't wait phaser 1.0. I'm on a edge of relasing my first "big" (aka polished) game which uses Phaser, and I think i would do that after 1.0 relase :-) Once more thanks for a great framework.

Share this post


Link to post
Share on other sites

 I can so understand how those trials and tribulations could take the starch out of a person's sails, but phew, so glad you are back.  I've been checking every day, eagerly awaiting both 1.0 and some documentation and/or basic tutorials.  However, one thing at a time - I'm excited for 1.0 alone.

Share this post


Link to post
Share on other sites

So after the lengthy discussion in this forum about dropping TypeScript I went ahead last night and did just that. So far it has been a really good experience. There is a new 1.00JS branch on github where you'll see my endeavours in the src and examples folder. But I'm going to use this thread as a means to log my progress for you all and (hopefully) solicit feedback on some choices as I go.

 

Completed in the first commit:

 

system/Device - for browser/os interrogation

core/Signal and core/SignalBinding - for the way Phaser handles events

net/Net - query string and domain checking functions

math/RandomDataGenerator - a fantastic class imho :)

time/Time - the time manager, updated a bit as well

animation/Frame and FrameData - needed as part of the Cache

animation/Parser - the new home for the old AnimationLoader, parses json and xml atlas data into FrameData

Cache - the internal asset cache, fully working

Loader - the loader for all assets, fully working and added atlasXML, atlasJSON and atlasJSONHash as proxies

Game - the boot process and above libs enabled

 

So not too bad for a few hours work :)

 

I've got quite a big decision to make today though - shall I implement pixi.js for rendering or not. I need to do some solid experiments first, but I'm  leaning towards doing it especially now that WebGL is on by default in Chrome Android. I much prefer my way of handling asset loading and caching, so I'll be using pixi for rendering only really, but I feel it would make a worthy addition.

Share this post


Link to post
Share on other sites

Yes that's my thinking too. Right now I'm doing the boring "essential" stuff like geom and Math, but once those are out of the way I can move to experimenting more with hooking in pixi. It's going to be tricky because I only need the core bits of it, not the whole package, but it has become quite deeply coupled in places - so we'll see how it all pans out.

Share this post


Link to post
Share on other sites

I also agree that it would be a really good idea, having Phaser implementing (one of) the fastest renderer would be great.

 

But maybe you could wait until IE 11 is released so the support would be even broader and the implementation more relevant ?

 

Anyway, I'm impressed by how seamless the transition from TS to JS was :)

Share this post


Link to post
Share on other sites

More good progress so far today. Have finished geom/Circle, Point and Rectangle. Have merged the old CircleUtils (etc) into the core file, so they are a combination of the prototype, some getters/setters and Object functions. Best of both worlds imho. Also have done math/Math.

 

Will get a couple more easy ones out of the way (tweens and raf) and then tackle the monster that is the Input classes. With that I can move on to Sound. A couple more files after this and it will be fully functional but without any rendering, which is a great place to take stock and evaluate my options.

Share this post


Link to post
Share on other sites

By the way I have some questions and interest about the transition process:

 

1. Do you use the compiled .js files from VS ts project and manually transfer comments only ?

2. How you preserve the relations and structure between classes (same as the exported files , amd, or manually ...)

 

Overall if your answer is longer you can share the experience in article: Transition a large codebase from TS to JS it sounds like usefull thing so people will not be afraid to code in ts if they know that always there is an escape door. 

Share this post


Link to post
Share on other sites

Progress last night was pretty epic. I have seriously refactored the main Game class. It's a lot smaller and more powerful now. Have also added in state object switching, custom callbacks and other core parts. Tweens are also now done and fully in, having updated to the latest tween.js in the process which bought a few bug fixes and yoyo support (something I added manually in the TS version, but is now in core).

 

Most important of all though, it's now rendering via Pixi. So I've got a Pixi sprite on-screen, doing its thing, but the texture is being pulled from the Phaser Cache and you can control it via Phaser. Baby steps, but exciting all the same.

 

Mike - A bit of both. I've been using the JS that TypeScript output, but having to rework it quite a bit - the structure is a bit strange, I'm having to move comments around and unpicking some of the things TS adds, but on the whole it's a fast and pretty efficient process.

Share this post


Link to post
Share on other sites

 

Reading through the recent posts really makes me wonder whether I should use TS or not. Too bad Ecmascript 6 is still so far away: http://kangax.github.io/es5-compat-table/es6/  :(

 

This topic is discussed in a lot of other threads... and there is no single answer... but seeing that TS to JS is not hard, and after trying all of TS cool features i bet you'll use TS.

Share this post


Link to post
Share on other sites

@rich: "Progress last night was pretty epic. I have seriously refactored the main Game class. It's a lot smaller and more powerful now."

 

Sounds like the problematic TS was a bit of a blessing in disguise.  No suprise really, I know that when I am forced to revist a project for one reason or another, it often comes out with more improvements that I thought it would.

 

Anyway, this is great news.  Sounds like you're on a roll.

Share this post


Link to post
Share on other sites

You're totally right :) Everything I have touched has been refactored for the better so far, and I'm making crazy good progress. Pixi is now quite deeply coupled and is handling all rendering, there is a new State Manager which is really quite awesome and have been cracking through.

Share this post


Link to post
Share on other sites

More excellent progress today. The integration of Pixi continues in leaps and bounds. You can now load any format Texture Atlas (json hash, json array or xml) or an old-skool style sprite sheet and the Phaser loader will correctly parse it and add it to the Pixi caches, so it renders and displays perfectly. I'm doing all of this without modifying the pixi source at all, so hopefully that will make for easier upgrading.

 

Also added ability to disable anti-alias when using canvas (pixi only supports it via webGL)

Share this post


Link to post
Share on other sites

Just pushed the latest version. All of the core Phaser nice things are working their way back in :) You can now add sprites directly to the game world, tweens are working, all of the AnimationManager is back in and working beautifully, so very happy with progress for just a few days work.

 

Really need to do some kind of camera system next. Sadly I'm about 99% sure using Pixi means I can only support 1 Camera at once :( To be honest I've never seen any games that used more, but even so it's a limitation I didn't have before. But until Pixi can handle cameras natively I may need to enforce that restriction.

Share this post


Link to post
Share on other sites

Lots of work done this morning - the full Input Manager class has been moved over now. So Mouse, Keyboard, Touch and MSPointer events and everything they did under Phaser is now working.

 

Also added a World and Camera object and Sprites are now placed inside the world, and you can move around the world and sprites update automatically as you'd expect. Also tidied up the core game loop significantly, reducing the number of iterations a lot.

 

Time to do camera culling and input over sprite detection.

Share this post


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.