KSL — Kotlin Simulation Library

Watch a simulation actually run


A discrete-event model is usually a table of numbers at the end of a run. It doesn't have to be. Every animation on this site is a real KSL run, replayed in your browser — no install, no plugin, no video.

A drive-through pharmacy: cars arrive, wait in one line, and are served by whichever pharmacist is free. Press pause — it is a simulation being replayed, not a clip.

Browse all 15 animations Get KSL

It is the model you already wrote

Animation is not a second implementation of your simulation. You do not describe the picture to the simulator or the simulator to the picture. Capture is a flag on a run: the model executes exactly as it always did and writes down what happened, and everything on this site is drawn from those recordings afterwards.

That matters more than it sounds. An animation built by hand can disagree with the model, and when it does, it lies convincingly. One replayed from the run cannot.

Three steps

Capture

Run the model with capture switched on. It writes a trace — every arrival, seize, move and release, with the time it happened.

Lay it out

A layout says where a queue sits and what color an entity is. You do not start from a blank canvas: the app derives one from the trace, and you adjust what it guessed.

Replay

Scrub, pause, slow it down, run it back. The trace is a file — keep it, send it to a student, open it again next year.

The same picture in two places

The desktop application and this website draw through one renderer over one trace format. A page here is not an export or an approximation of what the app shows; it is the same drawing code reading the same file. Each animation below offers its trace for download, so you can open it in the app and lay it out yourself.

What it can draw

Queues and resources

Lines forming and clearing, servers busy and idle, blocking when a buffer fills.

Movement

Parts on conveyors, workers carrying loads, vehicles routing around congestion.

Agents in space

Crowds through doorways, epidemics across a grid, flocking on a world whose edges join.

Live statistics

Charts and counters that advance with the run, beside the thing they are counting.

Have a look

Fifteen worked examples, from a single queue to a warehouse of bidding vehicles. Each one says what it is and what to watch for while it plays.

All 15 animations