Skip to content

Minecraft clone from scratch with only modern OpenGL

Notifications You must be signed in to change notification settings

GianlucaP106/minecraft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minecraft from scratch

A Minecraft clone from scratch with only modern OpenGL. No game engines or frameworks.

demo2
demo1 demo3
demo6 demo4
demo5 demo7
demo8 demo9
Screen.Recording.2024-12-27.at.11.20.54.PM.copy.mp4

Features

  • Infinite and procedurally generated terrain using Perlin noise
  • Physics engine with collision detection
  • Day/night cycle
  • Dynamic lighting
  • Block placement and destruction
  • Tree generation
  • Basic cave systems
  • Dynamic chunk loading/unloading based on player position
  • Simple culling techniques for rendering optimization
  • Simple inventory system
  • Flying mode

Installation

# clone
git clone https://github.com/GianlucaP106/minecraft minecraft && cd minecraft

# run game (requires go)
go run .

Controls

  • WASD - Movement
  • Space - Jump
  • F - Toggle flying mode
  • Mouse - Look around
  • Left Click - Break block
  • Right Click - Place block
  • 1-9 - Select inventory slot

Technical Highlights

Graphics

  • Written in OpenGL 4.1
  • Custom shader programs for blocks, UI elements, and effects
  • View frustum culling for performance optimization

World Generation

  • Multi-octave Perlin noise for terrain generation
  • Biome system affecting terrain height and features
  • Procedural cave system generation
  • Dynamic tree placement based on biome

Physics

  • Custom physics engine
  • Rigid body dynamics
  • Custom collision detection and response
  • Jump mechanics

Architecture

architecture

The game is built with a component-based architecture, with key systems including:

  • World: (chunk loading, block updates)
  • World Generator: (noise, terrain, tree, biome)
  • Physics engine and Rigid Body (collision, movement)
  • Player, Camera and Ray
  • Chunk and Block

Dependencies

  • github.com/go-gl/gl/v4.1-core/gl
  • github.com/go-gl/glfw/v3.3/glfw
  • github.com/go-gl/mathgl/mgl32

About

Minecraft clone from scratch with only modern OpenGL

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published