Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  My game is lagging so badly  (Read 769 times)
0 Members and 2 Guests are viewing this topic.
Offline SirArtist

JGO n00b
*

Posts: 4



« on: 2006-01-30 09:23:00 »

Hello,
http://members.surfeu.fi/redapple/MyJavaStuff/ and click -> Attack Maniacs v1.0 while playing it lows down to FPS about 3-5. Maybe part of the reason is because I create lots of new object than using it again? It's strange because first it works fine and suddenly slows down when there is a more stuff.

Second problem: I want to use some gif animation on this applett, but when I replace some of a non-animated gis's by animated gifs my appletts freaks out. Some bug or what.

third problem: How can I make it show some animation while loading all images and sounds into memory. I use Mediatracker for images and for music Suns Soundloader and Soundlist classes.

And sorry my language.
Offline steeg

JGO n00b
*

Posts: 7



« Reply #1 on: 2006-01-30 16:58:00 »

I'm getting a constant 62 fps throughout the whole game, which seems kinda weird since it neves changes at all.
Offline Mr_Light

JGO Strike Force
***

Posts: 893


shiny.


« Reply #2 on: 2006-01-30 17:06:39 »

it seems quite fixed yes, also here it was 15 fps to level 5 or so and at level 6 or so I noticed it was 32 and there where certainly more items out there. So as Jeff said bottlenecks are almost never caused by the factor you first of figured would be desicive.

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Games published by our own members! Go get 'em!
Offline SirArtist

JGO n00b
*

Posts: 4



« Reply #3 on: 2006-01-30 18:04:52 »

I just tried with opera and on level 6 it slows down to 3-6 FPS, but playing it on NetBeans appletviewer it works fine FPS about 66 all the time. This fps method is like
       
1  
2  
3  
4  
5  
6  
      
        endFPS= System.currentTimeMillis();
 
        ifendFPS - beginFPS  != 0 ) differenceFPS = endFPS - beginFPS ;
        big.drawString("FPS "+ 1000 / ( differenceFPS ), leveys - 100, 30);   
       

so it change it only if difference is more than zero, I dont know right way to do FPS thing.
Offline Riven
« League of Dukes »

JGO Kernel
*****

Posts: 5870
Medals: 255


Hand over your head.


« Reply #4 on: 2006-01-30 19:29:56 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
private long lastCheck = System.currentTimeMillis();
private int counter = 0;

public void render()
{
    // do your stuff

    long now = System.currentTimeMillis();

   if(now - lastCheck > 1000)
   {
       System.out.println("FPS: "+counter);

       lastCheck += 1000;
       counter = 0;
   }

   counter ++;
}

Hi, appreciate more people! Σ ♥ = ¾

Learn how to award medals... and work your way up the social rankings
Offline SirArtist

JGO n00b
*

Posts: 4



« Reply #5 on: 2006-01-31 11:56:40 »

I update that FPS thing (and fix few bugs) now it makes sense, because sleep is 100ms and now FPS is about 10. And would you say what I have to do next/ how to improve this lowsy game or if you notice a bugs so tell me and if you bother give a glue of solution. thanks for help  Wink
Offline Mr_Light

JGO Strike Force
***

Posts: 893


shiny.


« Reply #6 on: 2006-01-31 14:18:52 »

try displaying the score for a while at the end of the game

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Offline SirArtist

JGO n00b
*

Posts: 4



« Reply #7 on: 2006-02-02 12:02:46 »

try displaying the score for a while at the end of the game

Thanks for the tips, I tried to do what you said. Give me your opinions of the game in my opinion the whole idea behind this game is boring. What I should do next? Did you found a bugs?

And a question. I want to put there a background image, waht is best way to do that. replace fillRect by drawimage?
Offline Mr_Light

JGO Strike Force
***

Posts: 893


shiny.


« Reply #8 on: 2006-02-02 15:59:02 »

not any that I could detect by playing it normally. The game reminded me of paratroopers oow nostalgy.

you could like paratroopers make the dudes stack(seen the movie starship troopers?) but if you want to fundamently change the game I'd would just start off from scratch and only take with you what you have learned from creatign this one.

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.08 seconds with 19 queries.