Build a world in one file - Internet Explorer
Address
https://freetolearn.world/one-file-world.html
free to learn.world
← Course Directory

Graphics project · 9 lessons · Free

Build a world in one file

A passenger ferry passes the lit windows of the tide station. Its hull cuts across their reflection. Enter the harbour

Watch the last ferry cross the harbour, then drag to look around. On a phone, hold the arrow to fly forward. On a keyboard, use W, A, S and D.

Build this flyable island from a seed in JavaScript and WebGL2. Write the camera, shape the coast, grow a forest and keep the frame time under control.

From the dock, compare the lamps on and the lamps off. Which patch disappears from the wet boards?

Build your own island

Start with a flat plane. Every lesson adds a layer to the same world. You write a function, predict what will happen, run its checks and use it in a second situation. The final project is a different world of your own design.

You'll use a terminal, Node.js 22 or newer and a WebGL2 browser. The lab runs offline and needs no packages.

Get the course on GitHub · Download the ZIP

Clone the course, then create your project and run its first check.

git clone https://github.com/itsHabib/free-to-learn.git
cd free-to-learn
git switch -c my-island b07f6d53f56f3d19ec63fd235dc66e21d16f014c
cd courses/one-file-world
node lab.mjs start project write
node lab.mjs check project 1

The first check names a camera function to finish. Lesson 1 shows the inputs, the code and what the camera should do. For a working example, start with node lab.mjs start guided supplied.

Lessons and code

  1. Camera over a plane — Aim the camera and cull tiles outside the view.
  2. Land from a seed — Generate ridged noise and a repeatable coastline.
  3. Light and distance — Compute the solar angle and interpolate the sky colours.
  4. Water — Build a periodic wave tile and light its slopes.
  5. Erosion and ground — Decide when a moving water drop erodes soil or deposits it.
  6. Ten thousand things — Place species by rule and batch thousands of instances.
  7. Things that move — Steer a gull using the positions of its neighbours.
  8. Sound from code — Shape a gull call and mix it with the wind and sea.
  9. Ship it — Budget frame time, ship a single HTML file and critique your second world.

Island workshop videos

Each film changes one thing in the island and shows the result. Watch the series on YouTube.

Frame the last ferry home

Follow the station’s reflection as the ferry passes. Move the camera in lesson 9 and see whether the crossing still reads. Watch on YouTube

Why a WebGL sunset looks washed out

Blend two sky colours in linear light. Hold the camera and time fixed to see what a second display conversion does to the clouds. Read lesson 3 and try it. Watch on YouTube

How to draw half a forest and keep the hillside full

Draw fewer trees from the same buffer. Compare the pattern left by row order with the pattern left by a stable shuffle. Read lesson 6 and try it. Watch on YouTube

Early edition. First-time learner and physical-phone trials are pending. Request a course →

Course overviewInternet
Mission.txt - Notepad

Learning without paywalls.

Find what people pay to learn.
Build a great course. Give it away.

One course at a time.

Usage & privacy

Start