Giter Club home page Giter Club logo

Comments (12)

Almtesh avatar Almtesh commented on July 28, 2024

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.

from android-anuto.

mvdan avatar mvdan commented on July 28, 2024

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.

from android-anuto.

mjaun avatar mjaun commented on July 28, 2024

I think there are two ways to address this problem:

  • Optimizing the game engine (any hints are much appreciated! Like @mvdan pointed out, profiling would probably be the way to go)
  • Altering the gameplay like limiting the total amount of active waves (maybe reduces the fun factor but would basically limit the total amount of enemies in game)

from android-anuto.

mvdan avatar mvdan commented on July 28, 2024

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.

from android-anuto.

Almtesh avatar Almtesh commented on July 28, 2024

Otherwise, you have large delays in waves

from android-anuto.

Bahjesaispas avatar Bahjesaispas commented on July 28, 2024

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.

from android-anuto.

Xodem avatar Xodem commented on July 28, 2024

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.

from android-anuto.

Almtesh avatar Almtesh commented on July 28, 2024

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.

from android-anuto.

notpokey avatar notpokey commented on July 28, 2024

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.

from android-anuto.

civyshk avatar civyshk commented on July 28, 2024

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.

from android-anuto.

civyshk avatar civyshk commented on July 28, 2024

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.

from android-anuto.

mjaun avatar mjaun commented on July 28, 2024

Moving to #141.

from android-anuto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.