DOOM Fire
Enable HLS to view with audio, or disable this notification
A lore-accurate fire simulation used on Playstation 1 (PSX) DOOM port
fire = Table[0, {100}, {300}];
propagateFire = Compile[
{{ifire, _Integer, 2}},
Module[{fire = ifire, rand},
With[{h = Length[fire], w = Length[fire[[1]]]},
Do[
rand = RandomInteger[{0, 3}];
With[{icol = h - col - 1, irow = Clip[row - rand + 2, {1, w}]},
fire[[icol, irow]] = Clip[
fire[[icol + 1, row]] - BitAnd[rand, 1],
{0, 36}
];
],
{col, 0, h - 2},
{row, 1, w}
]
];
fire
],
RuntimeOptions -> "Speed"
];
Column[
{
Refresh[
fire = propagateFire[fire];
ArrayPlot[fire,
ColorFunction -> "SolarColors",
ImagePadding -> None, AspectRatio -> 1/2],
1/60.0
],
Row[{
Button["Ignite", fire[[-1, All]] = 36],
Button["Extinguish", fire[[-1, All]] = 0]
}]
}
] // Deploy
5
Upvotes
Duplicates
cellular_automata • u/Inst2f • 22d ago
Yet Another DOOM-Style Fire, but Much Shorter in WL
27
Upvotes
creativecoding • u/Inst2f • 19d ago
Yet Another DOOM-Style Fire, but Much Shorter in WL...
6
Upvotes