Author Topic: v2.31 is up!  (Read 5217 times)

Adam Atomic

  • Founder
  • Key Contributor
  • *****
  • Posts: 852
  • Karma: +0/-0
  • new dad
    • View Profile
    • Adam Atomic
v2.31 is up!
« on: Mon, Mar 29, 2010 »
Change list:

Code: [Select]
> Flex SDK 4 text compatibility resolved
> FlxG: new variables "framerate" and "frameratePaused"
> FlxGame: simplified render loop, framerates improved
> FlxGame: switched game loop to use a timer
- browser plugin efficiency improved
- AIR and Flash Player framerates improved
> FlxPanel: fixed bug where buttons weren't working right
> FlxPreloader: new variable "minDisplayTime"
- optional, display preloader even if game is loaded/loads quickly
> FlxText: fixed "flat white rectangle" initialization problem
> FlxText: fixed documentation problem with ShadowColor variable
> FlxTilemap: fixed and optimized preCollide()
- Not much of a framerate difference as far as I can tell
- Corrected "walk off left side but hit right side" behavior
> FlxTilemap: added warning message to log if setCallback() is called
> FlxU: new functions startProfile() + endProfile()
- Prints execution time to debug console with given label
- Suggested Usage:
var pf:uint = FlxU.startProfile();
ExpensiveFunction();
FlxU.endProfile(pf,"Expensive Function");
> FlxU: new variable quadTreeDivisions
- controls granularity of quad tree
« Last Edit: Wed, Mar 31, 2010 by Adam Atomic »

Adam Atomic

  • Founder
  • Key Contributor
  • *****
  • Posts: 852
  • Karma: +0/-0
  • new dad
    • View Profile
    • Adam Atomic
Re: v2.3 is up!
« Reply #1 on: Mon, Mar 29, 2010 »
The only weird behavior that I know of is that if you set FlxG.framerate to 60 or higher, the input gets REALLY unreliable in Flash Player on OSX, NO idea why yet (and haven't tested on other platforms yet either)

lithander

  • Active Member
  • ***
  • Posts: 222
  • Karma: +0/-0
    • View Profile
    • pixelpracht
Re: v2.3 is up!
« Reply #2 on: Mon, Mar 29, 2010 »
Timers have a pretty low accuracy and whatever you do in your timer induced update loop you can't force flash to render. When you handle logic based on the onEnterFrame event at least you know that your logic and drawing will alternate but using a timer you might skip frames or update twice per frame and not even know it. Might be I'm misinformed but the timer based game loop doesn't sound like a good idea to me.
Simplicity is the ultimate sophistication ~Leonardo Da'Vinci

Adam Atomic

  • Founder
  • Key Contributor
  • *****
  • Posts: 852
  • Karma: +0/-0
  • new dad
    • View Profile
    • Adam Atomic
Re: v2.3 is up!
« Reply #3 on: Mon, Mar 29, 2010 »
it's been tested by a lot of people, and you can force an update (to some extent) which is pretty great.  I messed with it a bunch today and it works pretty good!  I *do* think it is at least partially responsible for the 60+ FPS input problems, but that might be a kink i can work out still

Matoking

  • Member
  • **
  • Posts: 57
  • Karma: +0/-0
    • View Profile
Re: v2.3 is up!
« Reply #4 on: Tue, Mar 30, 2010 »
Tried compiling with Flex SDK 4 and got bunch of errors like :
"VerifyError: Error #1014: Class mx.core::SoundAsset could not be found."
I also tried it with browser which had Flash Player 10.1 installed on it, didn't work either.

So I went back to Flex SDK 3.5 and commented out the line in FlxGame.as and compiled again. Works nice expect everything expect HUD is now pitch black in the game. :P

With v2.23 it works so I guess v2.30 broke something or my coding was just so horrible it was a miracle it worked with previous versions.

EDIT :
My fault, I had my layer's render() loops inside the main class's update() loop, silly me.

EDIT 2 :
But now I have an another problem with v2.30. Nothing collides after level transition (which involves calling destroy() on every FlxGroup expect HUD and then recreating them using the "_layer = new FlxGroup()" function), and FPS is around 52-54 all of the time with v2.30 when it was around 59-60 with v2.23. And in Mozilla Firefox with Flash Player 10.1, the FPS is around 30, where it was around 59-60 in v2.23
« Last Edit: Tue, Mar 30, 2010 by Matoking »

Adam Atomic

  • Founder
  • Key Contributor
  • *****
  • Posts: 852
  • Karma: +0/-0
  • new dad
    • View Profile
    • Adam Atomic
Re: v2.3 is up!
« Reply #5 on: Tue, Mar 30, 2010 »
The drop to 55 is expected, you are welcome to change that yourself - it is stored in FlxG.framerate.  The drop to 30 in 10.1 is perplexing though, sounds like it might be using the swf framerate instead of the timer maybe?  Or else 10.1 has some kind of weird bug that actuallly slows everything way down...

Adam Atomic

  • Founder
  • Key Contributor
  • *****
  • Posts: 852
  • Karma: +0/-0
  • new dad
    • View Profile
    • Adam Atomic
Re: v2.3 is up!
« Reply #6 on: Tue, Mar 30, 2010 »
I have NO idea why collisions would stop working though - how could they work and then not work??

Matoking

  • Member
  • **
  • Posts: 57
  • Karma: +0/-0
    • View Profile
Re: v2.3 is up!
« Reply #7 on: Tue, Mar 30, 2010 »
I found out something weird :
When the player is reading signs (which have scrolling text, which works using the String function slice) the FPS returns back to around 54 but goes back to around 30 when it stops scrolling. In v2.23 the FPS is stable 59-60 regardless of the Flash Player version.

Yeah, I tried changing the FlxG.framerate and the project's framerate, didn't help.

I will upload both versions soon (other compiled with the v2.30 and other with v2.23)

EDIT :
Game compiled with flixel v2.23 :
http://www.swfcabin.com/open/1269954577

Game compiled with flixel v2.30 :
http://www.swfcabin.com/open/1269954705

Down used to open doors and read signs, Z to jump, arrows to move. You fall through the floor when you go through the door when playing the game compiled with v2.30.

Between level transitions I just destroy and recreate every layer this way :

Code: [Select]
_layer_objects.destroy();
_layer_objects = new FlxGroup();
« Last Edit: Tue, Mar 30, 2010 by Matoking »

hamedn

  • Member
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Re: v2.3 is up!
« Reply #8 on: Tue, Mar 30, 2010 »
I made no changes to the code, other than commenting out that Flex 4/Flex3 Embed thingy... 2.3 totally broke my early game demo.

Broken: http://www.swfcabin.com/open/1269984412
Normal (2.23):  http://www.swfcabin.com/open/1269984525

lithander

  • Active Member
  • ***
  • Posts: 222
  • Karma: +0/-0
    • View Profile
    • pixelpracht
Re: v2.3 is up!
« Reply #9 on: Tue, Mar 30, 2010 »
Okay, I stand corrected - checking out code in the dev branch I see that you found a way to force flash to render. But I'm not convinced that it is a good idea to try and do so!

Calling updateAfterEvent() at the end of the game loop aborts the current frame and starts a new one where one of the first actions the flash player does is to check if a timer event has to be fired. If you set the desired frame rate high enough thats almost always the case. So you're right back in the update loop. Fps is higher because there's no waiting for the flash player to switch from executing as3 code to rendering the display list and back to code - something that would always take longer as transitions happen at fixed internal intervals only. But aborting the current frame by calling updateAfterEvent() means that all the things that flash would normally do after dispatching the timer event wont happen anymore including dispatching the input events. And this is why there is input lag and why the input lag is increasing the higher the fps is.
« Last Edit: Tue, Mar 30, 2010 by lithander »
Simplicity is the ultimate sophistication ~Leonardo Da'Vinci

Adam Atomic

  • Founder
  • Key Contributor
  • *****
  • Posts: 852
  • Karma: +0/-0
  • new dad
    • View Profile
    • Adam Atomic
Re: v2.3 is up!
« Reply #10 on: Tue, Mar 30, 2010 »
ah goodies!  good research.  i think its still worth doing the timer, but updateAfterEvent may be a bad idea after all

Adam Atomic

  • Founder
  • Key Contributor
  • *****
  • Posts: 852
  • Karma: +0/-0
  • new dad
    • View Profile
    • Adam Atomic
Re: v2.31 is up!
« Reply #11 on: Wed, Mar 31, 2010 »
I did a bunch more testing tonight, and made some last minute tweaks before checking the new build against every current internal project of my own.  Everything compiles great and runs great in both browser and player!  Most games should see a little framerate bump (maybe 2-5 fps?).  Best addition though is FlxU.startProfile() and FlxU.endProfile(), these are hella handy tools!

L_O_J

  • Member
  • **
  • Posts: 88
  • Karma: +0/-0
    • View Profile
Re: v2.31 is up!
« Reply #12 on: Thu, Apr 1, 2010 »
Hmm I don't know if these appropriate to ask here, maybe split my question in to a new thread, but since this thread is becoming timer discussion thread, what the hell :)

Is there any advantages of using timer instead of using enter frame event, better frame rate or maybe less CPU usage ?. Specially for app/game that run in 30-60 FPS. Oh and one more question, if the update code run longer than the allocated timer time, what will happen ? Does the update code "overlapped" or it halts the event until the update code finished ?

Thanks, checking out the dev branch later tonight, and maybe do some research on timer :)

krix

  • Member
  • **
  • Posts: 61
  • Karma: +0/-0
    • View Profile
Re: v2.31 is up!
« Reply #13 on: Thu, Apr 1, 2010 »
I did a bunch more testing tonight, and made some last minute tweaks before checking the new build against every current internal project of my own.  Everything compiles great and runs great in both browser and player!  Most games should see a little framerate bump (maybe 2-5 fps?).  Best addition though is FlxU.startProfile() and FlxU.endProfile(), these are hella handy tools!

I compiled some of my projects with flixel 2.31 and flex4 in flashdevelop. But unfortunately I recognize a massive fps breakdown (flixel 2.23 ~60fps vs flixel 2.31 ~35-50 fps). Makes no difference for me if I compile for flashplayer 9 or 10.
Furthermore the same thing happens if I compile "FlxCollisions" with the new flixel version.

Does anybody share this experience?

Cheers,
Dirk

Andreas

  • Guest
Re: v2.31 is up!
« Reply #14 on: Thu, Apr 1, 2010 »
I have the same input/framerate problems with Flixel 2.31. I am working on a Flixel tutorial for CreativeApplications.Net and I had to switch back to v2.23 for it. You can find the source at http://github.com/pixelate/flixel_primer. If you try to compile it against v2.31 it becomes unplayable on the stand-alone Flash Player for Mac due to the input lag.

Adam Atomic

  • Founder
  • Key Contributor
  • *****
  • Posts: 852
  • Karma: +0/-0
  • new dad
    • View Profile
    • Adam Atomic
Re: v2.31 is up!
« Reply #15 on: Thu, Apr 1, 2010 »
well that sucks!  I compiled against about a dozen internal projects and saw only slight improvements and no input lag :(

The idea with using a timer instead of onEnterFrame is that you can conserve a little more CPU and organize the game loop code a little bit better, but it sounds like the way I have implemented it is pretty unstable still.  Thaaaat sucks.  I can certainly roll it back to run in onEnterFrame, which will be more stable, it will just provide a little less performance control...let me do some more research on this!  I will also mess about with the new profiler tools in Flash Builder 4, since I just got that installed last night...

Adam Atomic

  • Founder
  • Key Contributor
  • *****
  • Posts: 852
  • Karma: +0/-0
  • new dad
    • View Profile
    • Adam Atomic
Re: v2.31 is up!
« Reply #16 on: Thu, Apr 1, 2010 »
ok i have a PLAN OF ACTION - I'm gonna try and get together a slightly more stable patch, and then work up some better diagnostics for the dev console, stay tuned!

Adam Atomic

  • Founder
  • Key Contributor
  • *****
  • Posts: 852
  • Karma: +0/-0
  • new dad
    • View Profile
    • Adam Atomic
Re: v2.31 is up!
« Reply #17 on: Thu, Apr 1, 2010 »
ok 2.32 patch is up, using onEnterFrame again, should be much more stable!  If you were having problems with 2.31, please try 2.32 ASAP if you get the chance!  (i realize that is asking for some faith but all the timer/updateAfterEvent stuff is stripped, so the weird behavior should disappear)

Andreas

  • Guest
Re: v2.31 is up!
« Reply #18 on: Thu, Apr 1, 2010 »
The 2.32 patch works like a charm for Flixel Primer. Thanks a lot for the quick fix!

Adam Atomic

  • Founder
  • Key Contributor
  • *****
  • Posts: 852
  • Karma: +0/-0
  • new dad
    • View Profile
    • Adam Atomic
Re: v2.31 is up!
« Reply #19 on: Thu, Apr 1, 2010 »
Sure thing!  Sorry for the hiccups :)