Puppytron!

Hmm… I just saw it on a machine which is about 6 times faster than mine (it gets 13-18k fps in TinyRivers)… and it stuttered alot :-/

Since the machine made that odd “tons of tiny textures uploading HF noise” all the time I guess it ran in non accelerated mode.

So… did you that copy it over thing, which you need to do for 1.4.x if you want a managed image?

Like:

GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
GraphicsConfiguration gc = device.getDefaultConfiguration();
[...]
private BufferedImage loadImage(String path, int transparency) throws IOException
{
      BufferedImage i = ImageIO.read(new BufferedInputStream(getClass().getResourceAsStream(path)));
      Graphics2D tg;
      BufferedImage c = gc.createCompatibleImage(i.getWidth(null),i.getHeight(null),transparency);
      tg = (Graphics2D)c.getGraphics();
      tg.setComposite(AlphaComposite.Src);
      tg.drawImage(i,0,0,null);
      tg.dispose();
      return c;
}

“transparency” is either Transparency.OPAQUE, Transparency.BITMASKED or Transparency.TRANSLUCENT (bad one).

With 1.5 you get managed images by default, which would explain the performance differences. [I don’t really believe it’s a GC thingy]

[quote]Hmm… I just saw it on a machine which is about 6 times faster than mine (it gets 13-18k fps in TinyRivers)… and it stuttered alot :-/
[/quote]
Was this machine running Linux by any chance? When I tested Puppytron on Linux, I noticed that the drawRect() calls were not hardware accelerated, and were seriously slowing things down. As soon as a bad guy finished warping in, the game would get really fast. Then as soon as another warp effect started, the game would slow down again. Go figure.

Nah… it’s a win2k machine (me should have said that). But most 1.4.x users (all?) have that problem.

The warp rects were alpha blended originally but not any more. Now the only alpha blending going on is when I fade the points you get for killing a robot, and I might even turn that off too.

And as for sound… seems buggered everywhere. I might just use LWJGL.

Hm.

Maybe I should just make it LWJGL anyway? Then I could run it at 60fps reliably on just about anything…

Cas :slight_smile:

Meh… Shinji is a monster :stuck_out_tongue:

Just thought… great score… n… f*** 3rd place. Tomorrow his nick has filled the whole list with a top score of 1000000+ (if he continues like this).

[quote]The warp rects were alpha blended originally but not any more. Now the only alpha blending going on is when I fade the points you get for killing a robot, and I might even turn that off too.
[/quote]
Ah. That explains it. :slight_smile:

[quote]And as for sound… seems buggered everywhere. I might just use LWJGL.
[/quote]
It seems to work fine on all of the machines I’ve tested. What problems are you seeing?

[quote]Maybe I should just make it LWJGL anyway? Then I could run it at 60fps reliably on just about anything…
[/quote]
coughfeature creepcough Besides, why would you want to miss out on the joys of Java2D coding? :wink:

One other consideration is that LWJGL would significantly increase the size of the download.

Oh, well thanks Cas.

Applet’s back, but doesn’t seem to work in Opera. Sod it. Applets suck.

LWJGL would only add 200kb to the game which is only half a meg anyway, double the framerate, and give me decent sound, proper alpha blended effects, etc., etc… come to think of it this is why we made the bloody thing in the first place, to get past all these stupid Java flaws :confused:

Cas :slight_smile:

[quote]Applet’s back, but doesn’t seem to work in Opera.
[/quote]
Are you sure it’s not your copy of Opera? It worked on Windows’ Opera when I tested it there, and it loaded on Opera for Mac just now. (Unfortunately, Opera 4 Mac uses the Java 1.3 plugin on 10.2. Eww.)

[quote]Sod it. Applets suck.
[/quote]
Well, I agree with you there. However, I do think you’re on the right track. Having Applets on your homepage makes it more interesting to visitors, and encourages them to come back.

[quote]LWJGL would only add 200kb to the game which is only half a meg anyway,
[/quote]
Which would suck for those on dial-up. Half a meg takes about a minute and a half to download on a speedy modem connection.

[quote]double the framerate, and give me decent sound, proper alpha blended effects, etc., etc… come to think of it this is why we made the bloody thing in the first place, to get past all these stupid Java flaws :confused:
[/quote]
Oh boo, hoo. Applet game designers have been working around these problems for a long time. Just stop thinking like you’re coding a GL app, and you’ll be just fine. :slight_smile:

From the exception it seems like ImageIO don’t work with Opera. Easy to fix. Load the images with awt. Why don’t you just make it 1.1 compatible?

Well, there’s actually an interesting dynamic to the whole applet thing. I have, guess what… an ulterior motive!

Why don’t I write for 1.1? Well, we have to look at why I’m bothering to write these applets in the first place. There is a certain element of “I like writing games! It’s fun!” going on, for sure, as well as a bit of “Look how cool we are!”. But mostly it’s because I want quality traffic to Puppygames.net. By “quality” what we’re talking about is surfers who might pay for something. I don’t want to be just another website full of shite applets supported by advertising. That market is nicely taken care of already by many, many sites.

So firstly the new applets are 1.4 compatible only, apart from Puppy Invaders. That filters out quite a lot of people running MSVM, which is fine because it’s irritatingly restrictive over what you can and can’t do.

Secondly, if I start using OpenGL, this filters out all the people who can’t run our full games anyway, so hopefully they won’t waste our bandwidth downloading them either. Bearing in mind that we’re shifting our attention to MacOS X.

Thirdly, using LWJGL, our applets will rock :slight_smile:

I really don’t like applets myself. I don’t enjoy coding them much because of the stupid restrictions and I sure as hell hate pages that spring them up on me as 90% of the time they don’t even run. (Usually Invalid Bytecode, ClassNotFound, or grey rectangle syndrome).

Cas :slight_smile:

Actually I was just thinking about this (grey rectangle syndrome) the other day. Both in cases where the applet refuses to work altogether, and in cases where the applet is big enough that it takes seemingly forever (IE longer than about 10 seconds !) to download. Pop up any flash or shockwave game worth its salt and you immediately get a funky download progress bar. I don’t know that much about flash, but these are normally coded by the author of the game, preloaded, and then updated as the rest of the game loads in the background. I’ve yet to see any good implementation of this for applets which is another bar to actually taking them seriously for web game work. That said, this is just idle complaining because I’ve never -tried- to do anything of the sort myself either. I wouldn’t imagine it’d be too complicated though. But then of course there’s the other pile of complications mentioned above :slight_smile:

D.

[quote]Pop up any flash or shockwave game worth its salt and you immediately get a funky download progress bar.
[/quote]
Just add progressbar =“true” to the applet tag. It should give you a nice progress bar showing the applet loading. To make it even more interesting, you can use the image=“myimage.png” attribute to display an image while you’re waiting for the applet to load. You can even use an animated GIF! ;D

The problem is that Applet authors are still thinking along the lines of writing 1.1 Applets. 1.4 and 1.5 applets are way cooler and have lots more features that make them competitive with Flash animations.

That being said, I still hate Applets. But then I hate Flash just as much. The only web technology I don’t hate is properly coded DHTML. (Improperly coded DHTML makes a friggin’ mess that won’t work in any browser except the exact copy on the machine it was developed on.)

I stand corrected ! Is this just for the 1.4 plugins ? the last time i did any applet work was part of a network management system for a big tele company. Despite the ATM switches selling for 100’s of thousands of dollars and the NMS system selling for a comparable sum, we weren’t allowed dictate which browser the thin client would run on, or what version of plugin (if the clients even HAD a plugin) had to be installed on the client machines. As you can imagine this lead to some interesting* scenarios.

*by interesting i of course mean absolutely goddamn frustrating and tear-your-hair-out irritating …

D.

[quote]Why don’t I write for 1.1? Well, we have to look at why I’m bothering to write these applets in the first place. There is a certain element of “I like writing games! It’s fun!” going on, for sure, as well as a bit of “Look how cool we are!”.
[/quote]
I can’t force you to like making 1.1 games. But I don’t see anything in the applet that you can’t do in 1.1, so I don’t think it is such a huge differance. Maybe you’ve got a personal grudge against 1.1, but how is it cool not to support it?

[quote]But mostly it’s because I want quality traffic to Puppygames.net. By “quality” what we’re talking about is surfers who might pay for something. I don’t want to be just another website full of shite applets supported by advertising. That market is nicely taken care of already by many, many sites.

So firstly the new applets are 1.4 compatible only, apart from Puppy Invaders. That filters out quite a lot of people running MSVM, which is fine because it’s irritatingly restrictive over what you can and can’t do.
[/quote]
I think you’ve mentioned that you did the applets to attract trafic. If more people are able to run the games, then you attract more traffic. And it’s not like they can’t play your real game even though they got MSVM. You provide native installers for both SD and AF.

It is too easy to say that just because they’ve got the msvm, they are cheap, and the scum of the web.

[quote]Secondly, if I start using OpenGL, this filters out all the people who can’t run our full games anyway, so hopefully they won’t waste our bandwidth downloading them either. Bearing in mind that we’re shifting our attention to MacOS X.
[/quote]
Then I would agree that you have got a legitimate reason to require 1.4.

[quote]I really don’t like applets myself. I don’t enjoy coding them much because of the stupid restrictions and I sure as hell hate pages that spring them up on me as 90% of the time they don’t even run. (Usually Invalid Bytecode, ClassNotFound, or grey rectangle syndrome).
[/quote]
I like applets if they are 1.1. Made a couple of applet games a couple of years ago, and I thought is was fun. Ofcourse not as fun as LWJGL :slight_smile:

[quote]I don’t know that much about flash, but these are normally coded by the author of the game, preloaded, and then updated as the rest of the game loads in the background. I’ve yet to see any good implementation of this for applets which is another bar to actually taking them seriously for web game work.
[/quote]
I’ve seen lots of applets that load their resources after the applet is started. Some might even load the classes, unless it violates the applets security. The problem with it is that the resources is downloaded every time. But the resources can be cached by the browser if it is part of the applet.

I do stuff with Preferences, and BufferStrategy, and I also rely on certain performance aspects of 1.4. There are various other little gotchas too, and it’s such a pain in the arse it makes me wonder why I bother with Java sometimes.

Cas :slight_smile:

Howabout the fact that 1.1 implementations of the core classes have literally thousands of bugs that are fixed in 1.4 onwards?

You have to workaround crap that you really shouldn’t need to deal with, a lot of bugs are critical, necessitating significant effort to workaround. This is the main reason I don’t like 1.1-compatibility - it wastes my time as a programmer. Especially since you cannot use Swing, and the AWT rendering system is F. U. B. A. R.

The other major gripe I have is that image management is considerably poorer prior to 1.4. It’s no surprise that Cas is using BufferStrategy - the basic code is considerably easier to maintain and more intuitive using the 1.4 rendering systems than the 1.1 ones.

However, I agree that applet loading is not a problem if you are the author and do it properly. As a user, it’s terrible. I shall never understand why Sun were foolish enough not to make the progressbar on by default, and why it wasn’t included in 1.1.0. I can think of excuses, but they are vastly outweighed by the positive benefits. I speak from painful experiences of having supported applets before.

What’s wrong?

I just get a big grey rectangle.

Um…OK. What happened?

Nothing.

Oh, yeah - that’s because the applet gives you zero feedback unless you:

  • have a status bar
  • read it at the correct moment in time (messages disappear quickly)

and of course it doesn’t tell you what failed, how far through init it got, etc. All in all it’s crap. Persuading every user to enable java console slowly made life bearable, but it necessitates RESTARTING THE ENTIRE BROWSER, which throws up whole new problems :frowning: :(.

[quote]Well, there’s actually an interesting dynamic to the whole applet thing. I have, guess what… an ulterior motive!

Why don’t I write for 1.1? Well, we have to look at why I’m bothering to write these applets in the first place. There is a certain element of “I like writing games! It’s fun!” going on, for sure, as well as a bit of “Look how cool we are!”. But mostly it’s because I want quality traffic to Puppygames.net. By “quality” what we’re talking about is surfers who might pay for something. I don’t want to be just another website full of shite applets supported by advertising. That market is nicely taken care of already by many, many sites.
[/quote]
If I understand correctly, I’m right with you. You’re saying it’s inefficient for you to bother with people who have 1.1 because they are automatically extremely unlikely to be members of your target market. The conversion rate for people who already have 1.4 might be 2% compared to a conversion rate of people who initially had 1.1 being 0.1%, and only counting those that upgraded the JVM.

But…you have a great opportunity here. Put in a 10 line class-file switcher that references a different start method depending upon the JVM version, and the start method for < 1.4 JVM’s is just a big red flashing message:

YOUR COMPUTER IS POSSESSED BY A VIRUS CALLED MS JVM

CLICK here TO INSTALL THE LATEST VERSION OF JAVA, WHICH WILL CURE YOUR COMPUTER, AND ALLOW YOU TO PLAY THIS GAME AND ALSO ALL THOSE AT http://javagamesfactory.org

IT HAS A BUILT-IN UPDATER SO IT WILL AUTOMATICALLY FIX ANY FUTURE BUGS AND SECURITY HOLES FOR YOU

…or something like that. That one’s just my personal message of choice :stuck_out_tongue: ;D. Can’t hurt, could do a lot of good…

I very much like the philosophy of: the more good games we write in 1.4.2+ Java, the more people will have to update to play them :slight_smile:

Let’s keep giving them reasons to update

I am indeed doing a launcher but I confess it’s a lower priority as there’s an even higher primary force at work here, which is my shift in focus to OSX, where we already have very high 1.4 penetration and OpenGL support out-of-the-box.

I’m currently rewriting Puppytron to use LWJGL. Might have it up by the evening.

Cas :slight_smile: