So, i was working hard to keep my main game loop below 1ms, however Pixi just eats away all the performance on mobile. And i am not doing anything fancy, just using a single 2048x2048 base texture, about ~200 containers (some are nested in 2-4 levels) and ~750 sprites. No filters, no shaders, no color transforms.
Anyone have experience with Kha and Pixi.js as it relates to performance? Particularly HTML5 WebGL.
(Pixi.js is HTML5 2D rendering engine.)
Just in case i need to remember the steps in the future, so i will save it here.
- download (http://haxe.org/download/) and install haxelib to C:\HaxeToolkit
- open cmd.exe
- run command: haxelib setup
- run command: haxelib install kha
- create folder anywhere.
- navigate to your project folder using cmd.exe
- run command: haxelib run kha --init
- it will create few folders and files inside your project folder.
- run any of these commands while you are in your project folder:
- haxelib run kha windows
- haxelib run kha ios
- haxelib run kha android
- haxelib run kha android-native
- haxelib run kha html5
- haxelib run kha flash
- it will build project files for popular IDEs. (FlashDevelop, Visual Studio, etc.)
- open created project file with popular IDE.
- build again.
- Probably automate it in some way.
Ok, tried using Kode Studio.
My impressions: looks nice, but feels sluggish.
Maybe because Visual Studio Code is not fast in general.
Anyway did few test to see why it feels slow (3GZ dual core CPU, 4GB ram, regular HDD):
• typing text: ~50% (FlashDevelop: ~10%)
• selecting small chunk of text: ~70% (FlashDevelop: ~15%)
• moving text cursor up and down over empty lines: ~40% (FlashDevelop: 5%)
• 7 instances of kode.exe (FlashDevelop: 1)
• 548MB ram usage. (FlashDevelop: 158mb with multi-thousand line project opened with 10 tabs)
• No autocompletion.
I am keeping FlashDevelop.
Anyway, lets try haxelib:
Compile speed of empty project:
• flash target: ~4 seconds
• html5 target: ~4 seconds
• windows target: ~9 seconds (about 3 minutes in visual studio to build first time, release build .exe file size: 1.4mb)
problems with flash target:
swf size is 400x300 instead of specified 1024x768. Have to open project-flash.hxproj and compile again? If so, why Kha compilation produce swf in the first place?
Windows is very fast compared to OpenFL. Also very low executable size. Pretty nice.
Things to try out next time:
• Android and iOS.
• Test how fast it will go from changing few lines of code -> Kha compilation -> visual studio compilation -> run exe and see the results.
• Test how fast it will go with several thousand lines of code and hundreds of assets.
I'm just a bit skeptical after trying to get my game running on Android and iOS and all the issues i encountered with OpenFL. And each new OpenFL version seem to break just about everything.
So, i don't want to invest months building a game using some SDK to later turn out that tons of simple things are broken.
I may try Kha, though, because i like the overall direction towards performance.
Basically i use flash to release games on various flash gaming websites and Stage3D is not supported by default. It's the only reason i use OpenFL:, to combine regular flash+native mobile.
Anyway, if flash is not supported by default, i can't really use Kha right now.
However, Kha does look promising and i hope i will try it out in the future.
Thanks for letting me know.
Will i shoot myself in the foot if i start using Kha?
I really like the promise of "the speeds". And i am really close to switching from OpenFL to Kha. But before i invest my time, i have few questions and worries.
My current goals:
• Create smooth 30fps 2D games for flash platform and smooth 60fps non-battery-draining 2D games for mobile.
• Compile to regular Flash (not stage3D), Windows (for testing hardware rendering), Android, iOS.
• Keep stuff simple.
Worries about Kha:
• Have to install, learn and use Git and NodeJS. So basically projects are now tied with: FlashDevelop, Haxe, Git, NodeJS, Kha, Visual Studio, etc.
So, what do i really get with Kha?
• Non-stage3D flash is available as target?
• Can i expect to get stable 60fps in a non-demanding 2D game?
• If i do the right things on my end, can i expect games with continuous scrolling to be smooth on Android and iOS?
• Do fonts work?
• Do i have to worry if i use a feature on one platform to later find out it's "not implemented" on another platform?
• Do i have to worry about memory leaks in Kha library?
• Do i have to worry about random lag spikes caused by Kha?
• Does it take a year to compile to C++ like OpenFL?
• And what about them compilation speeds in general?
To be fair, it doesn't mean everything in Kha SDK must be flawless, but would like if basic 2D bitmap graphics and sounds are consistent and fast.
Thanks for hearing me out.
Any answers would be appreciated.