Recreation of Minecraft with C++ and OpenGL
This project was done with a team of three students for the computer graphics course CIS 560. I was responsible for rendering, texturing, terrain generation, animation, and "Redstone" systems.
Rendering
Block rendering was done using an OpenGL Lambert shading scheme.
Positions, image textures, and normals of each block face to be rendered were compiled into an interleaved VBO (vertex buffer object) and sent to the shader on the GPU.
Implemented an algorithm to make this process more efficient by dividing terrain into "chunks" of 16 x 256 x 16 blocks and only rendering visible faces on outside edges of chunks.
Texturing
In order to render blocks with proper visual imagery, I took images from a minecraft texture atlas (i.e. grass, stone, water) and passed corresponding texture uv coordinates to the shader.
Terrain Generation
We did not want memory to be overloaded with storing the entire generated terrain, so I implemented an algorithm to only generate terrain chunks when the player was proximate. Chunks that were far away from the player's position were correspondingly removed from memory.
Animation
Water and Lava blocks were animated through an algorithm which quickly cycled through multiple image textures over time.
Redstone Systems
Redstone in Minecraft is analagous to electricity. Redstone systems contain three components: switches, wire, and torches.
If wire connects a torch to a switch which is turned on, the torch will light up. After creating in-game objects for each of these three components, I added functionality that let a player place these items at will and a backend which kept track of item placement with a graph data structure.
Torches were determined to be connected to switches if a depth-first search of the connectivity graph yielded a path.