Animated pixel art in Golly

For discussion of other cellular automata.
Post Reply
User avatar
_zM
Posts: 186
Joined: June 26th, 2016, 3:07 pm

Animated pixel art in Golly

Post by _zM » June 11th, 2019, 5:25 pm

Quite trippy.
Quite trippy.
587648208755228687.gif (43.79 KiB) Viewed 3149 times
A few weeks ago, I had the idea of creating a rule that would allow for the creation of animated pixel art within Golly. The main idea of the rule is to use a 2x2 square of cells in Golly to represent one pixel, with all four pixels sharing the same display colour. In order to be able to cycle through multiple colours, each cell also holds a second colour; these are cycled through the cells with one being displayed at any given time.

This system allows for pixels with a maximum period of 5, with lower periods also supported. As explained before, each cell holds one colour alongside the display colour, which is shared among all four cells in the pixel; additionally each cell stores whether it is the top left cell in the pixel or not (this information is necessary for pixels to have, as it allows them to deduce which pixel they belong to). Also, ther are extra "filler" states which do not store a second colour. These let one choose the desired period of the pixel. In total, there are therefore 2n²+n states for n colours; the maximum number of colours that can therefore be used in a Golly implementation is 11, with 253 states in total.

But how do you use such a rule for creating animated pixel art? Let's assume you want to recreate these four example patterns, which simply display a number counting up from 1 to 5, 4, 3 and 2 respectively:

Code: Select all

x = 74, y = 18, rule = AnimatedPixelArt
pJuOpJuOpJuOpJuOpJuOpJuOpJuO6.pJBpJBpJBpJBpJBpJBpJB6.pJBpJBpJBpJBpJBpJ
BpJB6.pJBpJBpJBpJBpJBpJBpJB$uPuQuPuQuPuQuPuQuPuQuPuQuPuQ6.uPuQuPuQuPuQ
uPuQuPuQuPuQuPuQ6.uPBuPBuPBuPBuPBuPBuPB6.14B$pJuOKtLKtLKtLKtLKtLpJuO
6.pJBK.K.K.K.K.pJB6.pJBK.K.K.K.K.pJB6.pJBK.K.K.K.K.pJB$uPuQ10tLuPuQ6.
uPuQ10tLuPuQ6.uPBtL.tL.tL.tL.tL.uPB6.2B10.2B$pJuOKtLOtVpXvGOtVKtLpJuO
6.pJBK.O.pXCO.K.pJB6.pJBK.O.pXCO.K.pJB6.pJBK.O.pXCO.K.pJB$uPuQ2tLtTtU
vEu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BpJB$uPuQuPuQuPuQuPuQuPuQuPuQuPuQ6.
uPuQuPuQuPuQuPuQuPuQuPuQuPuQ6.uPBuPBuPBuPBuPBuPBuPB6.14B!
Let's start with the leftmost pattern, which has a period of 5. In order to create pixel art with this rule, it is a good idea to prepare a grid which already includes the basic structure of the pixels, as this will drastically simplify editing later on. For a pattern with period 5, we need a 2x22 pattern with a state 11 cell in the top left corner and state 132 cells in the other three corners. This corresponds to a period 5 cell which always displays the base colour, a dark shade of blue.

Code: Select all

x = 2, y = 2, rule = AnimatedPixelArt
KtL$2tL!
In order to create our canvas to draw on, we now need to figure out how large we want it to be. This can be adjusted later if it turns out to be too large or too small, but as we know how large our pattern is we can get it right first try. As our pattern has a size of 7x9, we need a total space of 14x18, or an area twice as large on both axes as our piece of pixel art. Copy the pattern above, select an area of size 14x18 and using the script tile-with-clip.lua tile the selected area with the pattern.

Next up, we need to enter the colours that we want to be present in each frame on each pixel. The rule has some very handy properties to simplify this process, and allows you to fill all frames one by one simply by changing the top left cell to one with the desired colour stored in it. Be careful however to only change the top left cell, and always change it to another top left cell! As a useful guide, the top left cell always features a white dot in the middle, while the other three corner cells feature a plus shape. The safest bet is to always use cells with state 11-21 for this.

After filling in all top left cells, the result should look something like this:

Code: Select all

x = 14, y = 18, rule = AnimatedPixelArt
MtLMtLMtLMtLMtLMtLMtL$14tL$MtLKtLKtLKtLKtLKtLMtL$14tL$MtLKtLKtLNtLKtL
KtLMtL$14tL$MtLKtLNtLNtLKtLKtLMtL$14tL$MtLKtLKtLNtLKtLKtLMtL$14tL$MtL
KtLKtLNtLKtLKtLMtL$14tL$MtLKtLNtLNtLNtLKtLMtL$14tL$MtLKtLKtLKtLKtLKtL
MtL$14tL$MtLMtLMtLMtLMtLMtLMtL$14tL!
Next, step forward through time once. You should now be able to see this:

Code: Select all

x = 14, y = 18, rule = AnimatedPixelArt
pIuJpIuJpIuJpIuJpIuJpIuJpIuJ$14uJ$pIuJKtLKtLKtLKtLKtLpIuJ$2uJ10tL2uJ$
pIuJKtLKtLpTuUKtLKtLpIuJ$2uJ4tL2uU4tL2uJ$pIuJKtLpTuUpTuUKtLKtLpIuJ$2uJ
2tL4uU4tL2uJ$pIuJKtLKtLpTuUKtLKtLpIuJ$2uJ4tL2uU4tL2uJ$pIuJKtLKtLpTuUK
tLKtLpIuJ$2uJ4tL2uU4tL2uJ$pIuJKtLpTuUpTuUpTuUKtLpIuJ$2uJ2tL6uU2tL2uJ$
pIuJKtLKtLKtLKtLKtLpIuJ$2uJ10tL2uJ$pIuJpIuJpIuJpIuJpIuJpIuJpIuJ$14uJ!
If you zoom out now, you can see the 1 in its full glory even from afar.

Next up, entering the second frame is as easy as the first. As the top left cell's display colour isn't actually used to store any information, we can now enter all pixels the same way as before using cells with state 11-21. If we now advance again, we are able to see something quite interesting.

Code: Select all

x = 14, y = 18, rule = AnimatedPixelArt
VuAVuAVuAVuAVuAVuAVuA$14tW$VuAKtLKtLKtLKtLKtLVuA$2tW10tL2tW$VuAKtLqGvH
qGvKqGvHKtLVuA$2tW2tL6vH2tL2tW$VuAKtLKtOKtOqGvHKtLVuA$2tW6tL2vH2tL2tW
$VuAKtLqGvHqGvKqGvHKtLVuA$2tW2tL6vH2tL2tW$VuAKtLqGvHKtOKtLKtLVuA$2tW
2tL2vH6tL2tW$VuAKtLqGvKqGvKqGvKKtLVuA$2tW2tL6vH2tL2tW$VuAKtLKtLKtLKtL
KtLVuA$2tW10tL2tW$VuAVuAVuAVuAVuAVuAVuA$14tW!
The colour information for the first frame is now stored in the top right cell of each pixel. This is how the rule works, as was explained above. It will advance through the other four cells before being displayed again, followed by the other frames.

We can now ener the remaining frames, resulting in this final pattern.

Code: Select all

x = 14, y = 18, rule = AnimatedPixelArt
qTwBqTwBqTwBqTwBqTwBqTwBqTwB$vTwAvTwAvTwAvTwAvTwAvTwAvTwA$qTwBKtLKtLK
tLKtLKtLqTwB$vTwA10tLvTwA$qTwBKtLtAyKtDyBtAyKKtLqTwB$vTwA2tLyFyJyFyJyF
yJ2tLvTwA$qTwBKtLtDyKNtLKtUKtLqTwB$vTwA2tL2yB2tLtPtT2tLvTwA$qTwBKtLtA
yKtDyKtAyKKtLqTwB$vTwA2tLyFyJyFyJyFyJ2tLvTwA$qTwBKtLKtLNtLtAyKKtLqTwB
$vTwA2tLtP3tLyByJ2tLvTwA$qTwBKtLtDyBtDyBtDyKKtLqTwB$vTwA2tLyFyJyFyJyF
yJ2tLvTwA$qTwBKtLKtLKtLKtLKtLqTwB$vTwA10tLvTwA$qTwBqTwBqTwBqTwBqTwBqT
wBqTwB$vTwAvTwAvTwAvTwAvTwAvTwAvTwA!
Always remember to advance after completing each frame.

The pattern with period 4 is made in a very similar manner to that with period 5, but the base pixel structure is slightly different. Instead of having a state 132 cell in the top right corner, we use a state 0 cell instead. This is one of the "filler cells" from above, which doesn't store a frame of its own.

Code: Select all

x = 2, y = 2, rule = AnimatedPixelArt
K$2tL!
Tiling this pixel results in this:

Code: Select all

x = 14, y = 18, rule = AnimatedPixelArt
K.K.K.K.K.K.K$14tL$K.K.K.K.K.K.K$14tL$K.K.K.K.K.K.K$14tL$K.K.K.K.K.K.
K$14tL$K.K.K.K.K.K.K$14tL$K.K.K.K.K.K.K$14tL$K.K.K.K.K.K.K$14tL$K.K.K
.K.K.K.K$14tL$K.K.K.K.K.K.K$14tL!
And adding in the four frames in this.

Code: Select all

x = 14, y = 18, rule = AnimatedPixelArt
rRGrRGrRGrRGrRGrRGrRG$wRwWwRwWwRwWwRwWwRwWwRwWwRwW$rRGK.K.K.K.K.rRG$wR
wW10tLwRwW$rRGK.sNIN.sNIK.rRG$wRwW2tLxSxWtPtTxSxW2tLwRwW$rRGK.sQIN.sN
IK.rRG$wRwW2tL2xO2tLxSxW2tLwRwW$rRGK.sNIsQIsNIK.rRG$wRwW2tLxSxWxSxWxS
xW2tLwRwW$rRGK.K.N.sNIK.rRG$wRwW2tLtP3tLxOxW2tLwRwW$rRGK.N.N.sQIK.rRG
$wRwW2tLtPtTtPtTxSxW2tLwRwW$rRGK.K.K.K.K.rRG$wRwW10tLwRwW$rRGrRGrRGrR
GrRGrRGrRG$wRwWwRwWwRwWwRwWwRwWwRwWwRwW!
Next up, the period 3 pixel, with the bottom right pixel also replaced:

Code: Select all

x = 2, y = 2, rule = AnimatedPixelArt
K$tL!
This is why it is important to use tile-with-clip.lua and not tile.lua! tile.lua gives us this incorrect tiling, as the two state 0 cells on the right side throw it off:

Code: Select all

x = 14, y = 18, rule = AnimatedPixelArt
14K$14tL$14K$14tL$14K$14tL$14K$14tL$14K$14tL$14K$14tL$14K$14tL$14K$
14tL$14K$14tL!
tile-with-clip.lua gives the correct result, which looks like this:

Code: Select all

x = 14, y = 18, rule = AnimatedPixelArt
K.K.K.K.K.K.K$tL.tL.tL.tL.tL.tL.tL$K.K.K.K.K.K.K$tL.tL.tL.tL.tL.tL.tL
$K.K.K.K.K.K.K$tL.tL.tL.tL.tL.tL.tL$K.K.K.K.K.K.K$tL.tL.tL.tL.tL.tL.tL
$K.K.K.K.K.K.K$tL.tL.tL.tL.tL.tL.tL$K.K.K.K.K.K.K$tL.tL.tL.tL.tL.tL.tL
$K.K.K.K.K.K.K$tL.tL.tL.tL.tL.tL.tL$K.K.K.K.K.K.K$tL.tL.tL.tL.tL.tL.tL
$K.K.K.K.K.K.K$tL.tL.tL.tL.tL.tL.tL!
Filled in:

Code: Select all

x = 14, y = 18, rule = AnimatedPixelArt
rGFrGFrGFrGFrGFrGFrGF$wGFwGFwGFwGFwGFwGFwGF$rGFK.K.K.K.K.rGF$wGFtL.tL
.tL.tL.tL.wGF$rGFK.sCHsFHsCHK.rGF$wGFtL.xHHxHHxHHtL.wGF$rGFK.N.N.sCHK
.rGF$wGFtL.tL.tL.xHHtL.wGF$rGFK.sCHsFHsCHK.rGF$wGFtL.xHHxHHxHHtL.wGF$
rGFK.K.N.sCHK.rGF$wGFtL.tP.tL.xDHtL.wGF$rGFK.sFHsFHsFHK.rGF$wGFtL.xHH
xHHxHHtL.wGF$rGFK.K.K.K.K.rGF$wGFtL.tL.tL.tL.tL.wGF$rGFrGFrGFrGFrGFrG
FrGF$wGFwGFwGFwGFwGFwGFwGF!
And, to wrap it up, the final result for period 2:

Code: Select all

x = 14, y = 18, rule = AnimatedPixelArt
XAXAXAXAXAXAXA$14A$XAK.K.K.K.K.XA$2A10.2A$XAK.qGDqJDqGDK.XA$2A2.6D2.
2A$XAK.N.N.qGDK.XA$2A6.2D2.2A$XAK.qGDqJDqGDK.XA$2A2.6D2.2A$XAK.qGDN.K
.K.XA$2A2.2D6.2A$XAK.qJDqJDqJDK.XA$2A2.6D2.2A$XAK.K.K.K.K.XA$2A10.2A$
XAXAXAXAXAXAXA$14A!
Finally, some credits at the end: the palette used by the rule was created by SpeedyCube for the PixelJoint 11 Color Competition: http://pixeljoint.com/forum/forum_posts ... 344#211344

Waiting to see what you can come up with.
Attachments
AnimatedPixelArt.rule
(87.65 KiB) Downloaded 205 times
moment

User avatar
jimmyChen2013
Posts: 184
Joined: December 11th, 2017, 3:28 am

Re: Animated pixel art in Golly

Post by jimmyChen2013 » June 11th, 2019, 9:36 pm

Not anything constructive here, but

this is awesome

Code: Select all

x = 8, y = 13, rule = B3aeiqr4-aijn5c6cei7/S2cn3-ajr4ceiqt5eijkq6-a7c8
2bo$b3o$5o$b5o$2b5o$3b5o$2b5o$b5o$5o$4o$3o$2o$o!

User avatar
Saka
Posts: 3627
Joined: June 19th, 2015, 8:50 pm
Location: Indonesia
Contact:

Re: Animated pixel art in Golly

Post by Saka » June 12th, 2019, 8:51 am

2 more examples because why not
dancing stickman

Code: Select all

x = 14, y = 26, rule = AnimatedPixelArt
KtLKtLWtXWtXWtXKtLKtL$4tL6tX4tL$KtLWtXKtLKtLKtLWtXKtL$2tL2tX6tL2tX2tL
$KtLWtXKtLKtLKtLWtXKtL$2tL2tX6tL2tX2tL$KtLWtXKtLKtLKtLWtXKtL$2tL2tX6tL
2tX2tL$KtLKtLWtXWtXWtXKtLKtL$tM3tL6tX4tL$LtMKtLKtLWtXKtLKtLKtL$tL3tM
2tL2tX6tL$VtWWtXWtXWtXWtXWtXVtW$4tW6tX4tW$KtLKtLKtLWtXKtLKtLLtM$6tL2tX
2tL2tMtLtM$KtLKtLKtLWtXKtLKtLKtL$6tL2tX4tLtMtL$KtLKtLKtLWtXKtLKtLKtL$
6tL2tX6tL$KtLKtLWtXKtLWtXKtLKtL$4tL2tX2tL2tX4tL$KtLWtXKtLKtLKtLWtXKtL
$2tL2tW2tM2tL2tM2tW2tL$VtWLtMKtLKtLKtLLtMVtW$2tWtL2tM3tLtM2tLtM2tW!
I dont know

Code: Select all

x = 10, y = 10, rule = AnimatedPixelArt
KtLKtLpIuJNtPKtL$3tLtVuMuJ4tL$KtPKtLqEvGKtLNtL$4tLvAvBtOtV2tL$pIuJqEvG
KtLqEvGpIuJ$2uJvAvB2tLvAvB2uJ$NtLKtLqEvGKtLKtP$2tLtOtVvAvB4tL$KtLNtPpI
uJKtLKtL$4tLuMuJtLtV2tL!

User avatar
PkmnQ
Posts: 1137
Joined: September 24th, 2018, 6:35 am
Location: Server antipode

Re: Animated pixel art in Golly

Post by PkmnQ » June 14th, 2019, 7:51 am

Of course, I would start with a life pattern. (Mold)

Code: Select all

x = 12, y = 12, rule = AnimatedPixelArt
4.P.qREqWE$4.2tL3vSvX$4.qREqREqREP$4.vS4vXvS2tQ$2.qWE2.qREqWEK$2.2vX
2.vXvSvXvStQtL$qWE2.qWE2.P.K$2vX2.2vX2.tQ2tLtQ$qWE4.qWE$2vX4.2vX$2.qW
EqWE$2.4vX!

Post Reply