Jump to content


Any tricks/tips for turbo-charging GS (AS3)?

Recommended Posts

First, I want to be clear that I know that GS is highly optimized, and that in no way do I mean to imply there's any problem with the GS speed.  I've never had one.


I've been working on a large sectional project for 3 months where games are being run along with videos inside an external player.  One of those games -- using rudimentary Flash 3D, etc and using a touchscreen for touch detection -- runs slower than the client wants.


The issue is, of course, with the videos and the external player, and with the multitude of external videos being played.


That having been said, is there anything I can do to turbo-charge GS — the game relies on many TweenMax's, TimelineMax's, etc -- to get some small performance boost?  I was thinking of something along the lines of fine-tuning onUpdates, or something, perhaps make them check less often — grasping at straws here.  We believe the fault is in the videos/player, again, but I thought I'd investigate all angles…

Link to comment
Share on other sites

Thanks your respectful query. Unfortunately there really isn't anything specific we can point to. Flash Player, unfortunately, has its limits and it seems like you're admittedly pushing things pretty hard. 


If I recall correctly you're already keeping memory management in mind and unloading assets when they aren't needed. If video playback performance is hindering the game from running smoothly, perhaps StageVideo is something to look into, but frankly I don't have much experience with it. 


I wish I had some silver bullet optimization technique to recommend, but right now LoaderMax and all the animation classes are as efficient as we can possibly imagine.

Link to comment
Share on other sites

Oh, one small tip that may boost things slightly (probably not noticeably): use any of these eases in v12: Linear, Quad, Cubic, Quart, Quint, Strong, Power1, Power2, Power3, or Power4 because they're baked into the core rendering method. Avoid things like Expo, Sine, etc. 


Use TweenLite instead of TweenMax wherever you can unless you specifically need a TweenMax-specific feature like repeat/yoyo. TweenLite's rendering method is slightly faster because it doesn't have to account for any repeat/yoyo logic or event dispatching. 


Again, I doubt that'll make a big difference in real-world performance, but I figured I'd toss it out there in case it's helpful. 

Link to comment
Share on other sites

Thanks for the help!  I was able to get it up to client's satisfaction by removing some animations (or at least giving them the option to do so), but most importantly I was calling a somewhat lengthy status check function on each onUpdate of one of the main tweens — I replaced this with something Timer based (the client can set the time via xml and thus tweak it); when I set the check to be every .4 seconds or so, it seemed to help; I think onUpdate was firing more often than I needed…(nothing to do with GS, of course -- 'too often' strictly in context of what I was doing on the onUpdate firing)


I will investigate the other things above.  For the moment, at least, the client is happy.  


(I have to say that the app actually runs fine on its own, a testament both to GS, which is used everywhere, and also in some part to my coding; it was when loaded into this 3rd party video playing system that the PCs CPU began to get overloaded)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.