runtao0 / runtao0.github.io

A 3D implementation of Conway's Game of Life made with Three.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#Runtao's 3D Game of Life Live: Runtao's Game of Life

##What is it?

My Game of life is a 3D voxel painter and [Conway's Game of Life] (https://en.wikipedia.org/wiki/Conway's_Game_of_Life) simulation. Each cell is a voxel, but the Life2333 rules still apply, with the Z-axis representing time, and each discrete layer being a generation in the game. This game was created with JavaScript using the Three.js library (including raycasting, Detector, and TrackballControls), running on WebGL.

##Features and Implementation

###Initial Pattern Creation

The initial phase of the game prompts to user to create an initial pattern on a 50X50 grid. The user may create voxels by moving the cursor for position and clicking to create the box. The user can also delete boxes while holding down the shift button and clicking existing boxes. Alt text

Furthermore, four preset patterns are available to the user via buttons on the right of the page. These are the Glider Gun, Cross, and Garden of Eden patterns, as well as a random initialization of voxels. Alt text

Adding these patterns will not affect pre-existing voxels created by the user, but will replace previously selected preset patterns. Users can also add more voxels or subtract from preset patterns.

###When Life Begins When the user is satisfied with his/her initial pattern, they may press the start button to begin calculating and rendering generations. Because each successive voxel added slows down the program, the animation is capped at 300 generations. The camera moves in a preset path to follow the growth of the voxels. Alt text

However, the camera can also be manipulated with the three standard mouse buttons. Left click will change the view angle with respect to the beginning level. The middle mouse button can be used to zoom in or out of the view, and the right button can be used to move the view linearly across the screen. Alt text

##Future Directions

###Optimization Currently, each voxel added requires instantiation of a new Three.3DObject and subsequently slows rendering speed of the entire game. I am considering building the voxels as a particle system.

###Toggle Different Colors and Textures Figure out how to efficiently calculate different or unique colors for each voxel.

###Saving Initial Patterns Adding a feature to save initial patterns and results would be cool, when users care enough to make an account.

About

A 3D implementation of Conway's Game of Life made with Three.js

License:Other


Languages

Language:JavaScript 89.8%Language:HTML 5.3%Language:CSS 4.8%