http://qs1969.pair.com?node_id=144413

100% served in perl.

Warning, it is rendered in SVG and requires javascript & uses frames. NS and IE do fine with it on windows. Not sure if it works on NS6.X, or Mac OS.

What it is:

It's a nettrek-inspired prototype of a 2-player game (a currently non-shooting version of tank battle) that demonstrates browser-browser interaction without special software (I am using SVG but this could be dhtml too).

How you play...

Two people on 2 PCs can play this game: Each person goes to the game starting page, and one person starts player 1, sends the passkey to player 2, and waits for player 2 to start.

Player 2 starts. Uses the key passed on to register into the game session, and gets going. (caution: There is no error-catching for typos on the keys right now)

The game: click here

The concept:

Each invocation of the game writes a set of lockfiles (1 per browser,hence the passkey) on the server, which stores the last command uttered by either side through a cgi-based GUI (the think that kind of looks like a tank on the top-left window).

When client browser is launched, a single frameset is generated showing the tanks. The frameset contains two frames:

  1. the visible SVG-rendered game
  2. a hidden frame containing some control javascript.

The hidden frame refreshes every 30 seconds, and is a perl-driven cgi which reads the content of each lock file and transmits the commands back to the frameset. The visible frame has access capability to the hidden frame and reads the changed values, giving changes in motion of the vehcles and their gun turrets.

The source code is available here (zipped format).

As I said above, this is a prototype. Please don't forget that :)

A single person can test this by themeselves by first taking the role of player 1 and initiating a session, and then taking the role of player 2 and joining the game. NB: The player-2 control window opens exactly above the payer 1 control window.

hackmare.

  • Comment on 2-browser interactive (2D) tankbattle game written in perl

Replies are listed 'Best First'.
Re: 2-browser interactive (2D) tankbattle game written in perl
by cmilfo (Hermit) on Feb 11, 2002 at 06:37 UTC
    Excellent! It reminds me of the old Atari game (name escapes me now). Next add some walls, etc. or maybe airplanes and clouds. :-)

    I am excited to see some SVG development going on. I've been using Scalable Vector Graphics for about four months now. It's a lot of fun. Have an open standard is nice, and it's even nicer that SVG is XML based. We use it to display wave approximations in our math research. The coolest thing is to right click, view SVG source, and there are all the data points!

    These guys have *excellent* examples.

    Casey

      If anyone is interested, I am presenting a paper on this at the SVG:Open converence in Zurich in July, and holding a workshop on SVG-Browse-Database interaction.

      If I can find the time, I'll also present something at YAPC::Europe

      Andreas Newmann from carto.net is putting the SVG conference together.

      hackmare.

Re: 2-browser interactive (2D) tankbattle game written in perl
by kwoff (Friar) on Feb 10, 2002 at 11:36 UTC
    Cool. I didn't know about SVG. The roasp site seems to have some nice tutorials, though.