Hansdampf
Sr. Member   Posts: 412 Medals: 2
too offending?
|
 |
«
on:
2009-02-01 12:04:28 » |
|
I discovered the holy grail, the silver bullet that solves all performance problems. Some of you will be impressed, others will throw eggs at me for cheating. Post your sprite count when the demo starts lagging. http://www.emaggame.com/(top left button)
|
|
|
|
Markus_Persson
JGO Kernel      Posts: 2092 Medals: 10
Mojang Specifications
|
 |
«
Reply #1 on:
2009-02-01 12:10:03 » |
|
Boo!
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5862 Medals: 255
Hand over your head.
|
 |
«
Reply #2 on:
2009-02-01 12:48:41 » |
|
I let it run up to 205k, and it didn't show any performance degradation.
But... when I closed the browser tab, it totally crashed the browser... man, I hate the plugin.
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
Games published by our own members! Go get 'em!
|
|
pjt33
JGO Strike Force    Posts: 913 Medals: 17
|
 |
«
Reply #3 on:
2009-02-01 14:12:39 » |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| timinginfo 138 ms, ready at 11.34 loading: textures textures.txt [kdk.textures.n] timinginfo 11545 ms, ready at 11.55 simpleinit() [kdk.aa] java.lang.ClassCastException: sun.awt.image.DataBufferNative cannot be cast to java.awt.image.DataBufferInt at kdk.bx.n(kAi:404) at kdk.bq.c(kAi:22) at kdk.bq.<init>(kAi:65) at kdk.ak.b(kAi:47) at kdk.dope.m.setSize(kAi:876) at kdk.dope.m.<init>(kAi:120) at kdk.dope.m.<init>(kAi:133) at kdk.dope.j.<init>(kAi:23) at kdk.aa.a(kAi:432) at kdk.bf.start(kAi:184) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) |
So I think that's 0. Additionally I had to kill the browser because it wasn't responding.
|
|
|
|
|
Bonbon-Chan
Sr. Member   Posts: 417 Medals: 14
|
 |
«
Reply #4 on:
2009-02-01 15:22:16 » |
|
Windows Vista QuaCore Q6600 (2,4Ghz) NVidia 8800GT, Java 1.6.0_07-b06 Getting bored after 100 000  But the applet version didn't work at all... nothing in the consol... juste de java sun logo.
|
|
|
|
|
Hansdampf
Sr. Member   Posts: 412 Medals: 2
too offending?
|
 |
«
Reply #5 on:
2009-02-01 15:37:07 » |
|
Very strange... maybe the applet issues have something to do with parameters (-Djnlp.packEnabled=true) I pass there, or with some threads I spawn for parallel processing. I will remove both tomorrow. I know even less about that java.lang.ClassCastException: sun.awt.image.DataBufferNative cannot be cast to java.awt.image.DataBufferInt Exception. Is that Linux running some kind of open Java? Mrs Google could not help me.
|
|
|
|
Bonbon-Chan
Sr. Member   Posts: 417 Medals: 14
|
 |
«
Reply #6 on:
2009-02-02 04:11:40 » |
|
You should put a FPS counter, it will be better to define when it's beging to slow down.
Windows XP, Celeron 2,4GHz, Intel 82865G, Java 1.6.0_07-b06 : - no problem with the applet - around 50 000, it seems to slow down a bit
|
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5862 Medals: 255
Hand over your head.
|
 |
«
Reply #7 on:
2009-02-02 04:13:12 » |
|
It never seems to slowdown.
Must be a nice cheat.
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
princec
« League of Dukes » JGO Kernel      Posts: 8069 Medals: 91
Eh? Who? What? ... Me?
|
 |
«
Reply #8 on:
2009-02-02 04:18:58 » |
|
Hm doesn't actually look like 10,000 sprites to me... Cas 
|
|
|
|
erikd
JGO Kernel      Posts: 2561 Medals: 7
Maximumisness
|
 |
«
Reply #9 on:
2009-02-02 04:21:19 » |
|
I think the cheat is that it's just 5 sprites with about 3 backbuffers that are never cleared.
|
|
|
|
Games published by our own members! Go get 'em!
|
|
Hansdampf
Sr. Member   Posts: 412 Medals: 2
too offending?
|
 |
«
Reply #10 on:
2009-02-02 04:23:12 » |
|
yes, looks more like 1 billion sprites if you let it run for a week. here is the pseudocode: (slightly changed, I use rasters of BufferedImages and blit via loops) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| Image pic; Image[] buf; int width=800,height=600; int count = 0;
public void init() { buf = new Image[10]; for (int i = 0; i < buf.length; i++) { buf[i] = new Image(width,height); } pic = somePicture(); }
public void render() { count++; getGraphics().drawImage(buf[count % buf.length],0,0,null); for (int i = 0; i < buf.length; i++) { float frak = (float) i / buf.length; float time = (count + frak) / (20f); int w=width/2; int h=height/2; int x=w+(int)(w/2*Math.sin(time)); int y=h+(int)(h/2*Math.sin(time*2.1)); buf[i].getGraphics().drawImage(pic, x, y, null); } } |
|
|
|
|
Hansdampf
Sr. Member   Posts: 412 Medals: 2
too offending?
|
 |
«
Reply #11 on:
2009-02-02 04:36:43 » |
|
You should put a FPS counter, it will be better to define when it's beging to slow down.
Windows XP, Celeron 2,4GHz, Intel 82865G, Java 1.6.0_07-b06 : - no problem with the applet - around 50 000, it seems to slow down a bit
Funny that the applet works now, I did NO update yet. Java is great. 
|
|
|
|
Markus_Persson
JGO Kernel      Posts: 2092 Medals: 10
Mojang Specifications
|
 |
«
Reply #12 on:
2009-02-02 04:54:34 » |
|
Yeah, it's an old trick. I'm a bit amazed people fall for it.  * Markus_Persson does some palette shifting tricks
|
|
|
|
Hansdampf
Sr. Member   Posts: 412 Medals: 2
too offending?
|
 |
«
Reply #13 on:
2009-02-02 04:57:33 » |
|
Yes, I expected more eggs and boo's 
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5862 Medals: 255
Hand over your head.
|
 |
«
Reply #14 on:
2009-02-02 05:25:27 » |
|
getGraphics().drawImage(buf[count % buf.length],0,0,null);
Please call graphics.dispose() ! You're leaking native resources.
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
Hansdampf
Sr. Member   Posts: 412 Medals: 2
too offending?
|
 |
«
Reply #15 on:
2009-02-02 05:31:24 » |
|
getGraphics().drawImage(buf[count % buf.length],0,0,null);
Please call graphics.dispose() ! You're leaking native resources.
don't worry, that was meant as pseudocode. And there is the main function missing. And 42 more things.
|
|
|
|
Markus_Persson
JGO Kernel      Posts: 2092 Medals: 10
Mojang Specifications
|
 |
«
Reply #16 on:
2009-02-02 05:36:29 » |
|
You're leaking native resources. Well, not leaking.. When a Java program runs, a large number of Graphics objects can be created within a short time frame. Although the finalization process of the garbage collector also disposes of the same system resources, it is preferable to manually free the associated resources by calling this method rather than to rely on a finalization process which may not run to completion for a long period of time.
|
|
|
|
Bonbon-Chan
Sr. Member   Posts: 417 Medals: 14
|
 |
«
Reply #17 on:
2009-02-02 06:03:24 » |
|
Funny that the applet works now, I did NO update yet. Java is great.  Not the same PC, not the same OS 
|
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5862 Medals: 255
Hand over your head.
|
 |
«
Reply #18 on:
2009-02-02 06:09:52 » |
|
Well, not leaking..
Hmm... good to know, although in theory, you could run out of native resources before the GC is executed, as it doesn't grow the heap - but chances are slim.
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
Markus_Persson
JGO Kernel      Posts: 2092 Medals: 10
Mojang Specifications
|
 |
«
Reply #19 on:
2009-02-02 08:23:38 » |
|
Yeah, and it'll probably allocate more ram than needed if you don't dispose() as it has to wait for the gc.
|
|
|
|
h3ckboy
JGO Kernel      Posts: 1644 Medals: 4
|
 |
«
Reply #20 on:
2009-02-02 09:00:04 » |
|
it jsut said something like game over over and over. and then IE freezes
|
|
|
|
|
Hansdampf
Sr. Member   Posts: 412 Medals: 2
too offending?
|
 |
«
Reply #21 on:
2009-02-02 09:50:06 » |
|
it jsut said something like game over over and over. and then IE freezes
wsa tath a g4me or teh 10.000 thign? 4nyway, I upd4ed ti nwo. I hope the applet problems came from usage of java.util.concurrent.ExecutorService, which I dropped now.
|
|
|
|
pjt33
JGO Strike Force    Posts: 913 Medals: 17
|
 |
«
Reply #22 on:
2009-02-02 13:51:01 » |
|
Very strange... maybe the applet issues have something to do with parameters (-Djnlp.packEnabled=true) I pass there, or with some threads I spawn for parallel processing. I will remove both tomorrow. I know even less about that Exception. Is that Linux running some kind of open Java? Mrs Google could not help me.
Linux running Sun Java 1.6-u10-beta.
|
|
|
|
|
Hansdampf
Sr. Member   Posts: 412 Medals: 2
too offending?
|
 |
«
Reply #23 on:
2009-02-02 14:07:35 » |
|
Linux running Sun Java 1.6-u10-beta.
I think it works now, EgonOlsen had the same Exception. I think/guess/hope it works now.
|
|
|
|
pjt33
JGO Strike Force    Posts: 913 Medals: 17
|
 |
«
Reply #24 on:
2009-02-03 04:44:02 » |
|
I think it works now, EgonOlsen had the same Exception. I think/guess/hope it works now.
I was able to run it from appletviewer. After last time I didn't want to risk running it in the browser.
|
|
|
|
|
|