|There's more than one way to do things|
2-browser interactive (2D) tankbattle game written in perlby hackmare (Pilgrim)
|on Feb 09, 2002 at 23:15 UTC||Need Help??|
100% served in perl.
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
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:
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.