Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by nolan, posted on May 01, 2001

Image Description, by nolan

This is a shot of a java applet game I wrote a couple of years back. It evolved from an even older (1997 or so) wireframe pong applet. It uses AWT to draw the actual polygons, to get decent performance. On modern machines with modern JIT compilers, even if you get multiple "multi-ball" powerups, gameplay is still fluid (Multi-ball causes each ball on screen to explode into 8 seperate balls). The code is pretty ugly; to prevent stuttering caused by the garbage collector, I had to structure the engine and game so that no objects are created or destroyed during play. Hidden surface removal is hard coded. The sides and front of bricks are not drawn if they would be blocked by an adjacent brick.

Click here to play.

It features a server side high score list (which gets 'hacked' periodically by dorks decompiling the applet =). The current high score was from an actual game though.

I haven't done any Java development in years, but it was (and still is) a fun way to get back to the good old days of slow CPUs and no 3d acceleration.

First person to complain that the shot is 'too dark' gets a beatdown.


Image of the Day Gallery


Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

May 01, 2001, 12:37 PM

The shot isn't too dark, but what's up with the lame textures!!

:) Just kidding. That's pretty cool for a java app.


May 01, 2001, 12:57 PM

Great stuff! Was fun to play ;) Thanks for sharing that.



May 01, 2001, 01:32 PM

Wow! That was fun! Well done. I was very pleased by the interface. Quite nice.


May 01, 2001, 01:36 PM

Looks nice. Java Applet games have always been a special interest for me. I'm going to try it tomarrow when my Boss is gone... :-)

Luke Hodorowicz

May 01, 2001, 01:37 PM

Heh, great time waster - I played it for like an hour instead of studying for my final exams...

Quality work. Lots of fun to play.



May 01, 2001, 01:56 PM

Multiball and Padle++ rule!!!

BTW, Your engine is pretty decent. At one point, I had a multiball, then a dual ball, and then another multiball which comes to... let's see... 128 balls?!?! That can't be right... well, anyway, it was alot of freakin' balls and it stayed fast.


May 01, 2001, 02:22 PM

Cool game for java!
I've not much experience in web-based stuff, but could it be possible to post this in a forum like those DO NOT ENTER HERE threads with DIV tags? Just wondering


May 01, 2001, 03:06 PM

The most I ever tried while testing was multiball twice and dual ball twice (256 balls on screen). Each ball is 7 polygons (back face removal is hard coded, as is all view dependent visibility. Block's sides/fronts are only drawn when they aren't hidden by adjacent blocks, and only when the viewpoint is such that they could possibly be visible. Painter's algo style visibility is also hard coded. Its hacktasic!) Framerate was still interactive.

The code calls AWT's fillPolygon, which in turn calls the window system's polygon filler, which presumably is hardware accelerated (at the very least, its optimized native code). Trying to rasterize the polygons in java code would be at least an order of magnitude slower.

So basically only the simulation and transformation code is really Java. (and the transformation code is pretty tweaked, it only rotates around the X axis).

The engine was originally written in early 1997 on a p90 for a wireframe PONG applet. This was before JIT compilers were common.


May 01, 2001, 03:06 PM

It rocks! (74th:-)


May 01, 2001, 03:11 PM

When I first publically released that game (via a '.flame' internal school newsgroup), it was exam time 1999 (when I was still in college). The high score list is a pretty good indicator of who failed their exams that year.


May 01, 2001, 03:13 PM

Yet another example of how you don't need great graphics to have a great game...good job!


May 01, 2001, 03:25 PM

I really enjoyed that. I've never programmed in Java before, but I think I'm going to try making a little game (nothing even close to the one you made) with some of my free time now. Keep up the good work!


May 01, 2001, 03:25 PM

Cor. Takes me back to writing one in Basic on an Archimedes, many years ago - I even had blocks that change colour instead of dissapearing :p

Mine was only 2D though, and my evil streak shows through in the block which explodes into lots of other blocks, instead of a multi ball :o)

I think I had gravity in there too - instead of a ceiling - made it different - may have to dig it out sometime.


May 01, 2001, 03:27 PM

I totally agree with ecko_53 on this one and it's what I've been saying all along. You don't need eye-splitting graphics to make a good game. You just need a good idea (and breakout is certainly a time-proven classic). From my experience, the games that most people find to be most fun are extremely simple. One up-and-coming game that holds great promise is a game called "Operation Flashpoint" from Bohemia Interactive. It doesn't have the most amazing engine ever seen, it doesn't incorporate the most advanced visual effects, but it's extremely fun to play and I, for one, love it.

So all of this goes to sayind, kudos for a great, simple game! Keep it up!

Jason Kozak

May 01, 2001, 03:43 PM

Best combo ever:
2xMultiball + DualBall + Through

I've never seen a level clear so fast :)


May 01, 2001, 04:12 PM

Incidentally, that's the key to high scores. Your end-of-level bonus is based primarily on how many balls were in play when the last brick breaks.


May 01, 2001, 08:36 PM

That Christian coders site is funky, I mean it's such I weird combination. Whose idea was it exactly?

Alex Taylor

May 01, 2001, 08:39 PM

When I first ran it, I thought gee this is slow. I couldn't understand everone saying it was so smooth. I have a two monitor set-up. One screen runs off a GeForce. The second (the one where the applet was running) is a 4Mb Matrox Mystique. Both run at 1152x864x32. Moving it onto the GeForce, I suddenly experienced the smooth gameplay everone was talking about.

Thanks, that's a pretty cool applet (just don't run it on a slow video card ;-) ).


May 01, 2001, 09:19 PM

Great game, but I'd rather have my life back now... :)

Anyway, I recommend that anybody who hasn't checked out do so. I've been watching it for awhile, maybe a month or two, and it's pretty cool...

Punchy, was it just my comp. (actually I was playing on somebody else's the only time I've played it) or was Operation Flashpoint excessively dark? It kind of ruined it when there was only two noticable colors on the screen: black and a dark grey that must have been supposed to have been at one point in time black...


May 01, 2001, 09:56 PM

Interesting.. Was this on Linux or Windows?

Perhaps your matrox driver doesn't support an accelerated filled polygon primitive, or your OS can't do that particular hardware operation on the second head.

I'm pretty sure the Mystique can do hardware accelerated single color filled polygons.


May 01, 2001, 11:16 PM

cool, that was indeed fun. And as by magic Aphex Twin-"Hot Butter Popcurn" started to play through winamp.
Nice coding.


May 02, 2001, 12:31 AM

Wait it's too dark...oh wait that's my monitor :) *LOL* I just had to do it!

Alex Taylor

May 02, 2001, 01:07 AM

It's a win2k system. Although I don't know much about the internals of java, and even less about it's graphics pipeline. I would assume that the rasterisation of polygons would be handled by the JVM itself. The buffer generated by that would then be sent through to the JVM client (Internet Explorer in this case), which would then do the copy to the screen. Running at this resolution though, the 4Meg card has used around 3.8Mb. This leaves little room for offscreen buffers in video memory, instead forcing the work to be done in main memory. I'd imagine I could get it running a lot better if I shrunk the second screen down a few sizes.


May 02, 2001, 01:44 AM

Great job. The garbage collection idea is cool. Do you just make sure everything remains refrenced so the gc doesnt grab it? I spent about 45 minutes playing. 12th.



May 02, 2001, 02:20 AM

AWT just calls the native Filled Polygon routine (on X11, its called XFillPolygon) which will use the hardware to do the actual drawing on any reasonable recent card.

No extra memory is required for this operation, since 2d windowing systems like X11 and win32 draw directly into the front buffer.


May 02, 2001, 02:24 AM

Yeah, I preallocate everything needed for gameplay at startup, and I make sure that I never lose any references. Recycling allocated memory is key.

Its quite amusing that Sun keeps pitching java for embedded realtime tasks. Just goes to show you that marketing _is_ reality these days.


May 02, 2001, 04:57 AM

The game doesn't look very special on the screenshot,
but was one of the coolest Arkanoid-clones I've ever played!
Kudos to you!

and about the ChristianCoders site - what a fucked up world this must be if coders start getting religious... haven't you learned anything while coding..?
Muhahahahaha :)


May 02, 2001, 05:27 AM

Very nice game and fast for a Java App.
But...I'm in hurry, must play the stuff.... ;-)



May 02, 2001, 08:39 AM

I understand that you haven't worked on this in a while, but I was wondering if you could tell me a little about how you did your collisions? I have been writing a clone of a clone here of late, and am doing too much fancy physics collision stuff (that doesn't work too well).

Can you offer any suggestions?

Thanks in advance!

Dean Harding

May 02, 2001, 08:53 AM

That game stole hours of my life, and I want it back!

Very cool!!

This thread contains 43 messages.
First Previous ( To view more messages, select a page: 0 1 ... out of 1) Next Last
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.