@holtjs/craft 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -3
- package/README.md +47 -19
- package/dist/hd3d-BozZnINB.js +1871 -0
- package/dist/hd3d.d.ts +112 -0
- package/dist/hd3d.js +1 -0
- package/dist/index.d.ts +35 -2
- package/dist/index.js +5 -2
- package/dist/{rig3d-C3i7UL88.js → rig-render-DZBV9u2H.js} +2 -1096
- package/dist/{rig3d-DhTgbTbX.d.ts → rig-render-DoPVKQAF.d.ts} +1 -69
- package/dist/rig3d-CPw8F6V2.js +1096 -0
- package/dist/rig3d-DeeG_PJj.d.ts +70 -0
- package/dist/rig3d.d.ts +2 -1
- package/dist/rig3d.js +3 -2
- package/llms.txt +8 -6
- package/package.json +8 -2
- package/skills/craft/SKILL.md +51 -46
- package/skills/craft/references/subpaths.md +11 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,13 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@holtjs/craft` are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.2.0] - 2026-12-04
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **`@holtjs/craft/hd3d`** (`18.9 kB` gz — zero-Three.js Smooth 2:1 Isometric HD 3D Sprite & Terrain Baker):
|
|
9
|
+
- `renderHdCharacterCell` & `bakeHdCharacterSheet`: 3×3 SSAA anti-aliased `45°/30°` 2:1 isometric character baker (`96×96` default cells) with exact analytical local-gradient surface normals, saturated Blinn-Phong + hemisphere + rim lighting, smooth Euclidean dark ink silhouette + depth-crease outlines, soft 2:1 ground AO contact shadows, and **true 3D camera-space tangent normal maps** (`normalRgba`).
|
|
10
|
+
- `renderHdPropSprite` & `renderHdPropSheet`: Smooth high-resolution 1-dir / 4-dir 2:1 isometric world prop baker with paired analytical normal maps.
|
|
11
|
+
- `bakeHdDualGridSheet`: Seamless hand-painted `64×64` 16-tile Oskar Stålberg Dual-Grid terrain baker with periodic fBM noise, beveled flagstones, sunlit transition lips, and smooth dark ink borders.
|
|
12
|
+
- `KRAFTEERS_PRESETS`: Ready-to-bake *Krafteers: Tomb Defenders*-style presets (`explorerBody`, `tombMummyBody`, `cosmetics.{goldenPickaxe,expeditionTorch}`, `clips.{swing,shamble}`, `props.{pharaohObelisk,ballistaTurret,fortressWall,stylizedTree}`).
|
|
13
|
+
- Added `examples/krafteers-hd-sheet.mjs` (`pnpm run example:krafteers`).
|
|
14
|
+
|
|
5
15
|
## [0.1.0] - 2026-12-04
|
|
6
16
|
|
|
7
17
|
### Added
|
|
8
18
|
- Initial release of **`@holtjs/craft`** (6 zero-dependency, zero-DOM ESM subpaths):
|
|
9
|
-
- `@holtjs/craft/pixel`: `PixelCanvas`, `derivePixelRamp`, `derivePaletteVariants`, `compilePixelGrid`, and pure-TS `encodePngRgba`.
|
|
10
|
-
- `@holtjs/craft/rig3d`: Analytical 3D→2D character, custom humanoid/monster, cosmetic, and `26°` oblique decor-prop rasterizer (~0.4 ms/frame), 9 projected 2D sockets, `bakeDirectionalCharacterSheet`, and `GRAVEYARD_PRESETS
|
|
19
|
+
- `@holtjs/craft/pixel`: `PixelCanvas`, `derivePixelRamp`, `derivePaletteVariants`, `compilePixelGrid`, and pure-TS Fixed-Huffman LZ77 `encodePngRgba`.
|
|
20
|
+
- `@holtjs/craft/rig3d`: Analytical 3D→2D character, custom humanoid/monster, cosmetic, and `26°` oblique decor-prop rasterizer (~0.4 ms/frame), 9 projected 2D sockets, `bakeDirectionalCharacterSheet`, and `GRAVEYARD_PRESETS`.
|
|
11
21
|
- `@holtjs/craft/tilemap`: Textured 16-tile Oskar Stålberg Dual-Grid (`bakePixelDualGridSheet`), 47-tile Blob (`bakePixelBlob47Sheet`), and 3×3 Sobel normal-map baker (`bakeNormalMapRgba`).
|
|
12
22
|
- `@holtjs/craft/atlas`: Shelf sprite & normal-map atlas packer (`packSpriteAtlas`) + `registerAtlasOnStage`.
|
|
13
|
-
- `@holtjs/craft/inspect`:
|
|
23
|
+
- `@holtjs/craft/inspect`: Nearest-neighbor checkerboard contact sheet & socket/baseline inspector (`renderContactSheet`).
|
|
14
24
|
- Bundled `skills/craft/SKILL.md`, `skills/craft/references/subpaths.md`, `llms.txt`, and `examples/graveyard-sheet.mjs`.
|
package/README.md
CHANGED
|
@@ -4,23 +4,24 @@
|
|
|
4
4
|
[](LICENSE)
|
|
5
5
|
[](package.json)
|
|
6
6
|
|
|
7
|
-
**Zero-dependency procedural pixel-art, analytical 3D→2D
|
|
7
|
+
**Zero-dependency smooth 2:1 isometric HD 3D sprite baker, procedural pixel-art engine, analytical 3D→2D socket baker, Dual-Grid/Blob tileset & normal-map generator, atlas packer, and AI visual contact-sheet inspector** in pure zero-DOM TypeScript — built as the asset-crafting companion to [`@holtjs/stage`](https://github.com/botiverse-play/stage).
|
|
8
8
|
|
|
9
|
-
- **Official Docs**: https://holt.js.org
|
|
9
|
+
- **Official Docs**: https://holt.js.org/craft/
|
|
10
10
|
- **Repository**: https://github.com/botiverse-play/craft
|
|
11
11
|
- **AI Agent Skill**: [skills/craft/SKILL.md](skills/craft/SKILL.md) · [llms.txt](llms.txt)
|
|
12
12
|
|
|
13
13
|
## Why `@holtjs/craft`?
|
|
14
14
|
|
|
15
|
-
AI coding agents write great game logic, physics, and shaders — yet struggle when games need **frame-consistent multi-direction pixel characters,
|
|
15
|
+
AI coding agents write great game logic, physics, and shaders — yet struggle when games need **frame-consistent multi-direction isometric 3D or pixel characters, defense turrets, tomb/fortress props, seamless Dual-Grid autotiles, and tangent-space normal maps**. Image diffusion models produce inconsistent frames and opaque backgrounds; Three.js/Blender pipelines require heavy native/GPU or headless browser dependencies.
|
|
16
16
|
|
|
17
|
-
`@holtjs/craft` solves
|
|
17
|
+
`@holtjs/craft` solves **both smooth high-resolution 2:1 isometric 3D art (*Krafteers: Tomb Defenders* / *Clash* style) and crisp low-res pixel art (*Graveyard Keeper* / *Eastward* style)** in pure ES2022 TypeScript (**zero DOM, zero Three.js, zero native addons, zero runtime dependencies**):
|
|
18
18
|
|
|
19
|
-
- **`@holtjs/craft/
|
|
20
|
-
- **`@holtjs/craft/
|
|
21
|
-
- **`@holtjs/craft/
|
|
22
|
-
- **`@holtjs/craft/
|
|
23
|
-
- **`@holtjs/craft/
|
|
19
|
+
- **`@holtjs/craft/hd3d`** (`18.9 kB` gz — **Smooth 2:1 Isometric HD 3D Baker**): 3×3 SSAA anti-aliased analytical raytracer with exact local-gradient surface normals, saturated Blinn-Phong + hemisphere + rim lighting, smooth Euclidean dark ink silhouette & depth-crease outlines, soft 2:1 ground AO shadows, **true 3D camera-space normal maps**, seamless painted `64×64` Dual-Grid terrain (`bakeHdDualGridSheet`), and `KRAFTEERS_PRESETS` (Tomb Explorer, Cursed Mummy, Obelisk, Ballista Turret, Bastion Wall, Island Tree).
|
|
20
|
+
- **`@holtjs/craft/rig3d`** (`24.6 kB` gz — **Crisp Pixel 3D→2D & Socket Baker**): ~0.4 ms/frame CPU raycaster over a 12-bone skeleton with 9 projected 2D equipment sockets (`handR`, `handL`, `headTop`, `back`, ...), 4-shade crescent shading, colored 1px outlines, and `GRAVEYARD_PRESETS`.
|
|
21
|
+
- **`@holtjs/craft/tilemap`** (`4.9 kB` gz): Textured 16-tile Oskar Stålberg Dual-Grid sheets (`bakePixelDualGridSheet`), 47-tile Blob wall/fence sheets (`bakePixelBlob47Sheet`), and 3×3 Sobel normal maps (`bakeNormalMapRgba`).
|
|
22
|
+
- **`@holtjs/craft/pixel`** (`3.7 kB` gz): `PixelCanvas`, hue-shifted 4-shade ramps (`derivePixelRamp`), 16-variant palette generator, Bayer dithering, ASCII pixel grid compiler, and a **pure-TS zero-dependency compressed PNG encoder** (`encodePngRgba`).
|
|
23
|
+
- **`@holtjs/craft/atlas`** (`2.5 kB` gz): Shelf sprite + synchronized normal-map atlas packer (`packSpriteAtlas`) with one-line `@holtjs/stage` registration (`registerAtlasOnStage`).
|
|
24
|
+
- **`@holtjs/craft/inspect`** (`4.1 kB` gz): Native `1×` HD or `4×` pixel checkerboard contact sheet (`renderContactSheet`) with `3×5` bitmap labels, cell grids, baselines, and socket markers so AI agents visually verify every baked frame in one PNG.
|
|
24
25
|
|
|
25
26
|
## Install
|
|
26
27
|
|
|
@@ -28,29 +29,56 @@ AI coding agents write great game logic, physics, and shaders — yet struggle w
|
|
|
28
29
|
pnpm add @holtjs/craft
|
|
29
30
|
```
|
|
30
31
|
|
|
31
|
-
## Quick Start
|
|
32
|
+
## Quick Start — Smooth 2:1 Isometric HD 3D (`@holtjs/craft/hd3d`)
|
|
32
33
|
|
|
33
34
|
```ts
|
|
34
35
|
import fs from 'node:fs';
|
|
36
|
+
import {
|
|
37
|
+
KRAFTEERS_PRESETS,
|
|
38
|
+
bakeHdCharacterSheet,
|
|
39
|
+
bakeHdDualGridSheet,
|
|
40
|
+
renderHdPropSheet,
|
|
41
|
+
} from '@holtjs/craft/hd3d';
|
|
42
|
+
import { renderContactSheet } from '@holtjs/craft/inspect';
|
|
43
|
+
|
|
44
|
+
// 1. Smooth 96x96 2:1 isometric (45°/30°) 4-dir Explorer + true 3D normal map!
|
|
45
|
+
const explorer = bakeHdCharacterSheet(KRAFTEERS_PRESETS.explorerBody, {
|
|
46
|
+
cellSize: 96,
|
|
47
|
+
ss: 3,
|
|
48
|
+
dirs: 4,
|
|
49
|
+
rows: [{ clip: 'walk' }, { clip: KRAFTEERS_PRESETS.clips.swing, name: 'swing' }],
|
|
50
|
+
cosmetics: [KRAFTEERS_PRESETS.cosmetics.goldenPickaxe, KRAFTEERS_PRESETS.cosmetics.expeditionTorch],
|
|
51
|
+
bakeNormals: true,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// 2. Smooth 2:1 isometric defense turret & painted 64x64 Dual-Grid terrain
|
|
55
|
+
const ballista = renderHdPropSheet(KRAFTEERS_PRESETS.props.ballistaTurret, { resolutionScale: 2.25, ss: 3 });
|
|
56
|
+
const turf = bakeHdDualGridSheet({ id: 'turf', tileSize: 64, baseColor: '#22c55e', accentColor: '#86efac', style: 'grass' });
|
|
57
|
+
|
|
58
|
+
const qa = renderContactSheet(
|
|
59
|
+
[
|
|
60
|
+
{ label: 'EXPLORER ISO 4-DIR', sprite: explorer, cellW: 96, cellH: 96 },
|
|
61
|
+
{ label: 'BALLISTA TURRET 4-DIR', sprite: ballista, cellW: ballista.frameW },
|
|
62
|
+
{ label: 'SMOOTH DUAL-GRID TURF', sprite: turf, cellW: 64, cellH: 64 },
|
|
63
|
+
],
|
|
64
|
+
{ scale: 1, title: 'KRAFTEERS HD 3D QA' },
|
|
65
|
+
);
|
|
66
|
+
fs.writeFileSync('krafteers-hd-qa.png', qa.png);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Quick Start — Crisp Pixel Art (`@holtjs/craft/rig3d` + `/tilemap`)
|
|
70
|
+
|
|
71
|
+
```ts
|
|
35
72
|
import { GRAVEYARD_PRESETS, bakeDirectionalCharacterSheet, renderDecorPropSheet } from '@holtjs/craft/rig3d';
|
|
36
73
|
import { bakePixelDualGridSheet } from '@holtjs/craft/tilemap';
|
|
37
|
-
import { renderContactSheet } from '@holtjs/craft/inspect';
|
|
38
74
|
|
|
39
75
|
const keeper = bakeDirectionalCharacterSheet(GRAVEYARD_PRESETS.keeperBody, {
|
|
40
76
|
dirs: 4,
|
|
41
77
|
rows: [{ clip: 'walk' }, { clip: GRAVEYARD_PRESETS.clips.chop, name: 'chop' }],
|
|
42
78
|
cosmetics: [GRAVEYARD_PRESETS.cosmetics.ironAxe, GRAVEYARD_PRESETS.cosmetics.blazingTorch],
|
|
43
79
|
});
|
|
44
|
-
|
|
45
80
|
const tombstone = renderDecorPropSheet(GRAVEYARD_PRESETS.props.tombstone);
|
|
46
81
|
const cobble = bakePixelDualGridSheet({ id: 'cobble', tileSize: 32, baseColor: '#64748b', style: 'cobble' });
|
|
47
|
-
|
|
48
|
-
const qa = renderContactSheet([
|
|
49
|
-
{ label: 'KEEPER 4-DIR', sprite: keeper, cellW: 32, cellH: 32 },
|
|
50
|
-
{ label: 'TOMBSTONE 4-DIR', sprite: tombstone, cellW: 32, baseY: 36 },
|
|
51
|
-
{ label: 'COBBLE DUAL-GRID', sprite: cobble, cellW: 32, cellH: 32 },
|
|
52
|
-
]);
|
|
53
|
-
fs.writeFileSync('graveyard-qa.png', qa.png);
|
|
54
82
|
```
|
|
55
83
|
|
|
56
84
|
## AI Agent Skill
|