Hello there. This is the first in a series of posts to document the development of my experimental programming environment, Game Painter.
Game Painter’s interface is entirely graphical. The way you program is by painting canvases to define rules. With this first post, I’m going to be describing some of the various rule forms in Game Painter and their applications.
We’ll start by looking at rule forms that allow us to program cellular automata, such as Conway’s Game of Life. Later, we will move on to talk about constructs that could help us program puzzle games.
This first post will focus on the frontend, but I’m planning to follow it up with a post about the technical considerations of building the backend.
One note before starting: the project is very early in development, so terms and even concepts that I use here are subject to revision.
Some Terminology
Let’s get some basic terminology out of the way, so we can move onto the interesting stuff.
Game Painter runs simulations of cells called levels. Levels can be interactive or completely autonomous. This post will mostly focus on autonomous systems.
Programs define the behavior of levels. Programs are composed of rules. Rules have a lefthand side and a righthand side. Each side of the rule contains some arrangement of cells.
The way Game Painter works is by find and replace. Given a rule, the runtime looks in the level for instances of the lefthand pattern and replaces them with instances of the righthand pattern. Lefthand cells can be wildcards (indicated by the ‘?’), meaning they will match any cell.
Let’s say that we’ve defined the following two rules.
The first rule says that if a black cell is to the immediate left of a white cell, then they will trade places. The second rule says that if a black cell is to the immediate right of a white cell, then they will also trade places.
If we populate a level with some black, white, and gray cells, then run the level with the two rules we made, we’ll see all the black and white cells oscillate back and forth.
Those are all of the basics we need for now, so let’s move onto the focus of this post, which is to discuss the different types of rules in Game Painter.
MultiCell Rules, SingleCell Rules, and Conway’s Game of Life
The rules we saw in the previous example are what I call multicell rules, due to the fact that, in each rule, multiple (two) cells are being changed in the transformation from the left side to the right side.
A restriction on the multicell rule is the singlecell rule, where only one cell can be transformed. When I get the chance to write a follow up on the backend implementation of rules, I’ll spend some time on why this distinction is significant.
Single cell rules are all we need to define Conway’s Game of Life, the most famous example of cellular automata, which gives rise to so many complex and fascinating patterns and is theoretically as powerful as any computer.
Given a 3×3 neighborhood of cells of black and white cells, where black cells are “live” cells and white cells are “dead” cells, four rules define Conway’s Game of Life:

 Reproduction: Any dead cell with exactly 3 live neighbors becomes a live cell.
 Survival: Any live cell with exactly 2 or 3 live neighbors lives.
 Loneliness: any live cell with fewer than 2 live neighbors dies.
 Overpopulation: Any live cell with more than 3 live neighbors dies.
All of these are singlecell rules, because for any application of one of these rules, no more than one cell will change from live to dead or dead to live. But when we run these rules on a whole grid of cells in parallel, we get all the interesting emergent behaviors that characterize the Game of Life.
Rendering the Game of Life
A governing idea of Game Painter is that everything is graphical. So how would we graphically express these 4 rules?
Let’s start with reproduction: “Any dead cell with exactly 3 live neighbors becomes a live cell.”
For example, this is one 3×3 grid where the center cell has 3 live neighbors, and thus it becomes alive.
But there are many such grids (where the center cell has 3 black neighbors) :
In other words, way too many to define manually.
What we need is a way to express these combinations succinctly. My solution is to introduce what I call combinatorial masks.
With combinatorial rules, we can define any subset of cells as a combination, which means any combination of values we write to those cells will be accepted. In the graphic below, the yellow cells are marked as part of a combination.
With this combinatorial mask, the reproduction rule will match any combination of 3 black cells and 5 white cells.
Now we can finally make a onetoone mapping of the Game of Life, as it’s expressed in plain english, to the graphic “language” of Game Painter.
The Game of Life is defined as reproduction,
Survival,
So now we know that we can make “games” like Conway’s Game of Life using Game Painter. But Conway’s Game of Life is really just a game in name only. What about games with players?
What we have now are the tools to create autonomous simulations. To make interactive simulations, we need some way to respond to input.
In Game Painter, rulesets are mapped to different inputs. Thus, when an input is pressed, the associated ruleset is switched on.
In this dummy example, if the right arrow key is pressed, the “move right” rule is activated and our character moves right.
And if the left arrow key is pressed, the “move left” rule is activated and our character moves left.
We’ve swapped out black and white cells for sprites, but logically this example works exactly the same as previous examples.
In Conclusion
There are more rule variations I’d like to cover, specifically “…” rules and generic rules. The former enables more gamelike applications and the latter solves a redundancy problem that occurs when you have many cell types that interact in similar ways, but this post has already gone on too long, so I’ll leave them for another time.
Hopefully, this starts to give you an image of what Game Painter is about. I’m planning to post about the project every week for the next several weeks. So if you’re interested, stay tuned to this blog or follow me @objstothinkwith on Twitter for updates.