Reference

App

The sketch lifecycle and the window.

App · run

Drawing

Immediate-mode 2D drawing and style.

background · fill · stroke · tint · blend · clear · clear_alpha · circle · ellipse · rect · line · triangle · circles · ellipses · rects · lines · rect_mode · curve_resolution

Text

TrueType text (Inter is bundled), and bitmap text in the built-in 8x8 font.

Font · Rect · text

Transforms

Moving, turning and scaling the coordinate system.

transform · translate · rotate · scale · reset_matrix · current_matrix · apply_matrix

Style scopes

Saving and restoring fill, stroke and the other drawing style.

style · current_style

Events

Keys, mouse and files, and the polling functions.

Key · MouseButton · KeyEvent · MouseEvent · DropInfo · mouse · keys

Style types

The types a style is made of.

Blend · RectMode · Style · typing.ColorLike · typing.BlendValue · typing.RectModeValue · typing.WindingValue · typing.TextureFormatValue · typing.TextureFilterValue · typing.TextureWrapValue · typing.PrimitiveModeValue · typing.BufferUsageValue

Agents

Many agents kept as arrays, with senses, steering forces and a vectorized behaviour tree. Import with from kiln import agents.

agents.Population · agents.Senses · agents.seek · agents.arrive · agents.flee · agents.wander · agents.separate · agents.align · agents.cohere · agents.follow · agents.pursue · agents.evade · agents.follow_path · agents.contain · agents.avoid

Fields

Values on a grid over the world, which agents sense, eat and leave behind, and flow fields to steer along.

agents.Field · agents.FlowField · agents.FieldEdge

Life and evolution

Genes that set each agent’s traits, and the life cycle that hands them down, so traits evolve.

agents.Genome · agents.Crossover · agents.metabolize · agents.reproduce · agents.die

Brains and generations

Small neural networks per agent, their weights read from the genes and run in one batched pass, the rays that feed them, and a generational genetic algorithm that evolves them.

agents.Brains · agents.Activation · agents.rays · agents.ray_directions · agents.drive · agents.next_generation · agents.Selection

Behaviour trees

A behaviour tree that decides for every agent of a population at once, and the nodes to build it from.

agents.Tree · agents.Sequence · agents.Selector · agents.leaf · agents.condition · agents.is_kind · agents.Status

Testing

Rendering frames and feeding events to a sketch in tests.

testing.render_frames · testing.drain_calls · testing.pinned_clock · testing.MouseMove · testing.MousePress · testing.MouseRelease · testing.MouseScroll · testing.MouseEnter · testing.MouseExit · testing.KeyPress · testing.KeyRelease · testing.Drop

Color

The Color class.

Color

Math

Random numbers, simplex noise and number helpers.

random · random_gaussian · random_seed · noise · signed_noise · map · clamp · lerp · dist · dist_squared · wrap · normalize · in_range · sign · is_power_of_two · next_power_of_two

Time and window

Elapsed time, fixed steps, frame rate, the window and calls from other threads.

clock · window · call_soon · exit

Custom shapes

Polygons, holes, curves and beziers in a with shape() block.

shape · vertex · vertices · curve_vertex · bezier_vertex · next_contour · bezier · curve · winding · Winding

Images and textures

Loading, drawing and tinting pictures; filters, wrap modes, pixels and screen grabs.

Image · Texture · TextureFormat · TextureFilter · TextureWrap · save_screen

Fbo

Drawing offscreen into an Fbo and reusing it as a texture.

Fbo

Mesh and Vbo

Vertices, colours, texture coordinates, normals and attributes drawn in one call, .obj and .ply loading, and geometry kept on the GPU. Instanced drawing is on the Instancing page.

Mesh · PrimitiveMode · Vbo · BufferUsage

Instancing

One shape drawn many times in one call, each copy with its own attributes.

Vbo.upload_attribute · Vbo.instance_count

Shader

Materials, your own GLSL colour for anything Kiln draws, and raw vertex and fragment programs.

Shader · ShaderError

Sound

Instruments played from Python, and the audio stream.

Instrument · Synth · SoundStream · Sequencer · note_to_freq

Drums

Synthesised drums after the TR-808 and TR-909, one instrument per drum.

Kick · Snare · Clap · HiHat · Tom · Rimshot · Cowbell · Cymbal

Plucked strings and sound effects

A plucked string (STK’s Plucked) and retro game sound effects (sfxr).

Pluck · Sfx

Analysis

Reading the sound back, to drive visuals.

Master.level · Master.spectrum · Master.waveform · mic

Effects

Effects for one instrument or the master bus, and the master limiter.

Effect · Delay · Reverb · Chorus · Flanger · Phaser · Drive · Bitcrush · Instrument.fx · Instrument.pan · Instrument.bind · Instrument.unbind · Effect.bind · Effect.unbind · Limiter · Master · master

GUI

Control panels drawn by Kiln on top of the sketch, and the Parameters their controls edit.

Gui · Parameter