This project is an implementation of Conway's Game of Life, a cellular automaton simulation. The program uses OpenGL for rendering and GLFW for window management, providing a visually interactive experience.
- Random Grid Generation: Generate random initial states for the grid.
- Next Generation Calculation: Simulate the evolution of the grid based on Conway's rules.
- Optimized Rendering: Efficient rendering of the grid using OpenGL.
- Camera Controls: Navigate the simulation using keyboard inputs.
- Zoom Functionality: Adjust the zoom level for better visualization.
- Draw Custom Grid : Use mouse to modify the state of cells
- Adjustable Generation Speed and Target FPS
To build and run this project, you need the following:
- C Compiler: GCC or any compatible compiler.
- CMake: Version 3.31 or higher.
- Dependencies:
- GLFW (Static library
glfw.aincluded for windows in theexternalsfolder) - OpenGL
- GLAD (Included in the
externalsfolder)
- GLFW (Static library
-
Clone the repository:
git clone https://github.com/yourusername/game_of_life.git cd game_of_life -
Build the project using CMake:
cmake -S . -B build cmake --build build -
Run the executable:
cd build ./gameOfLife.exe
- Ensure you have Emscripten installed and configured.
- Compile the project with Emscripten:
emcmake cmake -S . -B build -G Ninja emmake Ninja -C build # Alternative cmake --build build
- Run the WebAssembly application:
emrun --no_browser --port 8080 build/gameOfLife.html # for the GPU accelerated version emrun --no_browser --port 8080 build/gpu_gol.html - Open your web browser and navigate to
http://localhost:8080/gameOfLife.html.
- Keyboard:
W/S: Move up/down.A/D: Move left/right.UP/DOWN: Increase/decrease grid update speed.
- Mouse Scroll: Zoom in/out.
game_of_life.c: Main source code for the simulation (CPU version) uses OpenGL for renderrin.gpu_gol.c: GPU accelerated version uses OpenGL/Raylib, GLSL shadersweb_gol.c: Web version uses Raylib for renderingexternals/: Contains external dependencies likeglfw.aandglad.c.CMakeLists.txt: Build configuration file.README.md: Project documentation.
- GLFW: For window management and OpenGL context creation.
- GLAD: For OpenGL function loading.
- Conway's Game of Life: Inspiration for the simulation.
Feel free to contribute to this project by submitting issues or pull requests!