Skip to content

Using Your Own Artwork

Josh Dionne edited this page Sep 4, 2026 · 2 revisions

Generated from the thetowersdk repository. Edits made here are overwritten on the next push — change the source file instead.

Using Your Own Artwork

This package ships no artwork and no index of it. The art is TechTree Games’, and it is not this package’s to redistribute.

What ships is the naming rule, so a tool can find a file in a directory of artwork you supply.

import { gameAssetPath, gameAssetPaths, towerAssetUrl, assetSlug } from 'thetowersdk/assets'

gameAssetPath('Amplifying Strike', { domain: 'modules' })
// 'modules/amplifying-strike-md.webp'

gameAssetPaths('Om Chip', { domain: 'modules' })
// { sm: 'modules/om-chip-sm.webp', md: '…-md.webp', lg: '…-lg.webp' }

towerAssetUrl(gameAssetPath('Om Chip', { domain: 'modules' }), '/art')
// '/art/modules/om-chip-md.webp'

Where to put the files

<your art root>/
  modules/amplifying-strike-sm.webp
  modules/amplifying-strike-md.webp
  modules/amplifying-strike-lg.webp
  cards/…   relics/…   enemies/…   guardians/…   perks/…

One directory per domain, one file per size, named <slug>-<size>.<ext>. The slug is the name lowercased with runs of non-alphanumerics collapsed to a single hyphen — Om Chip becomes om-chip, Damage / Meter becomes damage-meter. assetSlug() applies exactly that rule, so name your files with it rather than reimplementing it: two implementations of one convention is how a name stops matching its file.

ASSET_DOMAINS lists the directory names, ASSET_SIZES the sizes. Use whichever subset you have — nothing requires all three sizes, and extension overrides webp if your files are png.

It builds paths, it does not check them

These functions never touch the disk, because the disk is yours. A path pointing at a file you do not have renders as a gap rather than throwing, so verify your own directory once at startup instead of trusting a returned string. null comes back only when a name slugifies to nothing, which stops modules/-md.webp from ever looking like a real path.


Clone this wiki locally