Skip to content

Real-time configurable 3D implementation of Conway's Game of Life written in JavaScript using Three.js

Notifications You must be signed in to change notification settings

marianpekar/game-of-life-threejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conway's Game of Life 3D

A 3D implementation of Conway's Game of Life written in JavaScript using Three.js and dat-gui.

It's configurable with a real-time response! (Yes, you can change rules while the simulation is running)

Give it a try 🚀 https://marianpekar.github.io/game-of-life-threejs/

Conway's Game of Life 3D

GUI Manual

In the top-right corner is a beautiful dat-gui (some people say it's ugly, I disagree with that) with contains these folders: Cursor, World, Cells Appearance (folded), Simulation, and Rules. Let's take a closer look at them.

Cursor

Here you can set XYZ position of the cursor (red half-transparent cube initially in the middle of the world) and toggle selected cell between dead and alive state.

You can also use the Randomize NBRs feature, to randomly switch states of 26 cells that surround the cursor with Probability you can set above the Randomize button.

World

Here you can Clear the world (kill all cells), toggle visibility of world border lines and Save As.../Open... world state.

Cells Appearance

It's initially folded. When you unfold it, you can switch cells material between Normal and Phong material (Show Normal checkbox), set it's Opacity and Color (the color is, of course, see only when Show Normal is off).

Simulation

Here comes the fun part! This allows you to Run the simulation with the given Speed (1 = one step per second) or you can step manually with the Step button.

Rules

And last but not least, the rules! But don't worry, these rules are not here to bother you, in fact, you can have a lot of fun with them!

  • Any live cell with a count of neighbors <= Underpopulation dies.
  • Any live cell with a count of neighbors >= Overpopulation dies.
  • Any dead cell with a count of neighbors == Ideal becomes a live cell.

If this sounds cryptic for you, check out the links below, the whole thing is actually very simple, yet so beautiful!

Learn about Conway's Game of Life

Keyboard & Mouse Controlls

You can use a mouse to move around and keyboard to perform some actions too.

Mouse

  • LMB + Move –⁠ rotate view
  • MMB + Move or Scroll –⁠ zoom in/out
  • RMB + Move –⁠ move on a horizontal plane

Keyboard

  • Enter – next step
  • W, S, A, D – move cursor forward, backward, left, and right respectively
  • Q, E – move cursor up and down respectively
  • R – move cursor to the center of the world
  • Space – toggle cell state at the position of cursor
  • Delete – clear the world
  • V – toggle cursor visibility
  • G - toggle GUI visibility

About

Real-time configurable 3D implementation of Conway's Game of Life written in JavaScript using Three.js

Topics

Resources

Stars

Watchers

Forks