Troubleshooting frames per second

Hi, i’m in the process of developing a tower defense game - I first had physical towers, but I decided to remove the physical part due a low fps-count. Now, I’d still like for some projectiles to be physical (not all types of towers would shoot this kind of projectile). But it seems I’m missing something, because a few towers seems fine - but over time, the fps seems to dive into unplayable. What follows is a test case i’ve put together if you’d like to try it. Any hints would be most appreciated.

Edit: Java removed

Seems the java syntax highlighter got a large part of it wrong (the green comments). But it should work if you copy paste to a working jme sdk (im using 3.0beta)

Thats not a test case thats your complete code ^^ It looks like you never unregister the collision listeners. Make sure you clean everything up that you create, if necessary use the profiler to check what objects you hoard.

The only addCollisionListener-calls made (and not commented) are the ones for my towers and the base, I’d be mightely confused if they had to be removed.

A bit off topic and out of curiosity: How would I go about making a test case if I didn’t know which part of my code was the faulty one ? Theres largely only code from the tutorials and the jmetests in there :slight_smile:

I guess I have to get better at profiling. I tried it, but was unable to spot anything.

The point of a test case is to simplify things. In fact a lot of the time people solve their own problem making the test case.

Put in some minimum bit of functionality, test to see if the error occurs. Try something else, repeat.

Eventually that helps you narrow it down and you can then put up a simple and short example that people can look through carefully for you. At the moment the amount of code you posted is more than most people have the time to read through - especially since bug hunting can involve quite careful reading.

Test Cases are also called SSCCE (Short, Self Contained, Correct (Compilable), Example).