View Full Version : How to make Flash player run faster?
01-06-2001, 04:05 AM
This is tough. Must be real good to answer this question.
I have completee a chess game in Flash, and now I have this problem. Since I have to write a lot of fucntions to check for all possible and legal moves, and those function cause my movie run really slow. So what is the best way to make it run faster? Using less while loop, if...else or what?
01-06-2001, 06:12 AM
While loops will kill your CPU.
My chess game is made completely out of functions. The buttons have no actions other than function calls. When you drag and drop them they report their startinf position and ending position to a function which tests legality. Then that function calls the check function and a few others to test for other possible errors. If nothing goes wrong, it moves the piece to where the player dropped it, else it moves it back to where it started.
01-06-2001, 06:50 AM
That's exactly what I got. I am talking about the function to check the moves to see if it legal or not. For example, if your bishop is between your king and their queen then you can not move since it will result a check.
Anyway, I just want to know what really make the flash go slow. Comparison is better than while loop?
01-06-2001, 08:05 AM
loops arent' sbad, but if you test every possible move on the board every time a player moves then it will result in slow gameplay. The best idea would be to use 'for' loops (flash 5 only) and use 'break' when you get your result, so that the loop doesn't continue if it needn't.
What I'm saying is, if it's causing your computer to slow down you need to rethink your structure because you're looping too much or doing too many comparisons.
01-06-2001, 01:57 PM
Thanks Jesse, let's me try to restructure the program, but I still have to check out every single possible.
I will try the for loop, if I got a better result, I sure let you know.
vBulletin® v3.8.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.