Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (577)
games submitted by our members
Games in WIP (498)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  My game is lagging so badly  (Read 1241 times)
0 Members and 1 Guest are viewing this topic.
Offline SirArtist

Junior Newbie





« Posted 2006-01-30 15: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

Junior Newbie





« Reply #1 - Posted 2006-01-30 22: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

Senior Member




shiny.


« Reply #2 - Posted 2006-01-30 23: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! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline SirArtist

Junior Newbie





« Reply #3 - Posted 2006-01-31 00: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.
Online Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #4 - Posted 2006-01-31 01: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

Junior Newbie





« Reply #5 - Posted 2006-01-31 17: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

Senior Member




shiny.


« Reply #6 - Posted 2006-01-31 20: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

Junior Newbie





« Reply #7 - Posted 2006-02-02 18: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

Senior Member




shiny.


« Reply #8 - Posted 2006-02-02 21: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]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (23 views)
2014-04-15 18:08:23

BurntPizza (18 views)
2014-04-15 03:46:01

UprightPath (32 views)
2014-04-14 17:39:50

UprightPath (16 views)
2014-04-14 17:35:47

Porlus (32 views)
2014-04-14 15:48:38

tom_mai78101 (58 views)
2014-04-10 04:04:31

BurntPizza (116 views)
2014-04-08 23:06:04

tom_mai78101 (216 views)
2014-04-05 13:34:39

trollwarrior1 (183 views)
2014-04-04 12:06:45

CJLetsGame (190 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!