HaxeFlixel / flixel

Free, cross-platform 2D game engine powered by Haxe and OpenFL
https://haxeflixel.com/
MIT License
1.98k stars 439 forks source link

Low framerate when scaling 8 big bitmaps ? #520

Closed xraven13 closed 10 years ago

xraven13 commented 11 years ago

So I recently switched to experimental version of Flixel, and for 8 bitmaps of size 1000x1000 px that are scaling from 0.2 to 1 at the same time, I get only 30 fps. Is this normal ?

Reason I need is to create a 3D tunnel effect.

Thanks.

Gama11 commented 11 years ago

In general, as soon as you do something more complex with sprites on the flash target (alpha or scaling), rendering becomes about 10x as expensive. FlxBunnyMark demonstrates this very nicely, try to change from "simple" to "complex" with the button in the upper right corner. On native targets, this doesn't make any difference in rendering speed at all.

The big size of you bitmaps probably makes things worse.

Have you had a better performance using earlier HaxeFlixel versions? It seems like the current dev version has some performance issues due to a change of onScreenSprite, which seems to be more expensive than thought.

xraven13 commented 11 years ago

Tested on Windows, it runs at 60 fps.

As for the performanse comparision ( at least in Flash ) , yes I can say for sure that experimental version is slower then master, kinda much slower... I remember before on master version I tested 100+ enemies with around 30+ bullets, and I tested overlap between them with SAToverlap ( overlap between rotated rects ) , and it run on 60 fps. Now with experimental I get 45 fps for 50+ enemies.

xraven13 commented 11 years ago

Great !

Also, I am having problem with having lot of objects on the screen ( it is slower then before with master version), so let me know what are showing the tests once you run them so that I can know is it problem in my code or experimental version of Flixel.

Thank u ! :)

2013/7/20 Samuel Batista notifications@github.com

The development team is looking at the performance issues.

— Reply to this email directly or view it on GitHubhttps://github.com/HaxeFlixel/flixel/issues/520#issuecomment-21300244 .

gamedevsam commented 11 years ago

There is definitely a heavy CPU cost for basic engine operations in dev branch of flixel (like checking if a sprite is within camera view). See this post for more info: http://haxeflixel.com/comment/2707#comment-2707

AndreiRegiani commented 11 years ago

@xraven13 Update to latest dev-branch and set FlxG.fixedTimestep to false, this helps low FPS to be unnoticed.

xraven13 commented 11 years ago

I updated it, but it still seems slower then before ? ( this is not really connected with the title anymore )

Here and then FPS drops to 40 without no real reason, and I have just few simple objects on the screen. This happens even on windows target. And what I noticed is that game lags more if I move the camera around the level...

Weird because I remember on Haxe 2 game was running lightning fast, it was crazy... 100 instances, all great..

Gama11 commented 11 years ago

@xraven13 That sounds weird. Like always, more details would be great. What exactly do you have on screen? Are you compiling in release or debug mode, and do you have FLX_NO_DEBUG activated? Also, have you tried @AndreiRegiani's tip?

Beeblerox commented 11 years ago

@xraven13 can i see your project code?

xraven13 commented 11 years ago

Okay, so I activated FLX_NO_DEBUG and it is much better now in game where I am using FlxSpine.

But in other project it's still problematic , Zaphod I sent you message on HaxeFlixel forums, inside there is a link for full project. :)

2013/7/27 Zaphod notifications@github.com

@xraven13 https://github.com/xraven13 can i see your project code?

— Reply to this email directly or view it on GitHubhttps://github.com/HaxeFlixel/flixel/issues/520#issuecomment-21671318 .

Beeblerox commented 11 years ago

@xraven13 i'll try to see what can be done with it