AppStars

Halfbrick, 2000

The Void: a browser shoot-'em-up with online high scores, in 2000.

The Void was a vertical shoot-'em-up written as a Java applet, so it ran in any web browser with no install. Under the Halfbrick name we offered games like it to website owners to keep visitors on their sites, with prizes based on the scores players posted to an online high-score table.

Owner
Our own game, offered to website owners under the Halfbrick name
Industry
Games; media and brands
Services
Web games, real-time graphics, server-side scoring
Platforms
Java applet (AWT) in the browser; Perl CGI on the web host
Our role
We designed and wrote the game, its levels and art pipeline, and the high-score server.

The challenge

In November 2000, the only real way to put a game on anyone's computer without an install was a Java applet in a web page. The browser gave you a small rectangle, a basic graphics library, a few sound clips and whatever speed the visitor's PC happened to have.

The constraints were blunt. The same applet ran on a fast desktop and on a tired school PC. Drawing straight to the screen flickered. Every image and sound came down a dial-up modem. And shared web hosting gave you a cgi-bin folder and Perl: that was the whole back end. Website owners wanted something that kept people on their site and coming back, which meant a game worth replaying and a leaderboard worth climbing.

Our approach

We kept the applet small and split it by job: one class for the player, input and drawing, one thread for enemies and level data, and one class for collisions, about 3,688 lines of Java in all. We made the game play the same on any machine, cut downloads to as few files as possible, and kept the server as simple as the hosting allowed. A year earlier we'd written Carbie, a DirectDraw platformer for Windows with levels loaded from files; The Void moved that data-driven idea into the browser.

What we built

Levels painted as pixels

The level wasn't a file format; it was a small image. The game read it back pixel by pixel, and as the screen scrolled, the enemy thread looked at the pixel for the current position: the red channel chose the enemy type (a basic fighter, a jet, a helicopter or a boat) and the green channel chose where it appeared. Any paint program became a level editor, and the level compressed well and arrived with the art.

Smooth on any PC

All drawing went to an offscreen image first and then to the screen in one step, which removed the flicker. Every sprite lived in a single strip image, and each draw set a clip rectangle so only the right frame showed: one download instead of dozens. The main loop measured how long the last frame took and scaled every movement by it, so a slow PC drew fewer frames but the ships covered the same distance per second.

Collision that feels fair

Collision used rectangles, but not the sprite's full rectangle. Each type's hit box was three-quarters of the sprite, worked out with two bit shifts and a subtract. A bullet that clipped a wing tip didn't kill you, and players feel that as fairness rather than maths. Integer shifts were cheap on any CPU, a habit that mattered far more on our Game Boy Advance 3D engine.

Enemies with a little intelligence

Most enemies flew fixed patterns. The boats fired a "smart" bullet that took the player's position when fired and set off towards it. It aimed once and didn't track you: cheaper than steering every frame, and fairer, because moving was rewarded. End-of-level bosses, power-ups and explosions completed the game.

High scores before leaderboards

When a game ended, the player's name and score went to a short Perl script on the web host. It read a flat file of the top 50, found where the new score belonged, shifted the rest down and wrote the file back. That was the whole leaderboard, years before app stores had them, and it was enough to run prizes on.

Architecture

  1. AppletKeyboard input, player and score
  2. Enemy threadReads the level image and spawns waves
  3. CollisionTyped rectangle tests with smaller hit boxes
  4. Blit threadOffscreen image to screen in one step
  5. CGI scriptTop-50 high-score table on the web host

Results

Under the hood

A whole game in a browser rectangle, on dial-up.

What it taught us

Looking back with today's eyes, two lessons stand out. Never trust the client: the score that reached the server was whatever the browser sent. Today a leaderboard, payment or form is validated on the server and tied to something the client can't forge. And shared state needs a lock: the script read, changed and wrote the whole file, so two players finishing at once could overwrite each other. It's the same lost-update race we now prevent with transactions and version checks.

The constraints were real ones, and still are for most products: unknown devices, slow networks, a thin server and users who notice when something feels unfair. That's how we build web and SaaS platforms and mobile apps today. Years later we ported another of our shoot-'em-ups to the browser with WebAssembly: see AstralX.

What we'd do now

The same game, built for today's web.

  • Score on the server. The client would send the inputs or a signed replay, not a number, and the server would check it was possible before it reached the table.
  • Use a database, not a file. A transaction or a version check on every write, so two players finishing together never overwrite each other.
  • Design for the slowest device. Frame-time movement is now built into every engine, but the principle stands: test on the oldest phone your users carry, not your own laptop.
  • Ship as little as possible. One sprite sheet instead of dozens of images was a dial-up necessity. Small bundles still decide whether a page feels instant on a mobile network.

Questions

What was a Java applet?

A small Java program embedded in a web page and run by the browser. In 2000 it was the main way to ship an interactive game on the web with no install.

How did the online high scores work?

At game over, the applet sent the name and score to a Perl CGI script, which slotted it into a top-50 table stored in a flat file on the web host.

Who was the game for?

Under the Halfbrick name, we offered games like it to website owners to keep visitors on their sites, with prizes based on players' scores.

Related

The services behind this work, and more stories like it.

Services

Case studies

Bring us the hard problem.

A 45-minute discovery call with the engineer who'll build it.