Sign in to follow this  
ShauwnBlue

Is an Applet the best (or only) way to make graphical games in Java?

Recommended Posts

In all the Java game creation tutorials I see, an applet is used. How hard is it to create a 2D graphical game as an application? Is it really that much harder? Thanks for any help.

Share this post


Link to post
Share on other sites
There is no difference in how hard it is. As far as I can remember (haven't really touched applets since one class on them nearly 2 years ago now) you use the exact same 2D graphics library in Applications as applets. The biggest difference is simply how you setup your window.

Also I'm not sure if there are any OpenGL bindings that work with Applets, but they work on Applications.

Share this post


Link to post
Share on other sites
Applets are normally used as examples with Java so that they can have a functional example embedded onto a webpage. Apart from setting things up slightly different things mostly work the same and it isn't really more difficult to create an application; find an example of how to get a window up and redraw correctly and you should be able to simply transplant the majority of examples into your application with little or no changes.

Share this post


Link to post
Share on other sites
Java has two graphic APIs. AWT and Swing.

AWT is the legacy system which relied heavily on native controls for implementation. This turned out to be a somewhat bad idea.

So Swing was developed. Swing is a completely Java based solution.

Swing is built on top of AWT, and uses AWT as a its foundation.

Despite existance of Swing, many preferred to use as little of it as possible. As such, Applets are the minimum you need to use. I also believe that Swing was never available for MS Java VM, so for compatibility reasons, applets made the best choice.

From implementation perspective, almost all functionality can be transparently transferred between Applets, local applications and WebStart. The only difference is in how you launch them.

Ideally, rathere than overriding the Applet's methods, your game should be an by itself (overriding JComponent), abstracting all other inputs and outputs (keyboard, menus, settings). Then it's just a matter of putting it into appropriate container to run it.

Share this post


Link to post
Share on other sites
Now I don't want to be negative, but if you are intending to build a 2d game for websites, I wouldn't build it using Java, but with Flash. Just something to consider, since ActionScript matured quite a bit since it's initial version.

Maybe read this:

Java vs Flash

excerpt:

"April 2006: Java is losing the battle of the browser plug-in technologies with about 57% penetration. The Flash Player is ubiquitous with nearly 96% of users being able to view Flash content."


(Only applies if you want to make a game which people can play in a browser)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this