code wiki / _hdl_build / nx_ng_world.nx
nx_ng_world.nx
buildroot/runtime/_hdl_build/nx_ng_world.nx
about
nx_ng_world.nx -- CAP-WORLD-MODEL, generation 14: THE ENDPOINT of the neural-graphics ladder. The leap past
every prior rung (which rendered STATIC scenes): a learned DYNAMICS model -- state x action -> next state --
that can be ROLLED OUT (applied repeatedly) and RENDERED frame-by-frame = an interactive neural game engine
(Ha&Schmidhuber world model / GameNGen / Genie / Sora-class). src ng_world_sora, ng_world_t2v, ng_world_worldmodel.
Reuses the renderer (software raster into nx_image, displayed via the nx_scene_demo canvas bridge -- the only
browser touch). Learns the transition rule from observed (state,action,next) transitions, then SIMULATES a
NOVEL action sequence and renders the rollout as a spacetime filmstrip (rows = time, cols = space). Q16, no float.
Honest gated proof of the DEFINING (interactive) property: T1 LEARN-DYNAMICS -- recover the transition rule
from data (|V-V*| small); T2 INTERACTIVE ROLLOUT -- a NOVEL action sequence (not the training one) is simulated
correctly (predicted trajectory == true world, err~0) = actions drive the next frame, generalizes; T3
NEG-CONTROL -- a model that IGNORES the action (V=0, static) CANNOT predict (the action is load-bearing = what
makes it a *world* model, not a static scene); T4 RENDER+EMIT -- the rollout renders to a viewable filmstrip.
HONEST: 1-DOF state (object x-position), linear dynamics; full world-model = high-dim latent state + learned
non-linear dynamics + frame-conditioned generation = the follow-on. Sovereign: nx_image + nx_base64 + syscalls.
The emitted artifact is PUBLISHED via nx_ng_publish (NOT local show-and-tell). license_tier: ORIGINAL expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_image.nxnx_itoa_lib.nxnx_base64.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 21 | const V_MAGIC_1024: i64 = 1024 |
| 22 | const V_MAGIC_8192: i64 = 8192 |
| 23 | const V_MAGIC_262144: i64 = 262144 |
| 25 | const WLOG: *u8 = "knowledge/status/ng_world.log" |
| 26 | const OUTP: *u8 = "web_assets/ng_world_view.html" |
| 27 | const Q16: i64 = 65536 |
| 28 | const NT: i64 = 12 // timesteps (filmstrip rows) |
| 29 | const IW: i64 = 32 // space pixels (cols) |
| 30 | const V_TRUE: i64 = 9830 // true per-action velocity 0.15 |
| 31 | const X0: i64 = 16384 // initial state 0.25 |
| 32 | const BR2: i64 = 655 // blob radius^2 (~0.1^2) for rendering |
| 33 | const EPOCHS: i64 = 1000 |
| 34 | const LRQ: i64 = 2048 |
functions
| 36 | func wp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } called by 1: main |
| 41 | func wpn(v: i64) -> i64 { nxi_out(v); return 0 } |
| 42 | func w_abs(v: i64) -> i64 { if v<0 { return 0-v } return v } |
| 43 | func wqm(a: i64, b: i64) -> i64 { return (a*b)>>16 } |
| 44 | func wl_ws(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 } called by 1: main |
| 49 | func wl_wn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 } |
| 52 | func sc_app(out: *u8, off: *i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { out[off[0]] = s[i]; off[0] = off[0] + 1; i = i + 1 } return 0 } called by 1: nx_img_canvas_page |
| 53 | func sc_app_n(out: *u8, off: *i64, v: i64) -> i64 called by 1: nx_img_canvas_page |
| 60 | func nx_img_canvas_page(img: *Image, scale: i64, out: *u8, cap: i64) -> i64 |
| 84 | func rollout(x0: i64, V: i64, acts: *i64, traj: *i64) -> i64 |
| 90 | func max_traj_err(a: *i64, b: *i64) -> i64 |
| 96 | func main() -> i64 |