Posting your Game on the Web

To post your game on the web so that others can play it within a web page, you must package it properly and create a web page that includes the proper HTML tag to inform the browser how to run your program. These steps are described in detail below.

Packaging your game

To package all of the code that makes up your game into a single file, your will need to save your project as a Java ARchive, JAR, file.

  1. From Eclipse, export your project (select File->Export->JAR file).
  2. After clicking Next and selecting the project to export, put checks by the boxes for
  3. Choose where to where to save your archive by clicking on Browse next to the box labelled JAR file. The convention is to name the JAR file your_game.jar where you replace your_game with your actual game name.
  4. When it becomes active, click on Next. On this page, make sure you have selected
  5. Click on Finish to actually create the JAR file.

Posting Your Game as an Applet

To run your game within a web page, you will need to include the following tag within your page:

<applet
   code="your_game/YourGame"
archive="your_game.jar,fang.jar" width=410 height=465> </applet>

Where your_game is replaced with the name of the package in which you wrote your game, YourGame is replaced with the name of the class which extends GameLoop, and your_game.jar is the JAR file made using the instructions above.

Finally, when you copy your web page to your course web folder on acpub, make sure to copy both the JAR file you made for your game and the file fang.jar as well.