I shaved 10ms from my rendertime with small hack
Monkey Targets Forums/Flash/I shaved 10ms from my rendertime with small hack
| ||
Flash is by far the worst performing target, but it's not necessarily Monkeys fault. In my attempt to squeeze all the performance I can from my game I resorted to this old trick. step1: Create config flag in your game to specify the quality of the stage. #FLASH_QUALITY="LOW" step2: Edit the 'mojo/native/mojo.flash.as' file and add this line at the bottom of the constructor of 'gxtkGraphics' stage.quality = Config.FLASH_QUALITY=="LOW" ? StageQuality.LOW : StageQuality.HIGH; In my case, my rendertime went from 20ms down to 9ms and the difference in quality is nearly imperceptible. The downside of the way I did it, is that you can't alternate between high quality and low quality in realtime and the config option must always to be present after you make the change to the mojo native file. #FLASH_QUALITY="LOW" '// or #FLASH_QUALITY="something else" == HIGH Maybe Mark can make changing the stage quality at runtime official? |
| ||
Maybe Mark can make changing the stage quality at runtime official? You can do it yourself :) native/flash.as class MyUtils { public static function SetStageQuality(quality:String):void{ BBFlashGame.FlashGame().GetDisplayObjectContainer().stage.quality = quality; } public static function GetStageQuality():String{ return BBFlashGame.FlashGame().GetDisplayObjectContainer().stage.quality; } } externs.monkey Strict #If TARGET="flash" Import "native/flash.as" Extern Class MyUtils ' quality = "low", "medium", "high" (default), "best" ' http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/StageQuality.html Function SetStageQuality:Void(quality:String) ' Function GetStageQuality:String() End Class Public #EndIf ''' Usage: ''' MyUtils.SetStageQuality("low") ''' Print("Quality: " + MyUtils.GetStageQuality()) |