BLIT386BLIT386

Skill: Update BLIT386 API names

Update a game's code after a BLIT386 upgrade renamed parts of the API, and enable hot reload in vite.config on blit386 1.4.0+. Use this when 'blit upgrade'...

Written for blit386 1.8.0. The rest of blit386.dev documents the newest engine, so an API you find there may be missing from a game pinned to 1.8.0.

Update a game after a BLIT386 upgrade renamed parts of the API: let blit migrate make the safe renames, then handle the rest by hand.

When to use

Use when blit upgrade or blit migrate reports names that "need a closer look," when the game breaks after a BLIT386 update, or when the user says "update my game to the new version" or "fix the renamed functions."

Steps

  1. Preview first: run npx blit migrate. It lists the renames it can make automatically, the ones that need review, and whether it can enable hot reload in vite.config (blit386 1.4.0+). Nothing is written yet.
  2. Apply the safe ones: run npx blit migrate --write. This rewrites unambiguous names for you (for example BT.buttonDown -> BT.isDown, the overlayEnabled config flag -> isOverlayEnabled) and, when missing, adds the blit386() Vite plugin so code and public/ asset edits keep the game running.
  3. Handle each "needs a closer look" item by hand. These are common words, so the tool will not rewrite them blindly - they might belong to your own code. Only rename a call when the value on the left is the matching BLIT386 type:
    • .equals(...) -> .isEqual(...) on a Vector2i, Rect2i, or Color32
    • .contains(...) -> .isContaining(...) on a Rect2i
    • .intersects(...) -> .isIntersecting(...) on a Rect2i
    • .tick(...) -> .fireIfElapsed(...) on a Timer
    • Inside the bootstrap(...) options object only: canvasId -> canvasID, containerId -> containerID, waitForDOMReady -> isWaitingForDOMReady
  4. Leave anything that is not a BLIT386 value alone. A plain array's .contains(...) or your own tick() method is not the engine - do not touch it.
  5. If migrate could not edit an unusual vite.config, add hot reload by hand (see the use-hot-reload skill / docs/hot-reload.md), then restart npx blit run once.
  6. Verify: run npx blit run and play the game, or npx blit doctor to check the setup. If something still breaks, use the "fix" skill.

Notes

  • The full, authoritative list of old -> new names is the engine's deprecation timeline: https://blit386.dev/docs/reference/deprecations
  • Hot reload enablement needs blit386 1.4.0+. Prefer npx blit upgrade first if you are behind - it updates the engine and then offers the same migrate step.
  • blit migrate previews by default and only changes files with --write, so it is always safe to run and read first.
  • If the project is not saved with git, save a copy before writing - blit migrate --write warns about this first.

On this page