Be a Supporter!

Krazy Birds Lagtest

  • 421 Views
  • 10 Replies
New Topic Respond to this Topic
Mr-Shark
Mr-Shark
  • Member since: Dec. 11, 2001
  • Offline.
Forum Stats
Member
Level 20
Game Developer
Krazy Birds Lagtest Oct. 7th, 2012 @ 05:56 AM Reply

I think I've posted this before, but nobody replied I started this game a long time ago and it's got a lot of effects that it will be using, mostly trippy flashy stuff but I want to know how much it's affecting the framerate for some users.

Go to the Psychedelic World, it's nothing but basic blocks and a trippy effect, the forest is a little messed up, but there is a mushroom somewhere that enables another trippy effect.

Just lemme know how much this does or does not slowdown while the bird is tripping.

milchreis
milchreis
  • Member since: Jan. 11, 2008
  • Online!
Forum Stats
Member
Level 26
Programmer
Response to Krazy Birds Lagtest Oct. 7th, 2012 @ 06:13 AM Reply

At 10/7/12 05:56 AM, Mr-Shark wrote: I want to know how much it's affecting the framerate for some users.

Adding something that actually displays the framerate would be helpful.

egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to Krazy Birds Lagtest Oct. 7th, 2012 @ 10:11 AM Reply

I took some code I found and modified the hell out of it. Still trying to get "CPU Usage" to work, but that wasn't in the original design, anyway.

package {
	import flash.display.Sprite;
	import flash.display.DisplayObjectContainer;
	import flash.display.DisplayObject;
	import flash.events.Event;
	import flash.system.Capabilities;
	import flash.system.System;
	import flash.text.StyleSheet;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.utils.getTimer;
	
	public class MovieMonitor {
		//vars
		private var _sprite:Sprite = new Sprite();
		private var _xml:XML;
		private var _text:TextField;
		private var _fps:uint = 0;
		private var _ms:uint = 0;
		private var _timer:int = 0;
		private var _msTimer:int;
		private var _maxMemory:Number = 0;
		
		//constructor
		public function MovieMonitor():void {
			_xml = <xml>
				<sectionTitle>FPS MONITOR</sectionTitle>
				<sectionLabel>FPS: </sectionLabel>
				<framesPerSecond>-</framesPerSecond>
				<sectionLabel>MS Per Frame: </sectionLabel>
				<msFrame>-</msFrame>
				<sectionLabel>CPU Usage: </sectionLabel>
				<cpuUse>-</cpuUse>
				<sectionTitle>MEMORY MONITOR</sectionTitle>
				<sectionLabel>Direct: </sectionLabel>
				<directMemory>-</directMemory>
				<sectionLabel>Max Direct: </sectionLabel>
				<directMemoryMax>-</directMemoryMax>
				<sectionLabel>Total: </sectionLabel>
				<veryTotalMemory>-</veryTotalMemory>
				<sectionLabel>Garbage: </sectionLabel>
				<garbageMemory>-</garbageMemory>
				<sectionTitle>STAGE MONITOR</sectionTitle>
				<sectionLabel>Children: </sectionLabel>
				<nChildren>-</nChildren>
			</xml>;
			
			var style:StyleSheet = new StyleSheet();
			style.setStyle("xml", {fontSize:"10px",fontFamily:"arial"});
			style.setStyle("sectionTitle", {color:"#FFAA00"});
			style.setStyle("sectionLabel", {color:"#CCCCCC",display:"inline"});
			style.setStyle("framesPerSecond", {color:"#FFFFFF"});
			style.setStyle("msFrame", {color:"#FFFFFF"});
			style.setStyle("cpuUse", {color:"#FFFFFF"});
			style.setStyle("averageFPS", {color:"#FFFFFF"});
			style.setStyle("directMemory", {color:"#FFFFFF"});
			style.setStyle("veryTotalMemory", {color:"#FFFFFF"});
			style.setStyle("garbageMemory", {color:"#FFFFFF"});
			style.setStyle("directMemoryMax", {color:"#FFFFFF"});
			style.setStyle("nChildren", {color:"#FFFFFF"});
			
			_text = new TextField();
			_text.alpha = 0.6;
			_text.autoSize = TextFieldAutoSize.LEFT;
			_text.styleSheet = style;
			_text.condenseWhite = true;
			_text.selectable = false;
			_text.background = true;
			_text.backgroundColor = 0x111111;
			_text.border = true;
			_text.borderColor = 0x333333;
			
			_sprite.addChild(_text);
			_sprite.x = -13;
			_sprite.y = 5;
			_sprite.name = "movieMonitor";
			
			if (Capabilities.isDebugger) {
				Interface.UI.addChild(_sprite);
			}
		}
		
		//public
		public function update(stage:DisplayObjectContainer):void {
			_msTimer = getTimer();
			
			if (getTimer() - _timer >= 1000) {
				_maxMemory = Math.max(System.totalMemory, _maxMemory);
				_xml.directMemory = (System.totalMemory/1048576).toFixed(3);
				_xml.directMemoryMax = (_maxMemory/1048576).toFixed(3);
				_xml.veryTotalMemory = (System.privateMemory/1048576).toFixed(3);
				_xml.garbageMemory = (System.freeMemory/1048576).toFixed(3);
				_xml.framesPerSecond = _fps;
				
				_fps = 0;
				_xml.msFrame = _msTimer - _ms;
				_timer = getTimer();
			}
			
			_xml.nChildren = countChildren(stage);
			_xml.cpuUse = System.processCPUUsage.toFixed(3);
			
			_fps++;
			_ms = _msTimer;
			_text.htmlText = _xml;
		}
		
		public function fullScreen():void {
			_sprite.x = -127;
		}
		public function window():void {
			_sprite.x = -13;
		}
		
		//private
		
		private function countChildren(container:DisplayObjectContainer):uint {
			var temp:uint = container.numChildren;
			
			for (var i:uint=0; i < container.numChildren; i++) {
				if (container.getChildAt(i) is DisplayObjectContainer) {
					temp += countChildren(DisplayObjectContainer(container.getChildAt(i)));
				}
			}
			
			return temp;
		}
	}
}

Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
Mr-Shark
Mr-Shark
  • Member since: Dec. 11, 2001
  • Offline.
Forum Stats
Member
Level 20
Game Developer
Response to Krazy Birds Lagtest Oct. 7th, 2012 @ 12:46 PM Reply

Like you can't just open the damn game, try it and LOOK IS IT GOING SLOW OR IS IT NOT. NGers u disappoint me sometimes.

MSGhero
MSGhero
  • Member since: Dec. 15, 2010
  • Offline.
Forum Stats
Supporter
Level 16
Game Developer
Response to Krazy Birds Lagtest Oct. 7th, 2012 @ 12:56 PM Reply

At 10/7/12 12:46 PM, Mr-Shark wrote: Like you can't just open the damn game, try it and LOOK IS IT GOING SLOW OR IS IT NOT. NGers u disappoint me sometimes.

If you wanted it to run at 60fps and it's actually running at 30fps, no one would know since you didn't say what fps you wanted, and it would look perfectly fine at 30. You disappoint me sometimes.

egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to Krazy Birds Lagtest Oct. 7th, 2012 @ 01:04 PM Reply

At 10/7/12 12:46 PM, Mr-Shark wrote: Like you can't just open the damn game, try it and LOOK IS IT GOING SLOW OR IS IT NOT. NGers u disappoint me sometimes.

looked at it, it looks fine. I can't tell the difference between 30 and 60 FPS in an animation.

use the monitor I gave you (some editing required)


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
Mr-Shark
Mr-Shark
  • Member since: Dec. 11, 2001
  • Offline.
Forum Stats
Member
Level 20
Game Developer
Response to Krazy Birds Lagtest Oct. 7th, 2012 @ 01:31 PM Reply

looks like as3, gives about 40 errors not gunna work for this

egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to Krazy Birds Lagtest Oct. 7th, 2012 @ 01:35 PM Reply

At 10/7/12 01:31 PM, Mr-Shark wrote: looks like as3, gives about 40 errors not gunna work for this
Interface.UI.addChild(_sprite);

i'm pretty sure you don't have a public static UI in a class called Interface, and i'm also pretty sure you're not using AIR, in which case Capabilities doesn't exist. (I don't think)

Also, if you're using AS2 the whole thing's not gonna work. Concept is the same, so just take that and make your own monitor.


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
64base
64base
  • Member since: Apr. 18, 2012
  • Offline.
Forum Stats
Member
Level 02
Programmer
Response to Krazy Birds Lagtest Oct. 8th, 2012 @ 04:11 AM Reply

No framedrops at all running on a mid-spec graphics card (AMD Radeon HD 4570) + 2.1ghz Intel Pentium T4

Off topic:
All I can say is I you've restored my trust in creativity. It's good to know that we have non-mainstream game devs like yourself who actually create and use ideas! I've made many wacky and weird games most which were really hard to master (or play) but had a lot of imagination-propelled content and YOUR IDEA IS JUST PLAIN F'ING AWESOME..


.

danman113
danman113
  • Member since: Mar. 5, 2011
  • Offline.
Forum Stats
Member
Level 20
Game Developer
Response to Krazy Birds Lagtest Oct. 8th, 2012 @ 04:34 PM Reply

Nope, works just fine on my low-tier laptop. Get a constant 30. For an as2 game I must say this is quite well optimized.

My laptop specs:
Intel dual core @ 2.0 ghz
Radeon X1400

This being said my computer is a pretty decent example of a low tier computer so no one should have a problem running this.


You are reading this

Mr-Shark
Mr-Shark
  • Member since: Dec. 11, 2001
  • Offline.
Forum Stats
Member
Level 20
Game Developer
Response to Krazy Birds Lagtest Oct. 9th, 2012 @ 03:18 PM Reply

Was hoping for a few more responses, but thanks for everyone that did. :D