Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (580)
games submitted by our members
Games in WIP (500)
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  
  10000 software rendered sprites  (Read 4049 times)
0 Members and 1 Guest are viewing this topic.
Offline Hansdampf

Senior Member


Projects: 3


too offending?


« Posted 2009-02-01 18: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.

 Wink


http://www.emaggame.com/
(top left button)

lots of sillystupid games: http://www.emaggame.com
Offline Markus_Persson

JGO Wizard


Medals: 12
Projects: 19


Mojang Specifications


« Reply #1 - Posted 2009-02-01 18:10:03 »

Boo!

Play Minecraft!
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #2 - Posted 2009-02-01 18: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! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline pjt33
« Reply #3 - Posted 2009-02-01 20: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.
Offline Bonbon-Chan

JGO Coder


Medals: 12



« Reply #4 - Posted 2009-02-01 21:22:16 »

Windows Vista QuaCore Q6600 (2,4Ghz) NVidia 8800GT, Java 1.6.0_07-b06

Getting bored after 100 000  Grin

But the applet version didn't work at all... nothing in the consol... juste de java sun logo.
Offline Hansdampf

Senior Member


Projects: 3


too offending?


« Reply #5 - Posted 2009-02-01 21: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 
Quote
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.

lots of sillystupid games: http://www.emaggame.com
Offline Bonbon-Chan

JGO Coder


Medals: 12



« Reply #6 - Posted 2009-02-02 10: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
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #7 - Posted 2009-02-02 10: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
Offline princec

JGO Kernel


Medals: 282
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #8 - Posted 2009-02-02 10:18:58 »

Hm doesn't actually look like 10,000 sprites to me...

Cas Smiley

Offline erikd

JGO Ninja


Medals: 15
Projects: 4
Exp: 14 years


Maximumisness


« Reply #9 - Posted 2009-02-02 10: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! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Hansdampf

Senior Member


Projects: 3


too offending?


« Reply #10 - Posted 2009-02-02 10: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);        
      }
   }

lots of sillystupid games: http://www.emaggame.com
Offline Hansdampf

Senior Member


Projects: 3


too offending?


« Reply #11 - Posted 2009-02-02 10: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. Cheesy

lots of sillystupid games: http://www.emaggame.com
Offline Markus_Persson

JGO Wizard


Medals: 12
Projects: 19


Mojang Specifications


« Reply #12 - Posted 2009-02-02 10:54:34 »

Yeah, it's an old trick. I'm a bit amazed people fall for it. Wink
* Markus_Persson does some palette shifting tricks

Play Minecraft!
Offline Hansdampf

Senior Member


Projects: 3


too offending?


« Reply #13 - Posted 2009-02-02 10:57:33 »

Yes, I expected more eggs and boo's  Smiley

lots of sillystupid games: http://www.emaggame.com
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #14 - Posted 2009-02-02 11: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
Offline Hansdampf

Senior Member


Projects: 3


too offending?


« Reply #15 - Posted 2009-02-02 11: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.

lots of sillystupid games: http://www.emaggame.com
Offline Markus_Persson

JGO Wizard


Medals: 12
Projects: 19


Mojang Specifications


« Reply #16 - Posted 2009-02-02 11:36:29 »

You're leaking native resources.

Well, not leaking..

Quote from: javadocs
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.

Play Minecraft!
Offline Bonbon-Chan

JGO Coder


Medals: 12



« Reply #17 - Posted 2009-02-02 12:03:24 »

Funny that the applet works now, I did NO update yet. Java is great. Cheesy

Not the same PC, not the same OS  Wink
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #18 - Posted 2009-02-02 12: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
Offline Markus_Persson

JGO Wizard


Medals: 12
Projects: 19


Mojang Specifications


« Reply #19 - Posted 2009-02-02 14: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.

Play Minecraft!
Offline h3ckboy
« Reply #20 - Posted 2009-02-02 15:00:04 »

it jsut said something like game over over and over. and then IE freezes
Offline Hansdampf

Senior Member


Projects: 3


too offending?


« Reply #21 - Posted 2009-02-02 15: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.


lots of sillystupid games: http://www.emaggame.com
Offline pjt33
« Reply #22 - Posted 2009-02-02 19: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.
Offline Hansdampf

Senior Member


Projects: 3


too offending?


« Reply #23 - Posted 2009-02-02 20: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.

lots of sillystupid games: http://www.emaggame.com
Offline pjt33
« Reply #24 - Posted 2009-02-03 10: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.
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 (49 views)
2014-04-15 18:08:23

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

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

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

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

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

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

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

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

CJLetsGame (208 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

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
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!