-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lagging when the screen is full of "monsters" #14
Comments
Yes, that's quite normal. Your phone is very busy to render all the assets on the screen. A lot of tower defense have this problem. |
You could look into profiling the app to see if the framerate drop could be avoided until a bigger number of enemies are on screen. Then you could open either issues or pull requests about specific issues that you find. But this one is just too broad as @Almtesh pointed out. |
I think there are two ways to address this problem:
|
Note that another strategy would be skipping frames. As in, make the game drop FPS instead of lag to render always the same number of frames per in-game second. I don't know what the current FPS is, but perhaps you could make the app accept a range like 15-60. At best, it would do 60 frames per second, and at worst 15. You don't want it to drop to something like 4 frames per second. |
Otherwise, you have large delays in waves |
You're losing the bonus if you do that. Maybe a button to do faster wave will be great too. Around wave 6X it's reeeeeaaaaaaally long. |
You should consider to use lengthsquared whenever possible. Sqrt is quite expensive. Maybe save the actual towerrange once (for displaying purposes in the popup) but calculate the squaredrange once and compare to that. |
I heard about it too. It's a trick to save lot of time. I don't even know how to compute a square root. |
I think a lot of computing power must be used in tallying all of the damage done by all of the projectiles (tens of shots per second by each Gatling tower) to all of the hit counters (one for each enemy). I have a pretty robust phone, and it gets HOT playing this game. Is it really harder for the processor to render the graphics than it is to keep score? I agree that most Tower Defense games that I've played slow down at some point, even on a computer. The only way to stop it from happening for sure seems to be to make the enemies stronger so the game ends earlier. |
I've replaced some distances with squared distances and it doesn't seem to make a big difference. What I see while profiling with lots of enemies, is that there are tons of calls to iterator methods like LazyIterator.hasNext, SmartIterator.fetchNext and similar. I'm having problems running Android Device Monitor to further analyze the trace so I leave two useful trace files in this zip here. |
I've run the current version of the app in the emulator with +1000 enemies and it doesn't seem to lag. Is anybody still having lags? 2000 enemies now and still smooth. At 8x, however, it starts to drop frames, but who cares. Edit: I'm sorry, it seems the emulator was pretty fast. On a physical phone, it still lags. |
Moving to #141. |
http://hpics.li/ad4eff6
As you can see on the picture the screen is full of "monsters". But on the screenshot you cannot see that at this point the game is lagging a lot !!
The text was updated successfully, but these errors were encountered: