Butterfly Garden

A monarch rides the wind through a summer border modelled on those at the Minnesota Landscape Arboretum.

It's flown by a policy that learned to reach flowers by trial and error. Press P to fly it yourself.

The sun follows a real day there, and every colour comes from light and surface spectra, wavelength by wavelength.

Drag to look around, scroll to zoom, C to change the camera.

Made for Firefox or Chrome/Chromium on a desktop or laptop. Most reports say it doesn't work on mobile: it's too demanding for most phones.

How this works

The butterfly is flown by a tiny neural network, about 10,000 numbers, that learned to fly by trial and error over millions of simulated flights, rewarded only for landing on a flower it hasn't just visited. Twenty times a second it decides how hard to flap, lean and turn.

The sprout in the top right corner trains a policy of your own from scratch, here in your browser on your own computer's cores. It learns in stages, a curriculum: first in a garden without obstacles, then with the stems and hedge. While it trains, eight butterflies fly the trainer's practice flights with the policy as it learns, and afterwards yours flies the garden, to save in your browser or export as a file.

It doesn't see pixels. It senses what a butterfly could: which way the flowers are and how big they look, the wind on its antennae, how near the stems and hedge are, and where it has fed in the last minute, so it moves on to new flowers.

Every petal, leaf and wing stores how it reflects each wavelength of light, and the sun follows a real September day at the Minnesota Landscape Arboretum, so colours shift through the day as they really would. F1 lets you change the time.

One wind moves everything: the butterfly, the grass, the swaying flowers, the drifting leaves, and the sound you hear.

Built in Rust with Bevy and WebGPU.

Loading the garden…

with the sound of the wind where you watch; M mutes it

More games at emmas.games