GitXplorerGitXplorer
g

myncraft

public
6 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
8645c33aa0cffef01fd31c96502ee8b49fd3a8e7

removed fog

ggbrls committed 4 years ago
Unverified
088e23da5264825c4eede72bf9fc953bd6a3ed1f

makefile and readme fixes

ggbrls committed 4 years ago
Unverified
845fdccf10c8bd5c8efd077b69d9c8df80d1e9de

Added blue fog

ggbrls committed 4 years ago
Unverified
f09bedbdd2d4a7727151aba3da964c232edf4e5c

Merge remote-tracking branch 'origin/master' into master

ggbrls committed 4 years ago
Unverified
71da9a98c70402e660636eb608a17cca83814188

code formatation.

ggbrls committed 4 years ago
Verified
9f4d653b9b98cf4abff80d25b5f176b8cb76f365

updated readme

ggbrls committed 4 years ago

README

The README file for this repository.

Running

Dependencies

  • GLEW
  • SDL2
  • glm

For debian based distributions they are: libglew-dev libsdl2-dev libsdl2-ttf-dev libglm-dev

Make sure you have SDL2 development libraries installed and then run the command bellow.
git clone "https://github.com/gbrls/myncraft/" && cd myncraft && make all

Game as of now

How's the game now?

Features

  • Cool texures :)
  • Infinite world.
  • Cool player controls and a debug mode.
  • Trees!

Missing features

  • Loading chunks from disk.
  • Collision.
  • Water and other biomes.
  • Clouds.
  • the Sun & the Moon.
  • Simulated voxel shadows.

How's the game implemented?

Working

  • Chunck's meshes are generated from all the visible faces, hidden faces are not in the mesh.
    • It was initially a DFS that visited all visible faces, but it led to stack overflows.
    • Now, it is a refractored version of the DFS into a BFS.
  • Terrain generation is deterministic: With the same seed you'll always get the exact same world.
    • This is implemented by using a perlin noise generator for everything, the terrain height and the tree generation.
    • The result of Perlin(x,y) is used as a seed to the tree generation algorithm.
  • Block's faces have normals.
    • The normals are stored in the vertex data (in the mesh) as a sigle float, then it's transformed into a vector by the shader.
  • Chunck's meshes are calculated in asynchronous calls.
    • Maybe it wasn't a good idea because it affects the main thread, in which the main game loop is running.
    • They are now calculated in a single thread (different from the main).

Kinda/Not Working (Issues)

  • Tree leaves are constrained by it's chunk, you can see that some trees have their leaves sliced.
  • The meshing algorithm does not take into account chunk to chunk occlusion, every chunk has it's outter shell meshed.
  • Camera coords to Chunk coords algorithm is not working properly.
  • A async call to each chunk being genereted leads to a little lag to the main thread when a new chunk is generated.

Progress

I usually write my code by expanding upon smaller functional iterations, so it's easy to document.

  • Day 0 (OpenGL "Hello World")

  • Day 1 (Minecraft "Hello Cube")

  • Day 2.
    During this day I worked mostly on camera controls and projections, so the graphics didn't really changed.

  • Day 3.
    I worked on mesh generation with a DFS to mesh only the visible faces.

  • Day 4
    I changed the project structure a little bit and started messing around with terrain generation.


    Efficient mesh generation, but it's worse than greedy meshing.

  • Day 5
    I implemented a texture array, instead of a single texture.
    A simple pause was implemented in order to take screenshots.
    A simple tree generation algorithm was implemented, currently the trees cannot occupy multiple chunks, this is a problem.