Unreal Conway Game Of Life Project

Unreal Conway Game Of Life Project Screenshot

During my work on the Unreal Conway Game Of Life Project, I developed a C++ implementation of Conway's Game of Life using Unreal Engine. Below are some of the key achievements:

  • Implemented core Conway's Game of Life algorithm.
  • Developed advanced cell state management for efficient updates.
  • Optimized performance for handling large grids.
  • Created visual representation using Unreal Engine.

Technologies Used
  • Unreal Engine
  • C++
  • GitHub
  • Visual Studio

Challenges and Solutions
  • Challenge: Simulating large grids efficiently.
    Solution: Implemented optimized algorithms for cell state updates.
  • Challenge: Managing complex cell interactions.
    Solution: Developed advanced cell state management techniques.

Project Achievements
  • Successfully simulated Conway's Game of Life with high performance.
  • Used as a teaching tool in computer graphics and AI courses.
  • Praised for clean and efficient code implementation.

Code Snippets

Below is a key code snippet demonstrating the core Conway's Game of Life algorithm implementation from the project:

                           
   #include "ConwayGame.h"
   
   // Update the grid based on Conway's Game of Life rules
   void AConwayGame::UpdateGrid()
   {
         TArray> NewGrid = Grid;
   
         for (int32 Row = 0; Row < Grid.Num(); ++Row)
         {
            for (int32 Col = 0; Col < Grid[Row].Num(); ++Col)
            {
               int32 AliveNeighbors = CountAliveNeighbors(Row, Col);
   
               if (Grid[Row][Col])
               {
                     NewGrid[Row][Col] = AliveNeighbors == 2 || AliveNeighbors == 3;
               }
               else
               {
                     NewGrid[Row][Col] = AliveNeighbors == 3;
               }
            }
         }
   
         Grid = NewGrid;
   }
   
   int32 AConwayGame::CountAliveNeighbors(int32 Row, int32 Col) const
   {
         int32 Count = 0;
         for (int32 i = -1; i <= 1; ++i)
         {
            for (int32 j = -1; j <= 1; ++j)
            {
               if (i == 0 && j == 0) continue;
   
               int32 NeighborRow = Row + i;
               int32 NeighborCol = Col + j;
   
               if (NeighborRow >= 0 && NeighborRow < Grid.Num() &&
                     NeighborCol >= 0 && NeighborCol < Grid[NeighborRow].Num() &&
                     Grid[NeighborRow][NeighborCol])
               {
                     ++Count;
               }
            }
         }
         return Count;
   }
                           
                           

Unreal Conway Game Of Life Project is an innovative simulation project that features the implementation of Conway's Game of Life algorithm to create dynamic cell behaviors in a 3D environment using Unreal Engine 5. The project showcases advanced AI techniques and efficient code structure.


Release Date july 7, 2024
Category Simulation, AI
Connect with me
Khaled Zakaria • Game Developer • Unreal engine Programmer • Instructor • Game Programmer •