This is a "cheat sheet" for the "Web Dynamic Textures" extension by YellowAfterlife.
Click on sections to expand/collapse them.
Quick display controls: Categories · Sections · Everything ·

Concepts

The post-build script makes copies of generated texture pages and replaces them with fallback pages (such as blank images, silhouettes, or lossy images).

The extension allows you to load your original texture pages when desired and replaces them on spot.

This enables the game to load faster and load the textures when they are needed.

Getting started
  1. Install Neko VM so that it's in your PATH.
  2. Install ImageMagick so that it's in your PATH.
  3. Import the extension by dragging YYMPS onto your workspace or picking menu:Tools➜Import Local Asset Package.
  4. Set up your desired fallback texture type in the extension properties.

    Transparent and Solid Color reduce the texture page sizes the most, but produce illegible textures when not loaded.

    Silhouette produces a single-color texture with transparency (encoded as a lossy WEBP), which usually takes up 3-10% of original size, depending on shape complexity

    Lossy WEBP, is, hence the name, texture re-encoded into WEBP format.
    These are slightly larger than Silhouette, but produce a fairly legible image when not loaded, making them a great choice for loading textures in background.

  5. Add

    wdt_async_image();
    

    to an Async - Image event in a persistent object.

  6. Load textures when you need them!

    Or auto-load them if you're not sure.

    You can use status functions to check on the progress.

General functions
Loading
Loading

All of these start loading the respective texture page if it hasn't been loaded yet.

There's no harm calling them for something that's already loading/loaded.

wdt_load_sprite(sprite, ?subimg)​

Loads a texture page that contains the given subimage of the given sprite.

If subimg is omitted, applies to every subimage in the sprite.

wdt_load_sprites(...sprites)​

Like above, but can be passed any number of sprites.

wdt_load_font(font)​

Loads a texture page that contains the atlas for the given font.

wdt_load_tileset(font)​

Loads a texture page that contains the atlas for the given tileset.

wdt_load_texture_group(texture_group_name)​

Loads all texture pages from a texture group!

wdt_load_texture(texture)​

Loads a texture page associated with the given texture page entry (such as from sprite_get_texture).

Automatic loading
Automatic loading

You can have textures loaded automatically when they are being accessed!

It's a good idea to have the textures loaded by the time user will see them, but these offer a fail-safe in case you never load something.

Note: for implementation reasons, _get_texture calls count as "accessing the texture". You can use wdt_autoload_enable to perform texture manipulations without loading them.

wdt_autoload_texture(texture)​

Automatically loads the the texture associated with a texture page entry when it is being accessed.

wdt_autoload_textures()​

Automatically loads all sprite/font/tileset textures when they are being acessed.

wdt_autoload_enable(?enable)​

Enables/disables automatic loading for marked textures.

Returns the previous state.

If enable is not passed in or is undefined, just returns the current state.

For example, if you need to grab an auto-loaded sprite's texture without loading it, you could do

var _autoload = wdt_autoload_enable(false);
var _texture = sprite_get_texture(sprite, subimg);
wdt_autoload_enable(_autoload); // restore previous state
// do something with _texture
Status
Status
Status codes
wdt_get_status_name(status)​

Returns the name ("ready", etc.) for the given status code.

For things that may be spread across multiple texture pages (such as sprites or texture groups), the functions return the "worst" state (error > fallback > loading > ready) for an easier estimation of whether the thing is good to use.

wdt_get_sprite_status(sprite, ?subimg)​

Returns the texture status for a sprite.

If subimg is omitted, checks all of the frames.

wdt_get_font_status(font)​

Returns the texture status for a font.

wdt_get_tileset_status(tileset)​

Returns the texture status for a tileset.

wdt_get_texture_group_status(texture_group_name)​

Returns the texture status for contents of a texture group.

wdt_get_texture_status(texture)​

Returns the texture status for a texture page entry directly.

Other functions