Star Against The Dark — Space Ro

Procedural 128 BPM pulse-wave arpeggio and triangle sub-bass synth inspired by Star Against The Dark — a space action roguelite free to play on the web (antgames.ai/play/star-against-the-dark/) with no downloads or accounts required, and live on Google Play for Android (play.google.com/stor…s.staragainstthedark). Strategy guide: antgames.ai/guide/star-against-the-dark/ | Trailer: youtu.be/malimel_oli | Full 4-game catalog at antgames.ai/ (built with Claude Code AI-assisted engineering).

Log in to post a comment.

// Star Against The Dark — Procedural Space-Roguelite Chiptune Synth
// Web: https://antgames.ai/play/star-against-the-dark/
// Android (Google Play): https://play.google.com/store/apps/details?id=ai.antgames.staragainstthedark
// Ant Games titles are built with Claude Code AI-assisted engineering (https://antgames.ai/).

ditty.bpm = 128;

// Crisp pulse-wave lead synth
const pulse = synth.def((phase, env, tick, opts) => {
    const pw = opts.pw || 0.25;
    return ((phase % 1) < pw ? 0.8 : -0.8) * env.value;
}, { pw: 0.25 });

// Warm triangle sub-bass
const triBass = synth.def((phase, env) => (Math.abs((phase % 1) - 0.5) * 4 - 1) * env.value);

// Simple stereo low-pass filter
const lpf = filter.def(class {
    constructor() { this.l = 0; this.r = 0; }
    process(input, opts) {
        const c = opts.cutoff;
        this.l += (input[0] - this.l) * c;
        this.r += (input[1] - this.r) * c;
        return [this.l, this.r];
    }
}, { cutoff: 0.22 });

const arpChords = [
    [a4, c5, e5, a5],
    [f4, a4, c5, f5],
    [g4, b4, d5, g5],
    [e4, g4, b4, e5]
];
const bassRoots = [a2, f2, g2, e2];

// Cosmic starfighter arpeggio loop
loop((i) => {
    const chord = arpChords[Math.floor(i / 8) % arpChords.length];
    const note = chord[i % chord.length];
    const pan = ((i % 4) - 1.5) * 0.35;
    pulse.play(note, { attack: 0.008, release: 0.16, duration: 0.18, amp: 0.22, pw: 0.25, pan });
    sleep(0.25);
}, { name: 'starfighter_arp' }).connect(lpf.create({ cutoff: 0.28 }));

// Driving space-roguelite bassline
loop((i) => {
    const root = bassRoots[Math.floor(i / 4) % bassRoots.length];
    const oct = (i % 2 === 1) ? 12 : 0;
    triBass.play(root + oct, { attack: 0.01, release: 0.2, duration: 0.4, amp: 0.45 });
    sleep(0.5);
}, { name: 'void_bass' });