跳到正文
网页珍奇柜Web Curio

Lenia:连续的生命游戏

Lenia,Bert Wang-Chak Chan,2018 年

正在布展…

原作直展:这是 Bert Wang-Chak Chan 的原始作品,按 MIT(附带的 KaTeX 也是 MIT) 许可证收录(版本 adfc542)。原作的 JavaScript 版本原样展出,公式渲染库换成随附副本。左侧是正在演化的「生命体」,右侧目录里可以换成几百种已发现的物种。 许可证全文 · 收录说明

它是怎么做的

  1. 第 1 步世界是一张实数场(0~1),而不是二值格子
  2. 第 2 步每一步用环形核(多个同心环的光滑凸起)对场做卷积,得到“邻居势”
  3. 第 3 步增长函数是以 μ 为中心、宽 σ 的高斯:势在合适范围内则增长,否则衰减
  4. 第 4 步以小时间步 dt 累加增长并裁剪到 [0,1]
  5. 第 5 步内置物种库提供预设参数和初始图案,可旋转、缩放后放入世界

复刻配方

一段技术配方,可以直接交给 AI 编程助手,也可以自己照着写。想指定技术栈、位置和性能预算,就把它加入实现方案。

Store the world as a float grid with values in [0,1]. Build a kernel of radius R as one or more smooth concentric rings (for example a bump exp(4 - 1/(r(1-r))) over normalised radius) and normalise it to sum to one. Each step, convolve the world with the kernel (FFT or a GPU shader), apply the growth function G(u) = 2*exp(-((u-μ)²)/(2σ²)) - 1, add dt times that to the world and clamp. Start from catalogued patterns with their μ, σ and R, and colour the field with a perceptual colormap.

档案

能不能拿来用

原作以 MIT 许可开源:可以阅读源码学习,按许可证条款使用;在自己的项目里引用时保留原作者署名。

性能开销

视觉强度

实现难度

尺度为策展判断(1 到 5),用于比较和推荐。

核实记录:Opened https://chakazul.github.io/Lenia/JavaScript/Lenia.html (200, title 'Lenia'); repo Chakazul/Lenia exists, licence MIT via GitHub API; JavaScript/ folder contains Lenia.html and Lenia-LifeForms.js.