// 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 --insert cosmic-castaways
- loading chapter 1: crash landing ..... ok
- companions: 3 creatures: 7 areas: 2
- image files: 0 audio files: 0 · all made by code
- status: press start
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
| button | keyboard | does |
|---|---|---|
| D-pad | WASD or arrows | walk, move the cursor |
| A | Space J Z Enter | talk, read, choose |
| B | K X Backspace | back, or hop (your companion joins in) |
| START | Esc P | menu: companion, bag, quest, save |
| SELECT | Shift Q | hop 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.
-
NOVA · tiger
A tiger cub with fiery stripes and bright green eyes. He can teleport a short way in a flash of light, and he is very fond of Enya.
-
EMBER or AZURE · dragon, red or blue
A baby dragon whose scales flicker between two colours: pick red to breathe fire, or blue to breathe frost.
-
LUMI · glowing octopus
A shimmering octopus in tiny reading glasses. The cleverest of the three: she heals herself and baffles foes with ink.
-
ENYA · ally, on the emerald tiger
She joins you in the Wilds and acts on her own in every battle: she heals your companion, pounces with the Emerald Tiger, or uses her Diamond Flash.
$ 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",
};