hypersurge / awe6

awe6, the inverted game framework (Haxe)
http://awe6.org
MIT License
79 stars 11 forks source link

Pixijs v5 Upgrade #37

Closed bedwardly-down closed 4 years ago

bedwardly-down commented 4 years ago

According to the maintainers for the Pixijs Haxe bindings used for the Pixijs driver for this project, the current Master branch is production ready and a full release with version 5 support should be coming relatively soon. Using the v4 to v5 migration guide and some testing in a separate private repo altogether, I was able to get the Pixijs Awe6 demo to load and play.

Version 5 of Pixijs has made WebGL the standard renderer with Canvas being moved to a separate pixi.js-legacy package for games and apps that still need fallback support. The process of using a renderer has been heavily streamlined, making some of Awe6's implementation unnecessary or redundant. Its respective Haxe bindings maintainers have removed Haxe 3 support altogether in favor of Haxe 4 being production ready. It also added physics and collision support through the nape-haxe4 library, which I haven't used to any major extent yet.

I'm not sure what exactly changed under the hood yet that caused some minor issues for me, but here's the list of the few I ran into:

  1. Downloading the latest version of pixijs.min.js no longer works locally. I had to link the script's url directly in the index.htm file to get it to work. '
  2. The same issue occurred with pixi-sound.js plugin. It has to be linked directly in index.htm or sound will not load and the Preloader will error out with the loading bar frozen at about 75%.
  3. When testing on any Chromium-based browser, it must be started with the --allow-file-access-from-files flag enabled to run the demo locally. I haven't tried hosting it from my personal yet, but apparently that's the only other way to test it out.
hypersurge commented 4 years ago

Thank you. Using a localhost server should address issues 1, 2, 3? So I couldn't recommend merging this PR as-is.

I'm unsure what aspects of awe6's implementation have potentially been made redundant with Pixi5 - please can you explain what you meant? Also, I don't see any specific Nape implementation in Pixi (which is a good thing imo as separation is preferred), just the sample - did I miss something?

Generally moving to Pixi5 may be wise in 2020 - especially so when pixi-haxe makes the switch allowing the entire Haxe pipeline to bump. That said, the benefits of v5 over v4 should be properly reviewed by each adopter - for example, personally I wouldn't rush to abandon Canvas fallback.

I'll look at this again when we start our next Pixi project ... I would intend to build backwards compatibility into the awe6 Pixi driver to allow either Pixi4 or Pixi5 so as not to break legacy projects.

bedwardly-down commented 4 years ago

I was super tired when i typed this up, so i might have typed some wrong words. Using the http-server node package that the base pixijs 5 recommends for running didn’t work on Brave, my main browser. It didn’t throw errors, just a blank black screen. Same on Firefox. But I’m also on Linux, so that could possibly be a factor.

The main redundant part was just how the renderer decided whether to use Canvas or WebGL and the resize method. Neither one are used in version 5, with the Autodetect check being fully separated out.

And, this whole thing was a proof of concept more than anything else. It didn’t require much to get working on the newer Master branch, so I’d love to see what happens when you officially supported it. The napes thing was from a sample but i didn’t get too far into reading it, so also may have made an error there.

hypersurge commented 4 years ago

Wow github is struggling today ... Just wanted to say thanks again for exploring this and providing proof it's viable. Looking forward to implementing soon.

bedwardly-down commented 4 years ago

Definitely. I was on mobile and not trying to close this out yet, but GitHub grayed out the Comment Button and the Closed Button was fine, so I hit it. Hahaha.

Also, you're quite welcome. In an attempt to start learning how awe6 works, I'm currently using it as a base for my own framework idea that will only use PixiJS for the time being and will implement some extra stuff that may be experimental. It's not perfect, but I've made a semi functional pong clone with the main release of awe6. It wasn't too difficult and honestly, I really like this framework so far. :smiley_cat:

hypersurge commented 4 years ago

Thanks to the pixi-haxe team ... Pixi v5 is now the default on the externs. To celebrate the occasion we made the switch too: 316e870099387174ef560bc66ecbbf4fdd25c40f

Fully backwards compatible for any legacy projects (using Pixijs 4.x) - we've already switched a couple of our live projects over without hiccup. Inbuilt deprecation warnings and redirects existed in 5.x, but we still added some conditional compilation into awe6 pixi driver (to make the transition quite seamless).

Please note we made very minor modifications to the pixi-legacy and pixi-sound libs appropriate to our use cases. Specifically warnings on duplicate asset ids were removed, and sounds were set with enabled=false to avoid uneccessary update callbacks. Otherwise they are duplicated exactly.

hypersurge commented 4 years ago

Haxelib update will follow once we complete our next project (using v5).

bedwardly-down commented 4 years ago

Thanks for the update. I can’t wait to try out the new update and am glad i at least had a small hand in the upgrade. :)