PDA

View Full Version : Preformance issues...


icanubis
08-28-2004, 12:43 PM
Hello...

Just started out with flash but i have programming experiance from java...

Okey... here is the problem...

I'm developing a game in flash just for fun, but when I'm have to much graphics and moving stuff, I allways seems to run in to some preformance issues and evertings starts to lagg badly. But I have seen games with waaay more objects doing fine...

The framerate is 24fps.

Like i said i dont have much flash experiance but some resons I can think of:
1. everything is in vector graphics (is that a preformance issue?)
2. The flash is quite large compared to others. (800x550 px)

Here is an URL to the game:
http://www.elight.se/bg/bg.html

Here are also some cut outs from the as if these hav.
This is the script that generates the units.
for(i=0;i<game.enemiesLeft;i++){
var name = "enemy"+game.currentEnemies;
var temp =new game["Tankp1"]();

duplicateMovieClip("tank",name, 10001+game.currentEnemies);
//_root[name].gotoAndPlay(2);
_root.game.enemies[name] = _root[name];
_root[name] = undefined;
_root.game.enemies[name].vars = temp;
_root.game.enemies[name]._x = game.windowStartY + random(500)+25;
_root.game.enemies[name]._y = game.windowStartY - 20 - random(500);
_root.game.enemies[name]._visible = false;
_root.game.currentEnemies++;
}

This is the script that is moving the units forward (is placed inside every unit).
onClipEvent (enterFrame){
_y += vars.speed;

if(_y > _root.game.windowEndY-25){
_root.score += vars.lostPoints;
_root.game.enemiesLeft--;
removeMovieClip(this);
}
if(_y > (_root.game.windowStartY - 20)){
_visible = true;
}
}

So if someone have any idea I would be glad.

roguebot989
09-03-2004, 10:44 PM
first of all... awesome game.

i think the problem is that you're just using to many enemies, the excess amount of movie clips on the stage make the game slow, nothing about how you're doing the script. Also that many tanks can make the game unfun. and also, the start button needs to have a box around it so you don't have to click the thin letters. and also, the weapon firing thingy could use an upgrade, it fires to slow to be effective against the tanks. but nothing wrong with the script. oh and, try not to use gradients or complicated textures, they tend to cause lag to.

roguebot989
09-03-2004, 10:50 PM
now that i think about it, it's definintly the gradients, a single color makes the rendering of the game quick and easy. for games you want anything that moves to be a simple and as small a file size as possible. leave gradients for things like the loading pages or movies. and i'm assuming you're only using vector images right? not bitmaps?

Dr Warm
09-06-2004, 08:58 AM
Yeah those explosion circles must have the max amount of gradients, not very wise! Yeah i find that the vector based engine can be annoying especially with hitTests and stuff, but depends what you want, i like making tile-based games, good tutorials here : www.tonypa.pri.ee infact very good everyone can learn something (or maybe i'm just total noob)