nd-plant for axil-nd, ported from SIC to libxylem.
git clone https://github.com/tty-pt/nd-plantaxil-nd-plant
nd-plant for axil-nd, ported from SIC to libxylem.
Owns plants: the 31 tree, shrub, flower, moss, and crop species, their skeletons and drops, map generation (on_noise, on_empty_tile, on_spawn), and the carrot/tomato consumables that feed nd-drink. The plant_tile_t the map layer and nd-mob read is defined in <nd/plant.h>.
Install
make install
Installs:
lib/libnd-plant.so
include/nd/plant-types.h
include/nd/plant.h
include/nd/plant_model.h
include/nd/plant_mesh3d.h
include/nd/plant_foliage_atlas.h
There is deliberately no lib/nd-plant.so symlink (see axil-nd-wts for why: mods.load names the installed filename, and the OpenBSD packing list never lists a symlink).
Also packaged across all 9 platforms (deb, apk, rpm, pacman, brew, openbsd, winget + Scoop, android-lib, and ios-lib + SwiftPM XCFramework) from a v* tag.
Build from source
Builds use the shared libstele makefile rules (include ttypt/include.mk, resolved via MAKEFLAGS += -I... / TTYPT_MK / pkg-config --variable=include_mk stele):
make
Needs libxylem, libstele, and the engine's game API, <nd/xy.h>, plus <nd/drink.h> (consumables) and <nd/core.h> (the icon decorator) โ from checkouts beside this repo or from installed packages:
git clone https://github.com/tty-pt/nd-plant && cd nd-plant
git clone https://github.com/tty-pt/axil-nd ../axil-nd
git clone https://github.com/tty-pt/nd-drink ../axil-nd-drink
git clone https://github.com/tty-pt/nd-core ../axil-nd-core
make
Both the checkout -I flags and the installed-package paths are on the command line at once (see Makefile), and a missing -I is ignored, so the same command works either way. CI names the deps explicitly (axil-nd,libxylem,libstele,nd-drink,nd-core,xxhash).
XXH32 comes from <xxhash.h>, which is self-contained for XXH32 โ no -lxxhash on the link line. The old module got it from <nd/nd.h>, which is gone.
What it does
xy_install()registers the 31 species skeletons and drops (chop action
first, then the type, consumables, drops and species โ the order the original FIXME comments insist on), synchronizing SKEL physical bounds (width_cm, height_cm) directly with the 3D botanical generator.
on_noisehashes the tile (XXH32), evaluates continuous biome viability, multi-scale canopy/moisture competition (nd_plant_canopy_competition), and continuous cover-field canopy/scree competition (nd_plant_eval_cover/nd_plant_eval_cover_dims), grows the noise tile and shuffles
it; on_empty_tile renders a side; on_spawn plants the tile's species; on_examine reports plid and size; on_add drops the plant, persisting tile side in PLA and hashing (rx, ry, side) so obj.art_id (1..4, ND_PLANT_ART_VAR_MAX = 4) stays synchronized with the 3D plant mesh variant.
- The old
on_iconbody is now acore_icon_decoratedecorator registered
in xy_install (the shop precedent): it replaces the glyph with the growth stage and adds the chop action. A companion core_art_decorate decorator (plant_art_decorate) resolves species and 4-variant multi-stage sprite paths under art/plant/<species>/{small,big}/{1..4}.png.
- Modular header-only 3D botanical synthesis (
<nd/plant_model.h>,<nd/plant_mesh3d.h>,<nd/plant_foliage_atlas.h>) provides 4-order fractal tree branching, pipe-model allometry calibrated to a 40 cm lamb, 5-stage ontogeny (seedlingโmature), spline trunk/root-flare/foliage meshes, compound meadow clumps, shrubs, vines, rushes, lilypads, moss, understory props, and procedural RGBA + tangent-space normal atlases (foliage, 1024ร512 grass, 256ร256 bark, and terrain detail).
Packaged Assets
- Art (
art/): Botanical, crop, and flora resource graphics (carrot.png,flax.jpg, and centered 4-variant 3D-baked orthographic albedo sprites and tangent-space normal maps underart/plant/<species>/{small,big}/). - Botanical Documentation & Pipeline:
docs/SPEC.md: Camera perspective ($55^\circ$ $3/4$ diorama), Lamb/Room physical scale (1 px = 1 wu = 4 cm), root anchor placement, and 19-biome density profiles.docs/species/README.md&IDEA.md: Botanical dossiers and 40 cm-lamb proportional measures for tree species and procedural growth architecture.scripts/gen.py&prompt_template.md: World-space botanical sprite generation pipeline supporting multi-variant and multi-stage generation with auto-sync todata/plants.dsvandinclude/nd/plant.h.
Testing
There is no test.sh here. Behaviour is asserted by the engine's own suite:
cd ../axil-nd
make && ./test.sh
Notes from the port
SIC_DEFโXY_IMPL,mod_installโxy_install,object_addtakes 4
args (the old 5-arg tail is dropped), nd_owritef-style calls become snprintf + nd_rwrite (a va_list cannot cross the XY boundary).
memset(pd.id, 0, 3)cleared 3 bytes of a 12-byte array; it is now
sizeof(pd.id).
- The link line is libxylem alone.
NEEDEDislibxylem.soandlibc.so.6.
License
BSD 2-Clause, carried over from tty-pt/nd-plant. See LICENSE.