dcsimg
A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 37 of 37

Thread: Zombie Game Beta 2 - (Reviews / Testers Needed)

  1. #21
    Member
    Join Date
    May 2006
    Posts
    93
    Interesting...I would say a 3Ghz is definatly more than sufficent to run this game. Is it your charecter is moving slow? I made it so you can level up and with each level up, you can upgrade speed if you wish. Speed of charecter, not game that is. As far as changing guns with keyboard. I was about to do this, then I thought of you. Actually, your keyboard. Can I use numbers 1-4 to change weapons? Maybe I will code this in and still allow the mouse to click them. It would be nice to keep hands on the keyboard rather than taking them off to click a gun. Thanks for the link, I am going to start studying it now. As for the code optimization. I am a really good programmer. There is little more you could enhance it with. I think part of the problem is that 6-8 zombies exsist off scene, they are the key zombies that I duplicate to create the others. Therefore there are 8 + whatever zombies you see on screen. Using up resources. Secondly, many of my bitmaps use oulining and transparency, which I heard is a bad idea in flash. Anyway, thanks for the link. I am going to get to work implementing scrolling.

  2. #22
    Member
    Join Date
    Jun 2006
    Posts
    43
    I think its really good.
    Hint: Use Other Weapons

  3. #23
    crossconscious
    Join Date
    Sep 2005
    Location
    Belgium
    Posts
    1,188
    Interesting...I would say a 3Ghz is definatly more than sufficent to run this game. Is it your charecter is moving slow?
    Actually, the slowdown occurs when I'm shooting (even with an empty weapon). Not only my character, but the zombies as well. Character movement is a tad slow too, but if this is upgradeable, it's acceptable

    Can I use numbers 1-4 to change weapons
    Well, on Belgian keyboards (and a lot of others), you have to press shift to type in one of the non-numpad numbers, otherwise you get & for 1, for 2, etc. I think in America this is in reverse - press the key to get the number, and hold shift for the special characters (which are ordered differently too). But I could be mistaking.
    But if you also allow numpad numbers, it should be fine. Except for laptop users. So best thing would be to let the user change the kayboard configuration.

    Maybe I will code this in and still allow the mouse to click them.
    Definately. Also make it so that when your weapon is empty, you change to the previous weapon automatically.

    As for the code optimization. I am a really good programmer. There is little more you could enhance it with. I think part of the problem is that 6-8 zombies exsist off scene, they are the key zombies that I duplicate to create the others.
    First off, I don't doubt that you're a good programmer, but being a good programmer doesn't mean you're a good flash programmer - flash has all kinds of quirky little things that you need to do to optimize the game. I'm not saying you don't know all this stuff, but if you don't, start learning.
    For instance, why do you need those "key zombies"? Can't you just use attachMovie? It will use less resources.

  4. #24
    Say hello to Bob Kakihara's Avatar
    Join Date
    Jul 2004
    Location
    kent, England
    Posts
    1,067
    Having 8 mcs not doing anything off screen is not a good thing. They will effect the performance of the engine.

    Like said before me, use attachMovie.

    Also if the perfomance is lagging considerably you could do worse than using setinterval to only call functions every so often rather than every frame. Obviously most functions would need to be called every frame but things like checking if your player is dead or what weapon you are using could be called every couple of seconds rather than 50 times in two seconds if you are running the game at 25fps. Look through your code and see what functions you could only call every second or two that wouldnt notice that much during gameplay.

    I havent read the entire thread so I apologise if these things have been said or you have done them already.

    Edit:

    Just reread your last post and realised you said you are using transparency on a few images. If by that you mean using _alpha then you really should change that. Using alpha is a sure way to really slow down the performance of your engine.

    BTW its looking pretty good. I like the display at the bottom of the screen and the weapons and projectiles look good.

    The game does lag very badly once more than 15 zombies appear. That really shouldnt happen in a game like this. It may well be that the use of alpha is killing the performance.
    Last edited by Kakihara; 07-11-2006 at 07:50 PM.
    If our body is a clock ticking away and if while we experience all that this world has to offer time has still continued to pass, are we living or just experiencing a slow death?

  5. #25
    Member
    Join Date
    May 2006
    Posts
    93
    Kakihara: Thanks for the tip on setInterval. I will implement this in. It sounds like it could free up alot of unnessacary processing.

    As for attachMovie. I am having trouble with it. I get it to attach the zombie movie to a blank mc on the screen. The zombie however isnt functioning. I have made him into a mc inside an mc. The onclipevent(enterFrame) code is the placed on the mc inside the mc. The bug is that the zombie no long chases the charecter. He kind of dumbly walks down and to the right. Any ideas of how to fix this?

    This is the code in each of the 8 zombies outside the game. I am currently trapping them in a box off stage. I then duplicate them and place them onstage. Any ideas how to improve this obvious cpu intensive method?

    Code:
    onClipEvent (load) {
    	friction = ".01";
    	hitsLeft=1;
    	finishMe=0;
    }
    
    onClipEvent (enterFrame) {	
    
    //
    // Kill me if Game Over
    // 
    if(_root.gameStatus==1){
    	removeMovieClip(this);
    }
    //
    // End Kill Me
    //
    
    
    
    
    //
    // Checks gun type, then checks if bullets hit me
    //
    
    
    //
    // Regular hand gun
    //
    
    if(_root.gunType == "regularGun"){
    for(someNum = 0; someNum < 9; someNum++){
    	if(eval("_root.shot"+someNum).alive && hitsLeft>0){
    		if(this.hitTest("_root.shot"+someNum)){
    		hitsLeft-=_root.strength;
    		eval("_root.shot"+someNum).alive=0;
    		}
    	}
    	if(eval("_root.shot"+someNum).alive && hitsLeft<=0 && finishMe==0){
    		if(this.hitTest("_root.shot"+someNum)){
    		finishMe=1;
    		this.gotoAndPlay(2);
    		eval("_root.shot"+someNum).alive=0;
    		_root.killMeterVar++;
    		_root.killMeter.text=_root.killMeterVar;
    		_root.itemDrops(this._x, this._y);
    		_root.upgrade++;
    		_root.experience();
    		}
    	}
    }
    }
    //
    // End regular hand gun
    //
    
    
    //
    // Shotgun
    //
    if(_root.gunType == "shotgunGun"){
    		if(_root.shotgunBullet1.alive && hitsLeft>0){
    			if(this.hitTest(_root.shotgunBullet1)){
    			hitsLeft-=_root.strength;
    			//_root.shotgunBullet1.alive=0;
    		}
    	}
    	if(_root.shotgunBullet1.alive && hitsLeft<=0 && finishMe==0){
    		if(this.hitTest(_root.shotgunBullet1)){
    			finishMe=1;
    			this.gotoAndPlay(2);
    			//_root.shotgunBullet1.alive=0;
    			_root.killMeterVar++;
    			_root.killMeter.text=_root.killMeterVar;
    			_root.itemDrops(this._x, this._y);
    			_root.upgrade++;
    			_root.experience();
    		}
    	}
    
    }
    //
    // End shotgun
    //
    
    
    //
    // Crappy, one shot hand gun
    //
    if(_root.gunType == "handGun"){
    		if(_root.handGunBullet1.alive && hitsLeft>0){
    			if(this.hitTest(_root.handGunBullet1)){
    			hitsLeft-=_root.strength+5;
    			//_root.handGunBullet1.alive=0;
    			}
    		}
    		if(_root.handGunBullet1.alive && hitsLeft<=0 && finishMe==0){
    			if(this.hitTest(_root.handGunBullet1)){
    			_root.handGunBullet1.alive=0;
    			finishMe=1;
    			this.gotoAndPlay(2);
    			_root.killMeterVar++;
    			_root.killMeter.text=_root.killMeterVar;
    			_root.itemDrops(this._x, this._y);
    			_root.upgrade++;
    			_root.experience();
    			}
    		}
    }
    //
    // End one shot hand gun
    //
    
    
    //
    // Begin Ak machine gun
    //
    if(_root.gunType == "machineGun"){
    for(thisNum=0; thisNum<9; thisNum++){
    		if(eval("_root.akBullet"+thisNum).alive && hitsLeft>0){
    			if(this.hitTest("_root.akBullet"+thisNum)){
    			hitsLeft-=_root.strength;
    			eval("_root.akBullet"+thisNum).alive=0;
    			}
    		}
    			if(eval("_root.akBullet"+thisNum).alive && hitsLeft<=0 && finishMe==0){
    				if(this.hitTest("_root.akBullet"+thisNum)){
    			finishMe=1;
    			this.gotoAndPlay(2);
    			eval("_root.akBullet"+thisNum).alive=0;
    			_root.killMeterVar++;
    			_root.killMeter.text=_root.killMeterVar;
    			_root.itemDrops(this._x, this._y);
    			_root.upgrade++;
    			_root.experience();
    				}
    	}
    }
    //
    // End Ak machine gun
    //
    
    }
    
    	
    	
    	
    
    	if(this.hitTest(_root.player0.torso.headTouch)){
    		if(_root.life._width <= 0){
    			_root.gameOver();
    		}
    									  
    									  
    		if(_root.armor._width > 0){
    			_root.redWall.gotoAndPlay(2);
    			_root.armor._width-=.1;
    			_root.armorBar = Math.round(_root.armor._width);
    			}
    		else if(_root.life._width > 0){
    			_root.redWall.gotoAndPlay(2);
    			_root.life._width-=.1;
    			_root.lifeBar = Math.round(_root.life._width);
    			}
    	}
    	
    	
    	mouse_x = int(_root.targetx-this._x);
    	mouse_y = int(_root.targety-this._y);	
    	if (mouse_x>0 && mouse_y>0) {
    		quad = Number(4);
    	}
    	if (mouse_x<0 && mouse_y>0) {
    		quad = Number(1);
    	}
    	if (mouse_x<0 && mouse_y<0) {
    		quad = Number(2);
    	}
    	if (mouse_x>0 && mouse_y<0) {
    		quad = Number(3);
    	}
    	abs_x = Math.abs(mouse_x);
    	abs_y = Math.abs(mouse_y);
    	tg = abs_y/abs_x;
    	_root.maths = Math.atan(tg)*Number(180)/Math.PI;
     	if (quad == 1) { angle = number(90) - number(_root.maths) }
    	if (quad == 2) { angle = number(90) + number(_root.maths) }
     	if (quad == 3) { angle = number(270) - number(_root.maths) }
     	if (quad == 4) { angle = number(270) + number(_root.maths) }
    	if (not _root.done) { 
    	setProperty (this, _rotation, angle); 
    	_root.done = false;
    	}
    	speedx = difx*friction;
    	speedy = dify*friction;
    	setProperty (this, _y, this._y+speedy);
    	setProperty (this, _x, this._x+speedx);
    	difx = int(_root.targetx)-this._x;
    	dify = int(_root.targety)-this._y;
    }

  6. #26
    Say hello to Bob Kakihara's Avatar
    Join Date
    Jul 2004
    Location
    kent, England
    Posts
    1,067
    Setinterval is pretty handy. You just need to figure out what functions you could get away with calling every so often rather than every frame. It could just be you call a few functions every 10 frames than every frame. That would improve performance by a slight margin.

    When you say you are placing zombies in another mc what do you mean? I presume you mean: _root.zombieholder.attachMovie...etc... and your putting all your zombies in one holder mc.

    If you mean you are putting every zombie mc inside another mc for its own then you are really wasting a lot of performance. Basically you are placing twice as many mcs on stage than you need.

    If you are doing this you would be a lot better off using attachMovie to place each zombie in the same empty holder clip.

    I take it you are copyig the functions from your 'caged' zombies over to the new ones being created. In which case you could easily take your functions and place them on the main timeline before the onEnterFrame and use a for in loop to run through all the zombies in your zombie holder clip and get them to use that function as they are found.

    Basically delare your main fuction on the main timeline, replacing all references to the zombie itself including references like 'this' with something like 'ob'. Then on your onEnterFrame you could set up a for in loop that runs through the zombies in the zombie holder clip. Then you setup the name of the individual zombie clips and call the zombie function you setup to run the zombies.

    Something like this:

    code:

    for (var name in _root.zombieholder) {
    var ob=_root.zombieholder[name];
    zombiefunction(ob);
    }



    Thats off the top of my head but it should work if you set up the function with references to 'ob' rather than 'this'.

    Its a lot cleaner and less processor intensive to run all zombies from one function rather than give each zombie its own function.

    BTW the reason why your zombies move wierd is probably down to the fact that each mc has its own 'stage' relative to its registration point. The _roots registration point is at the top left (as you probably know) but if you create an mc the registration point may be in the center which means your coordinates and movement wil probably muck up.

    If you use the attachMovie and for in loop way of doing things you shouldnt have these problems and the game should run quite a lot quicker.

    Hope you understand all that rambling.
    If our body is a clock ticking away and if while we experience all that this world has to offer time has still continued to pass, are we living or just experiencing a slow death?

  7. #27
    Member
    Join Date
    May 2006
    Posts
    93
    Kakihara:
    I understand exactly what you are saying. Actually, as you were writting your response, I was likly coding this solution. I see what you mean by putting an mc on the screen (a container mc) then placing attachmovie clips zombies inside it. I am wondering, if I make the container mc the size of the screen resolution, will they then chase the charecter properly? I bet so...

    Secondly, the big problem I am having setting this up is identifing my zombies by name. I cant move the code that is currently in the zombie to the main without changing the this statements to the actual name of the zombie. I found a getProperty parameter that looks like this:

    Code:
    myName = getProperty(this, _name);
    But that returns the name of the movie clip in the library, not the instance name.

    I also tried when creating the zombies, to name the myName variable like this:

    Code:
    yPlacement = Math.round(Math.random()*(350-25))+25;
    _root.bigZombieMan.duplicateMovieClip("move"+zombNum, zombNum);
    
    // Here is where I try to name it
    eval("_root.move"+zombNum).myName=eval("_root.move"+zombNum);
    
    setProperty ("_root.move"+zombNum, _y, yPlacement);
    setProperty ("_root.move"+zombNum, _x, 600);
    zombNum++;
    Niether methods work. Any idea how to get the name of this guy? I know the name is "_root.move"+zombNum but I cant get it to go into a variable called myName which is inside each zombie.

  8. #28
    Say hello to Bob Kakihara's Avatar
    Join Date
    Jul 2004
    Location
    kent, England
    Posts
    1,067
    Describing this whole thing is quite hard so heres an example of a simple engine that loops through mcs in a holder mc and bounces them around screen.

    code:

    function moveme(ob) {
    if (ob.xdir == 1) {
    ob._x += ob.xspeed;
    } else if (ob.xdir == 2) {
    ob._x -= ob.xspeed;
    }
    if (ob.ydir == 1) {
    ob._y -= ob.yspeed;
    } else if (ob.ydir == 2) {
    ob._y += ob.yspeed;
    }
    if (ob._y<=0) {
    ob.ydir = 2;
    }
    if (ob._y>=450) {
    ob.ydir = 1;
    }
    if (ob._x<=0) {
    ob.xdir = 1;
    }
    if (ob._x>=450) {
    ob.xdir = 2;
    }
    }
    _root.attachMovie("balls", "balls", 1);
    num = 0;
    enemy = 0;
    maxenemy = 3;
    ball_count = 1;
    _root.onEnterFrame = function() {
    if (enemy<maxenemy) {
    create=true;
    }
    if (create==true) {
    _root.balls.attachMovie("ball", "ball"+ball_count, ball_count++);
    _root.balls["ball"+ball_count].xspeed = random(2)+2;
    _root.balls["ball"+ball_count].yspeed = random(2)+2;
    _root.balls["ball"+ball_count].xdir = random(2)+1;
    _root.balls["ball"+ball_count].ydir = random(2)+1;
    _root.balls["ball"+ball_count]._x = random(450);
    _root.balls["ball"+ball_count]._y = random(450);
    num+=1;
    enemy+=1;
    create = false;
    }
    for( name in _root.balls){
    var ob = _root.balls[name];
    moveme(ob);
    }

    };




    If you change the way you are naming your zombies to the way I have in this eample it should work. By the way I noticed you are using duplicate movie in the your script. Duplicate is not the same as Attach and they must be used differently code wise when trying to gain names etc... AttachMovie is a much better way to go IMO because it stops you from putting mcs on the stage manually which is a good thing.

    If you look at the very top of my example you can see ive attached a mc called 'balls' (no jokes please ), this acts as a holder for the 3 other mcs. 'Balls' is an empty mc I created and then deleted from the stage. Its in the library only and has the linkage name 'balls'. You can create an empty mc with code only but this in an old example so I didnt bother.

    The only suggestion I can give is to try and match your code style to this using a for in loop and attachMovie. By the way the usage of 'name' in the for in loop is actually a term that gets the name of an mc. It doesnt mean input an actual name.

    I never really use things like setProperty and some of the other things youve used so I cant help you out with that.

    Hopefully you can figure out what needs doing because I cant really help much more as we code quite differently.

    Good luck.

    Ps. You dont need num=0 and num+=1 in there. I forgot to delete those.
    If our body is a clock ticking away and if while we experience all that this world has to offer time has still continued to pass, are we living or just experiencing a slow death?

  9. #29
    Member
    Join Date
    May 2006
    Posts
    93
    Kakihara:
    Thanks so much for the help you have offered. I think I will just need to spend some time working out the bugs in getting this to work. I think I now know enough about the attachMovie to implement that over the old duplicate movie method. I think it will take some time, but I am sure I have enough help now to begin removing the code from the zombies, and placing it in a central location (the main). Thanks so much for your help. I bet when I get this implemented, I will notice a huge performance enhancement!

  10. #30
    Say hello to Bob Kakihara's Avatar
    Join Date
    Jul 2004
    Location
    kent, England
    Posts
    1,067
    No probs.

    I used to do much the same thing myself with using duplicate movie and having loads of different functions on different mcs.

    Its not just the performance that should improve but you should be able to debug and understand whats going on in your engine better.

    Well im getting back to finishing my game off and trying to get my head around trig and physics.
    If our body is a clock ticking away and if while we experience all that this world has to offer time has still continued to pass, are we living or just experiencing a slow death?

  11. #31
    Member
    Join Date
    Apr 2005
    Location
    Vancouver BC, Canada
    Posts
    55
    Not sure if you have updated it again but it seems to run fine for me. I didn't find it too difficult, but I did find that it was so intense and fast paced that I never had any time to look down at my inventory or watch my experience points grow or even really look at anything but the zombies.

    If I could make one suggestion it would be to pick between white knuckle shooter or Resident Evil-ish RPG, don't do both. Or at least, not at the same time (you could transition between the two styles using different areas or levels, sort of like what T1ger suggested earlier).

    Fun game overall though, shows a lot of potential. I like the death animations quite a bit.

  12. #32
    Member
    Join Date
    May 2006
    Posts
    93
    arawkins:
    Thanks for your review. This is my beta, and so right now, the game is set to create 4 zombies every 4 secs or so. In the actual game there will be less constant waves of zombies, and points to rest and collect yourself. Also, I plan on adding actual levels to, so you can scroll and walk around not just stuck to a single window. But for this beta 2 release, I wanted to have the zombies available to expierence how they function and such. The actual gameplay will very greatly from this. But thank you, I agree, it is very difficult to switch guns or monitor stats in the bottom panel. I am also going to hotkey the guns to numbers 1-4, so you can quick switch guns and also I will make an auto switcher, so when one gun is out it auto switches to the next available gun.

    Thanks for your review, I will definatly look to change some of these concepts you mentioned by my next beta release.

  13. #33
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    VERY addictive game, WELL DONE! I killed over 511 zombies before it stopped being challenging and I stopped playing. What I really want to see are a few bosses, and I'd like it if you could make the 'Speed' stat effect how quickly you can turn round and walk backwards. I seriously would like the backward walking speed increased, I found it a bit harsh that it was about a fifth of the walk speed you get when you start, and didn't increase as I put stats onto 'Speed'.

    The only other glaring error is that (with certain weapons) you can't shoot while there are bullets of that weapon still on the screen. I really didn't like that. Plus, I think the fourth weapon was far too overpowered, you should make it fire less bullets at once, and make it run out of ammunition more quickly.

    Why is the game so slow? What framerate did you put it at? I know having about 20 zombies onscreen will be slowing it down a bit, but I've had far larger armies in Commando 3 that had to run through far more loops and checks than those things, and the fps didn't suffer that much because of it. Perhaps you're running more Math functions than are totally necessary? You can fill an array with precalculated sine or cosine values for every degree, and just round the zombies' movement to the result for the closest degree in that array, rather than calculating it all on-the-fly. Most games I wouldn't bother with that, but this is the kind of game that could really benefit from it.

    Also, if you're using hitTest for the collision, use circle-to-circle collision instead. Far more accurate for this, and probably less intensive (although I'm not sure?). And if you are using circle-to-circle, don't use Math.sqrt on the distance between the circles to find if they're intersecting; instead, square the radius of the player (preferably precalculate this, rather than using Math.pow). Does the same thing, but the other way around, and as a result is far less processor intensive.

    Also, how are you looping through the zombies? The fastest way is to make an array, and push the zombies into it, then for..in loop through the elements of the array.

    I foresee great things for this game!
    http://www.birchlabs.co.uk/
    You know you want to.

  14. #34
    Member
    Join Date
    May 2006
    Location
    Michigan
    Posts
    99
    I think is a good start ay be change the back ground color with every level also put some probs base on the level like dynamites you can touch and maybe add granedes with a big explotion and some electric gun ... that will be cool
    Jay

    The man with the plan !!!

  15. #35
    Say hello to Bob Kakihara's Avatar
    Join Date
    Jul 2004
    Location
    kent, England
    Posts
    1,067
    Vengeance has asked a good point. What FPS is the game set at?

    The optimum FPS is around 24/25. If you set it to something high like 50 then lag becomes a lot more noticable.
    If our body is a clock ticking away and if while we experience all that this world has to offer time has still continued to pass, are we living or just experiencing a slow death?

  16. #36
    Member
    Join Date
    May 2006
    Posts
    93
    Thanks everyone for a review.

    VENGEANCE MX: My next release should have levels and bosses. I also plan on animating the zombies. I will fix the backwards speed to...thanks for catching that!

    Jay2391: I have been working on grenades and a option to radio for a plane to drop napalm. I will see what I can do.

    Kakihara: Framerate is set at: 30
    Is 30 okay?

  17. #37
    Say hello to Bob Kakihara's Avatar
    Join Date
    Jul 2004
    Location
    kent, England
    Posts
    1,067
    Yeh 30 should be fine.

    Look forward to seeing an update.
    If our body is a clock ticking away and if while we experience all that this world has to offer time has still continued to pass, are we living or just experiencing a slow death?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center