Building Conway’s Game of Life in Go with Raylib
In the last few days, I’ve started learning game development in Go using the Raylib library, which is an easy and simple-to-use library for…
Building Conway’s Game of Life in Go with Raylib
In the last few days, I’ve started learning game development in Go using the Raylib library, which is an easy and simple-to-use library for building games.
I decided to create “Conway’s Game of Life” as my first project with the Raylib library to help me become more familiar with the concepts of game programming.
Why did I choose Conway’s Game of Life as my first project ? Because it’s simple, but it allows me to learn many functionalities of the library.
Conway’s Game of Life

Conway’s Game of Life
What is Conway’s Game of Life ?
It is a kind of cellular automaton created by John Horton Conway in 1970. Each state of the game depends on the initial state, which can be thought of as a seed that generates the entire game. In each step, every cell becomes either alive or dead according to these simple rules.

The four fundamental rules
- If an alive cell has fewer than 2 alive neighbors, it dies. (underpopulation)
- If an alive cell has 2 or 3 alive neighbors, it remains alive. (survival)
- If an alive cell has more than 3 alive neighbors, it dies. (overpopulation)
- If a dead cell has exactly 3 alive neighbors, it becomes alive. (reproduction)
Well-known Patterns
Conway’s Game of Life has many interesting patterns, which can be categorized into four types:

The patterns from Conway’s Game of Life Wikipedia
- Still lifes: patterns that do not change from one generation to the next.
- Oscillators: patterns that return to their original state after a fixed number of generations.
- Spaceships: patterns that move across the grid over time while maintaining their shape.
- Generators: small patterns that evolve to produce other patterns over time
What about my project ?
Now let’s talk about my project. We’ll start with the project structure.
.
├── config
│ └── config.go # Configuration settings for the game
├── game
│ ├── board.go # Logic for managing the board and cell states
│ └── game.go # Main game logic and rendering
└── main.go # Entry point of the application
This is a basic Raylib code snippet of window creation and the game loop:
package main
import (
"go-raylib/config"
rl "github.com/gen2brain/raylib-go/raylib"
)
func main() {
rl.InitWindow(config.WINDOW_WIDTH, config.WINDOW_HEIGHT, config.WINDOW_TITLE)
defer rl.CloseWindow()
rl.SetTargetFPS(config.TARGET_FPS)
for !rl.WindowShouldClose() {
// Game Logic
rl.BeginDrawing()
// Render something.
rl.EndDrawing()
}
}
My game loop steps:
- Check each cell’s alive status using the
isAlivemethod. - Handle mouse event to update the cell’s alive status.
- Draw the board based on the data in
cellsarray.
You can see the full implementation of my code at the link below:
메타데이터
- post_id
- aaf3bc6a6095
- slug
- building-conways-game-of-life-in-go-with-raylib-aaf3bc6a6095
- url
- https://medium.com/@rufflogix/building-conways-game-of-life-in-go-with-raylib-aaf3bc6a6095
- canonical_url
- https://medium.com/@rufflogix/building-conways-game-of-life-in-go-with-raylib-aaf3bc6a6095
- author_url
- https://medium.com/@rufflogix
- status
- ok
- fetched_at
- 2026-07-15 08:28:01