GenoCode Getting startedThe languageCreatures Open the app

Getting started

GenoCode is a small language for making creatures, and an app where you write them, see them in 3D, breed them, morph them and watch them dance to music. This guide takes you from a first ball to a creature with genes and parts. The full rules are in the language reference.

The app

The app has six modes, along the top:

Start in the Library: open a few of the starter creatures, look at their code, and move their gene sliders. Every one of them was written in the language this guide describes.

A first creature

Press New and replace the code with this:

creature Snowman
// Three balls, one on another, each smaller than the last.

pitch -90
shape ball
repeat 3 {
  lay
  forward 0.8
  grow 0.75
}

A GenoCode creature is drawn by a turtle: an invisible pen that moves and turns in 3D, and lays shapes where it is.

Moves are measured in the turtle's own size, so after grow 0.75 the next forward 0.8 goes three quarters as far. That's why each ball sits neatly on the one below.

Genes

A gene is a value that can change when creatures mutate, breed and morph. Give it a range, and the app gives it a slider:

creature Snowman
// Balls one on another, each smaller than the last.

gene balls  = 3    in 2..6 step 1  // how many balls
gene shrink = 0.75 in 0.5..0.95    // each ball's size compared with the one below
gene snow   = hsv(200, 0.1, 1) in hsv(0, 0, 0.6)..hsv(360, 0.5, 1)

pitch -90
shape ball
colour snow
repeat balls {
  lay
  forward 0.8
  grow shrink
}

Parts

A part is a named piece of a creature that can be laid again and again, with its own genes:

creature Snowman
// Balls one on another, each smaller than the last, with a carrot nose on the top one.

gene balls  = 3    in 2..6 step 1  // how many balls
gene shrink = 0.75 in 0.5..0.95    // each ball's size compared with the one below
gene snow   = hsv(200, 0.1, 1) in hsv(0, 0, 0.6)..hsv(360, 0.5, 1)

pitch -90
shape ball
colour snow
repeat balls {
  lay
  forward 0.8
  grow shrink
}
grow 1 / shrink
back 0.8
nose

part nose {
  gene reach  = 1 in 0.3..2
  gene carrot = hsv(28, 0.9, 1) in hsv(0, 0.5, 0.5)..hsv(60, 1, 1)

  pitch 90
  yaw 40
  forward 0.4 + reach / 2
  shape cone
  colour carrot
  lay { grow (0.25, 0.25, reach) }
}

Variants, morphing and dancing

A variant is another set of gene values for the same creature:

variant Tall { balls = 6; shrink = 0.9 }

Add that line at the end of the snowman and press Morph: the snowman grows into the tall one and back. In Dance, music carries it through the same loop. Pick a music file, or the microphone, and a dance style.

Creatures can also read the music directly: music.bass, music.level and the others run from 0 to 1 as the music plays, and time counts the seconds. For example, grow 1 + 0.2 * music.bass makes everything swell with the bass.

Blocks

Press Blocks in View to see the code as blocks, beside the code itself. Drag blocks in from the palettes on the left, and the code is written for you. Change the code, and the blocks follow.

Textures and backgrounds

Shapes can wear textures, and a creature can carry its own background:

creature Marble_Ball
// A ball of marble, on an aurora.

shape ball
texture pattern(marble, 200, 7, dusk, pearl)
lay

background {
  fill pattern(aurora, 160, 12, dusk)
}

The Patterns mode is the easiest way to find recipes like these: try kinds, hues, schemes and finishes, breed the ones you like, and Copy code or Use as background.

Saving and sharing

Where next