The asset pipeline

Play this lesson

The folder called final

When you joined, Hyper Shards' art folder held ship.png, ship_new.png, ship FINAL.png and ship FINAL 2.png. Nobody knew which one the game used. Some pictures were 4,096 pixels wide, straight from the art tool, so the game took ages to load on a phone.

An asset is any file a game uses that is not code: pictures, sounds, music, fonts and data. An asset pipeline is the fixed set of steps that turns the files artists make into the files the game loads, the same way every time.

Source files and exported files

Every asset exists in two forms.

Quick check

Kai finds a stray pixel on the exported alien sprite. The best fix is to paint over it in the exported PNG.

Show the answer

False

The next export would overwrite the fix and bring the stray pixel back. Fix it in the source file, then export again, so the fix lasts.

Texture atlases

A sprite sheet (see the art lesson) holds one animation's frames. A texture atlas packs many different pictures, the ship, every alien, the shards and the buttons, into one big image, plus a JSON file listing where each one sits.

Why? One file downloads faster than sixty. And the GPU draws many sprites in one go, a batch, when they share a few images. PixiJS's docs say a batch can use up to 16 different textures, depending on the device, so they advise sprite sheets. Each batch is one draw call: one order from the CPU to the GPU.

Bolt says: In PixiJS, await Assets.load('atlas.json') loads the JSON and its image together. Tools such as AssetPack, from the PixiJS team, pack the atlas for you.

Pick the right format

Lossless compression shrinks a file without changing a single pixel. Lossy compression throws away detail the eye barely notices, for much smaller files. JPEG is lossy and has no transparency, so sprites rarely use it.

Format pick

Three files need exporting: a 32 by 32 pixel-art shard with a see-through background, a pause icon that must stay sharp on every phone, and a big painted nebula backdrop. Which plan fits?

  1. Shard: PNG or lossless WebP. Icon: SVG. Nebula: lossy WebP or AVIF
  2. All three as JPEG, the most popular format
  3. Shard: lossy AVIF at low quality. Icon: a 4,096-pixel PNG. Nebula: SVG
  4. All three as SVG, so everything scales
Show the answer

Shard: PNG or lossless WebP. Icon: SVG. Nebula: lossy WebP or AVIF

Pixel art needs every pixel exact plus transparency, so lossless. An icon is simple shapes, so SVG stays sharp at any size. A painted backdrop hides lossy compression well, so WebP or AVIF saves the most. JPEG has no transparency, and SVG is not made for painted pixels.

Every megabyte counts

The art lesson showed how much memory a picture takes once it is open. Download size matters too: many players load the game over mobile data, and nobody likes a long wait before the title screen. So the pipeline keeps downloads small and loads only what is needed now:

Names and folders

A pipeline runs on rules, and computers are strict about names. The studio's rules:

Bug hunt

assets/sprites/
enemy-beetle-walk-01.pngenemy-beetle-walk-02.pngEnemy Beetle Walk 03.pngenemy-beetle-walk-04.pngenemy-beetle-walk-5.png

The beetle's 5-frame walk is loaded by the name pattern enemy-beetle-walk-NN.png. In the game, the walk keeps skipping. Which lines break the rules?

  1. Lines 3 and 5
  2. Lines 1 and 2
  3. Lines 2 and 4
  4. Line 4 only
Show the answer

Lines 3 and 5

Line 3 has capitals and spaces, and line 5 is missing its leading zero, so the loader asks for enemy-beetle-walk-03.png and enemy-beetle-walk-05.png and finds neither. A pipeline script can check every name and stop before a bad file ships.

Let a script do it

Exporting by hand is slow, and people forget steps. So the studio has a build script that runs with one command, npm run assets. Every time, the same way, it reads art-source/ and:

AssetPack has a plugin for each of these steps, and Claude Opus 5.5 can set it up.

Bolt says: The script can check our credits and license list too (see Copyright and licenses in Stage 5): an asset with no line on the list stops the build. Next lesson: sound effects and music, the half of game feel you hear.

Fact-checked 9 October 2026