Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

(Java) Timer objects 'running slow'

Name: Anonymous 2011-03-07 1:33

Hi. I have a java game I made in a course at Uni. It has three Timer objects.
When I run the game from Notepad++ it runs perfectly (sweet-as game if I may say so myself).
I have made executable .jar files so that I can share it with friends. Unfortunately sometimes the game runs 'slow' when run from the .jar.

I have the feeling this has nothing to do with errors in code (due to the randomness of the error's occurence) but rather a runtime problem (if that's the right word..).

Anyone know what the problem might be?
Also plz keep elitism to a minimum

Name: Anonymous 2011-03-07 18:43

You should randomize the starting positions of the enemies. That makes it impossible for the player to find  an always safe spot.

here's some random fps code that i found in some old test code of mine.  Good to get an fps option so you can see if your changes are making improvements.

        while(running) {
            // count Frames per second...
            lastTime = curTime;
            curTime = System.currentTimeMillis();
            totalTime += curTime - lastTime;
            if( totalTime > 1000 ) {
                totalTime -= 1000;
                fps = frames;
                frames = 0;
            }
            ++frames;

            update();
            render();
            paint();
        }

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List