From d47660959918e101fe1e5bf6e5701db02ad77737 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 31 Jan 2017 10:19:48 +1100 Subject: [PATCH] Updated Minecraft Classic lava animation algorithm. (markdown) --- ...craft-Classic-lava-animation-algorithm..md | 35 +++++-------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/Minecraft-Classic-lava-animation-algorithm..md b/Minecraft-Classic-lava-animation-algorithm..md index b1a0976..b4926c8 100644 --- a/Minecraft-Classic-lava-animation-algorithm..md +++ b/Minecraft-Classic-lava-animation-algorithm..md @@ -1,5 +1,5 @@ -From goodlyay's dropbox -``` +_From goodlyay's dropbox_ + Huge thanks to my dad (John Alvarado) for doing most of the work in figuring this out. The algorithm uses a 3-layer cellular automata to simulate a dynamic heated fluid. @@ -14,8 +14,10 @@ The second layer represents the potHeat, The third layer represents the soupHeat. -All of these array values start at 0 when the game starts and are updated every frame. +All of these array values start at 0 when the game starts and are updated every frame +### Lava +--- Each frame, for every position in the lava texture array, it calculates the corresponding values of the soupHeat, potHeat, and flameHeat layers as follows: @@ -51,29 +53,9 @@ After the above arrays are updated, for every pixel in the lava texture, it calc Finally, it converts the red green and blue to bytes and assigns them to the texture - - - - - - - - - - ------------------------------------------------------------------------------ -Water: -This is VERY similar to lava, with a few minor differences. We'll keep the same variable names. - - - -The first layer represents the flameHeat (This can be negative.), -The second layer represents the potHeat, -The third layer represents the soupHeat. - - -All of these array values start at 0 when the game starts and are updated every frame. +### Water +--- Each frame, for every position in the water texture array, it calculates the corresponding values of the soupHeat, potHeat, and flameHeat layers as follows: @@ -104,5 +86,4 @@ After the above arrays are updated, for every pixel in the water texture, it cal float blue = 255 float alpha = 146 + colorHeat^2 * 50 - Finally, it converts the red green and blue to bytes and assigns them to the texture -``` \ No newline at end of file + Finally, it converts the red green and blue to bytes and assigns them to the texture \ No newline at end of file