simple shooter game

[quote]http://www.wayrad.com/paulb/minigame1/

ok i recompiled it for the sun jvm. should work fine with any browser/jvm. I did notice pretty bad garbage collection induced framerate hitches in the sun jvm. maybe i’ll fix that one day also…
[/quote]
There’s no applet on that page. Can’t play a game that isn’t there :(.

EDIT: If there’s no APPLET tag on the page, then officially speaking there’s no Applet. This does matter for people who use the “appletviewer.exe” app to load applets. There are some good reasons for this, the most important for me personally being that when I encounter a dodgy applet (happens quite often) that starts hammering my machine, or won’t unload, or hangs with deadlocks etc etc, I can quite appletviewer.

You can’t do that with your web browser. MSIE is reasonably safe; if it crashes, you can restart it with taskmanager etc. But on linux, where Mozilla can (and often will) bring down your entire machine, running random applets in the browser is risky business. I’ve frequently had Mozilla + 1.4.2 steal the sound-device under linux, and had to kill the JAVAVM to get it back (which unfortunately destroys all Mozilla windows).

[quote] I wasnt aware of a way to start an applet without using javascript.
[/quote]
Oh. I see now.


<applet code="blah.class" width="300" height="300">
</applet>

Not too difficult really ;).

Although there’s more options, and it can get a bit different when you start using JAR files. But if you didn’t know how to launch applets, I suspect it’ll be a while before you start worrying about JAR’s.

The applet tag is well-documented by Sun, so you ought to RTFM, but I sympathise with the difficulty of finding miscellaneous bits like applet-tag docs, so have a look at :

http://www.chinalinuxpub.com/doc/oreillybookself/java/javanut/ch15_01.htm

For instance (when talking about Sun’s less-that-easy-to-find/notice docs) I hadn’t noticed any of this (which has some nice guidelines on browser-independent forcing of Java Plug-In, from my skim reading of it):

http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/using_tags.html

…and actually it is perhaps more important than I realised, with the latest developments in the Sun vs MS battles. c.f. the first two questions from the FAQ assocaited with Java PlugIn:

Q: What is Java Plug-in Software?

A: Java Plug-in Software is a software product from Sun Microsystems, Inc., that allows enterprise web managers to direct Java applets and JavaBeansTM components on their intranet web pages to run using Sun’s Java Runtime Environment (JRE). With the 1.4 release of Java Plug-in, it is also allows the conventional APPLET tag to direct Java applets to use Sun’s JRE. This is especially useful in browser, such Internet Explorer 6, that do not support Java.

Q: For whom is Java Plug-in Software intended?

A: Java Plug-in Software is designed for enterprise customers who want to deploy Java 2 SDK, Standard Edition based applets on their intranet web pages, and support Microsoft Windows-, Solaris-, and Linux-based browsers in their enterprise. With the 1.4 release, it is also designed for the consumer who wants to run Java applets on a web page.

(http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/contents.html)

I am doing this… I just use the javascript to start the game. What I dont know is how do I start the applet without calling javascript. Is there some predefined entry point into applets that i need to override? (i.e. void main(String[] args)) If there isn’t then I need to tell the applet to start:


      function begin()
      {
           document.game.begin(400, 350);
      }

...

<APPLET id="game" name="game" code="main.class" archive="game.jar" width="400" height="350" VIEWASTEXT MAYSCRIPT>
</APPLET>

anyway, it doesnt really matter. If someone doesnt want javascript enabled, then they should expect some things to not work. and as far as the appletViewer thing, I had never heard of that before this.

I think its init() or start() on Applet, from the javadoc:

and

Kev

that make sense. thanks for clearing it up for me.

Glad you understand how to do it the normal way now. FYI, appletviewer is part of the standard java distribution from Sun (and has been for many years).

FYI lots of people have scripting disabled. IIRC this is often because people view it as largely useless (although it has legititmate and valuable uses in form-checking for example, in most cases it is nothing more than a slight convenience, or showoff eye-candy), sometimes dangerous (c.f. the damage done by scripted emails in outlook), and often the source of annoying popups (unless you can stand moz or opera, and get the popups auto-killed without having to disable scripts).

Fortunately, these days there are many many fewer sites that don’t work without jscript - I guess this is due to the number of people who have it disabled? I remember that 5 years ago if you disabled jscript as many as one fifth of sites I visited had major problems, and up to about one in twenty were completely unusable (e.g. ABIT used to have a site whose navbar was dynamically generated by script, and so if you had no scripting, you couldn’t navigate the site!)

Yay, gotta love a 66 hi streak >:)

everybody, guess what? ive got 253, and Im hopeless at games!! LOVE YA OBURSLEM FOR THIS GAME!!

Absolute cool game!!! Great explosive effects!!!

This game doesn’t work on the Mac… I think it is because of the really weird concept of using javascript to start it. Where did you get that from? Every tutorial and documentation tidbit I can find says how to use the init and start methods.

Could you perhaps change it to use the traditional startup methods?

hehe, 2nd game, Streak of 1009 :wink:

after 50-100 it gets much ezier, I only died cos the fps had gone to **** :wink: (and the screen was so full of blue shots, I couldn’t see the enemy fire ^_^)

Still broken (see my earlier posts).

I guess this means you still haven’t implemented start() yet? If you have, I suggest you print some info to stdout during init and perhaps I can tell you at what point it stops doing anything (all I get is a grey screen)