jonkogan / nullpomino

Automatically exported from code.google.com/p/nullpomino
0 stars 0 forks source link

game takes more than a minute to load (slick) #81

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Running slick version on linux (x86).

The game takes about 1.5min to load. During this time, there are multiple 
warnings of the form "PNGImageData failed to read the data" (apparently one per 
image), as well as multiple "Repeated allocation of very large block" warning. 
During the loading time, java uses 100% processor. After about 1.5min, if I 
click on the window, the game works (almost) correctly. If I don't click on it, 
java keeps on using 100% processor until I do click. Once the game is running, 
transparency on fonts does not work, the whole output is dim, and the line 
effect is mostly black (see attached screeshot).

More details:

uname -a:
Linux ***** 2.6.32-5-amd64 #1 SMP Tue Sep 13 23:25:22 UTC 2011 x86_64 GNU/Linux

java --version
java version "1.5.0"
gij (GNU libgcj) version 4.4.5

console warnings samples (I might not group them correctly):

15:02:06,749 [main] DEBUG ResourceHolder: Loading image from 
res/graphics/back19.png
15:02:06,750 [main] WARN  Slick: class org.newdawn.slick.opengl.PNGImageData 
failed to read the data
java.io.EOFException
   at org.newdawn.slick.opengl.PNGImageData.readChunkUnzip(PNGImageData.java:561)
   at org.newdawn.slick.opengl.PNGImageData.decode(PNGImageData.java:182)
   at org.newdawn.slick.opengl.PNGImageData.loadImage(PNGImageData.java:693)
   at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:62)
   at org.newdawn.slick.opengl.CompositeImageData.loadImage(CompositeImageData.java:43)
   at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:292)
   at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:254)
   at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:187)
   at org.newdawn.slick.Image.<init>(Image.java:192)
   at org.newdawn.slick.Image.<init>(Image.java:166)
   at org.newdawn.slick.Image.<init>(Image.java:154)
   at org.newdawn.slick.Image.<init>(Image.java:132)
   at mu.nu.nullpo.gui.slick.ResourceHolder.loadImage(ResourceHolder.java:315)
   at mu.nu.nullpo.gui.slick.ResourceHolder.loadBackgroundImages(ResourceHolder.java:277)
   at mu.nu.nullpo.gui.slick.ResourceHolder.load(ResourceHolder.java:166)
   at mu.nu.nullpo.gui.slick.StateLoading.enter(StateLoading.java:88)
   at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:175)
   at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:394)
   at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:318)
   at mu.nu.nullpo.gui.slick.NullpoMinoSlick.main(NullpoMinoSlick.java:357)
Header Chunk. Image width:640 height:480 depth:8 color type:2 compression 
type:0 filter type:0 interlace:0

15:02:08,958 [main] ERROR ResourceHolder: TTF Font load failed
java.lang.UnsupportedOperationException
   at gnu.java.awt.peer.gtk.GtkToolkit.createFont(libgcj.so.10)
   at java.awt.Font.createFont(libgcj.so.10)
   at org.newdawn.slick.UnicodeFont.createFont(UnicodeFont.java:61)
   at org.newdawn.slick.UnicodeFont.<init>(UnicodeFont.java:173)
   at mu.nu.nullpo.gui.slick.ResourceHolder.load(ResourceHolder.java:171)
   at mu.nu.nullpo.gui.slick.StateLoading.enter(StateLoading.java:88)
   at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:175)
   at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:394)
   at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:318)
   at mu.nu.nullpo.gui.slick.NullpoMinoSlick.main(NullpoMinoSlick.java:357)

GC Warning: Repeated allocation of very large block (appr. size 1576960):
    May lead to memory leak and poor performance.

Original issue reported on code.google.com by alexis.g...@gmail.com on 25 Oct 2011 at 1:08

Attachments:

GoogleCodeExporter commented 8 years ago
Additionally, the fps also start at 60 then drop in about 20 seconds to about 
30, making the game unplayable (and java takes 100% processor). No additional 
messages are reported in the console after the loading phase. Fps go back to 60 
when "retrying" a new game (without quitting the application), then they drop 
back to 30 in 20 seconds.

Original comment by alexis.g...@gmail.com on 25 Oct 2011 at 1:29

GoogleCodeExporter commented 8 years ago
I think it's because your initializing the texture every time you call it.
What you should be doing is having a init method like :
private void initTextures(){
   Texture1 = [init texture here];
}
Then when you need the texture say
   neededTexture = texture1;

Original comment by 5C0J...@gmail.com on 4 Jan 2012 at 8:38