// games · pixel art + javascript

Cosmic Castaways

My own pixel-art adventure, playable right here on the NOVA-8, a handheld console I designed for the browser. Crash-land on Kirra, a planet of red earth, purple skies and glowing green rivers, choose a tiger, a dragon or a clever octopus as your companion, team up with Enya and the Emerald Tiger, and find your ship's missing parts.

nova-8 · boot
  1. $ ./nova-8 --insert cosmic-castaways
  2. loading chapter 1: crash landing ..... ok
  3. companions: 3   creatures: 7   areas: 2
  4. image files: 0   audio files: 0 · all made by code
  5. status: press start
The NOVA-8 handheld console showing Cosmic Castaways

The NOVA-8 needs JavaScript to switch on.

$ cat ./cosmic-castaways/manual.txt

how to play

Click the console (or tap its screen) to switch it on, then play with the keyboard, the console's own buttons or a gamepad. Your adventure saves on this device.

Your star-skiff, the Comet, is hit by a meteor storm and crashes into a garden city on Kirra. Sprig, the city's gardening robot, scans the wreck: three of its parts flew off into the Crimson Wilds across the river.

Three young guardians live in Bloomhaven's grove. Choose one to travel with you (and to ride: it's twice as fast), then head into the Wilds: jewels to find, wild creatures in the violet glowgrass, a river that pours off the edge of the world, and a giant scrap crab wearing your thruster as a shell.

Along the way you'll meet Enya, a street brawler from Tipperary who crash-landed here long ago, riding the Emerald Tiger. She joins you and fights at your side.

$ ./nova-8 --controls

buttonkeyboarddoes
D-padWASD or arrowswalk, move the cursor
ASpace J Z Entertalk, read, choose
BK X Backspaceback, or hop (your companion joins in)
STARTEsc Pmenu: companion, bag, quest, save
SELECTShift Qhop on or off your companion
  • On a phone or tablet, tap and hold the console's buttons. A gamepad works too.
  • Walk over jewels to collect them, and trade them with Mossa in Bloomhaven for snacks that heal.
  • Under the console you can change its shell, the screen's colours (try Classic green) and the backdrop.

$ ./nova-8 --soundboard

soundboard

The game's soundtrack and sound effects, played live by the console's little sound chip. Each area has two backing tracks that take turns, riding your companion has its own tune, and the music turns tense near the scrap nest. Tap a pad for a sound effect.

The soundboard needs JavaScript.

$ ls ./cosmic-castaways/characters

the cast

Choose one of the three guardians as your companion. Enya joins you later.

$ ls ./cosmic-castaways/wild # the creatures of the Crimson Wilds

  • Glorp
  • Sporelet
  • Flitterfin
  • Crystabug
  • Thornback
  • Thornback Alpha
  • Rustclaw, the boss

$ ls ./games/retro # my first canvas games, from 2022

more games

$ cat ./cosmic-castaways/README.md

under the hood

There isn't a single image or sound file in the game. Everything is drawn and played by code.

The characters are pixel art written out letter by letter, one letter per pixel, or built from shapes that are then outlined and shaded like hand-made sprites. The ground is painted pixel by pixel from seeded noise, so each tile is a little different, then baked into four frames so the river ripples, the glowgrass sways and the stars twinkle.

The screen is 160 by 144 pixels, the same size as the handhelds I grew up with, scaled up in whole pixels so it stays crisp. Movement is tile by tile, and battles are turn based, with an energy bar for the stronger moves.

The music and sound effects come from a little sound chip I wrote with the Web Audio API: two pulse channels, a triangle bass and noise for the drums, with a touch of echo. Every tune was written for the game, and each area's backing tracks take turns. The console itself is HTML and CSS, and its buttons work with a mouse, a touch screen, the keyboard or a gamepad.

const cosmicCastaways = {
  console: "NOVA-8: HTML + CSS",
  screen: "160 × 144 canvas, 60 fps",
  engine: "plain JavaScript, no libraries",
  art: "pixel art drawn in code",
  sound: ["Web Audio", "2 pulse + triangle + noise"],
  tunes: 16,             // all original
  controls: ["keyboard", "touch", "gamepad"],
  saves: "on your device",
  image_files: 0,
  audio_files: 0,
  chapter: 1,
  author: "Ryan Lucas",
};