Agent skill
ffi-reference
ZX fantasy console FFI bindings reference. Documents 250+ functions for rendering, input, audio, camera, transforms, textures, materials, and debug. Includes init-only vs render-only call rules and the coordinate system. Use when writing or debugging ZX FFI calls in game code.
Install this agent skill to your Project
npx add-skill https://github.com/nethercore-systems/nethercore-ai-plugins/tree/main/zx/skills/ffi-reference
Metadata
Additional technical details for this skill
- author
- nethercore-systems
- version
- 1.0.0
SKILL.md
ZX FFI Reference
The ZX console provides 250+ FFI functions. Always read nethercore/include/zx.rs for accurate signatures.
FFI Categories
| Category | Key Functions | Find In zx.rs |
|---|---|---|
| System | delta_time, tick_count, log |
Lines 1-100 |
| Random | random, random_range, random_f32 |
Search "random" |
| Input | button_held, button_pressed, left_stick_x |
Search "button" |
| Camera | camera_set, camera_fov |
Search "camera" |
| Transforms | push_translate, push_rotate_y, push_scale |
Search "push_" |
| Meshes | load_mesh, draw_mesh, cube, sphere |
Search "mesh" |
| Textures | load_texture, texture_bind |
Search "texture" |
| Materials | material_albedo, material_mre, material_normal |
Search "material" |
| Audio | load_sound, play_sound, music_play |
Search "sound" |
| 2D Drawing | draw_sprite, draw_text, draw_rect |
Search "draw_" |
| Environment | draw_env, env_gradient |
Search "env_" |
| Debug | debug_register_*, debug_watch_*, debug_group_* |
Search "debug_" |
Init-Only Functions
Must call only during init():
set_tick_rate(rate)- 0=24fps, 1=30fps, 2=60fps, 3=120fpsset_clear_color(color)- 0xRRGGBBAArender_mode(mode)- 0=Lambert, 1=Matcap, 2=PBR, 3=Hybrid- All
rom_*(),load_*(), procedural mesh functions
Render-Only Functions
Call only during render():
- All
draw_*functions camera_set(),camera_fov()push_translate(),push_rotate_y(),push_scale()texture_bind(),font_bind()begin_pass(),begin_pass_stencil_write()
Asset Loading
// In init()
let tex = rom_texture_str("player");
let mesh = rom_mesh_str("character");
let sfx = rom_sound_str("jump");
let music = rom_music_str("theme");
Transform Stack
// In render()
push_translate(x, y, z);
push_rotate_y(angle_degrees);
push_scale_uniform(scale);
draw_mesh(MESH);
push_identity(); // Reset
Coordinate System
- Y-up, right-handed, -Z forward
- When yaw=0, camera looks toward -Z
- Angles in degrees for FFI functions
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
console-specs
ZX fantasy console hardware specifications and resource budgets. Covers resolution (960x540), memory limits (4 MB RAM/VRAM, 16 MB ROM), render modes, audio system (22 kHz, 16 channels), and input layout. Use when planning resource budgets or checking console capabilities.
rendering
ZX rendering techniques and patterns. Covers camera systems (follow, orbit), stencil buffer effects (portals, masks), billboard particles, custom fonts, and render pass management. Use when implementing cameras, visual effects, particle systems, or choosing between 2D and 3D rendering approaches.
debugging
Runtime debugging tools for Nethercore games on all consoles. Covers the F4 Debug Inspector, live value editing, watch variables, frame stepping, and time-scale controls. Use when tuning game parameters at runtime, tracking state over time, or stepping through frames to find bugs.
optimization
Optimization techniques for Nethercore WASM games. Covers WASM binary size reduction (LTO, wasm-opt), texture and mesh compression, audio optimization, and state size minimization. Use when a ROM exceeds size limits or when reducing build output size.
testing
Testing Nethercore games for determinism and correctness. Covers sync testing, replay recording and playback, debug actions, and desync diagnosis. Use when running sync tests, setting up replay-based regression tests, or diagnosing determinism failures.
publishing
Publishing Nethercore games to nethercore.systems. Covers ROM packaging with nether pack, release builds, platform upload requirements, versioning, and CI/CD pipeline setup with GitHub Actions. Use when preparing a game for release or setting up automated builds.
Didn't find tool you were looking for?