Skip to content

Latest commit

 

History

History
292 lines (210 loc) · 10.2 KB

README.md

File metadata and controls

292 lines (210 loc) · 10.2 KB

License: GPL v3 Language Release

Support Server

3d

3d

Sandbox game developed using C++ 14 & OpenGL 3.3 🕹

Why Buy Minecraft When You Can Code it Yourself? 💹


Compiling

Supports Windows and Linux. (Should work on MacOS but not tested)

Dependencies

  1. SDL2
  2. SFML
  3. GLEW
  4. GLM
  5. Freetype

App

Use cmake with the flags BUILD_TARGET=<client|server> and CMAKE_BUILD_TYPE=<Debug|Release>. Default is client / Release.

Run in build directory: cd <Client|Server>/App/<Debug|Release> && ./MonCraft

WASM

  • Install and activate emscripten.
  • Use the following commands, but replace stuff in <> with appropriate:
  • mkdir build && cd build
  • emcmake cmake -DBUILD_TARGET=client -DCMAKE_BUILD_TYPE=<Debug|Release> -DBUILD_PLATFORM=wasm ..
  • make -j<N>
  • emrun --no_browser --serve_after_close --serve_root Client/Wasm/<Debug|Release>/ Client/Wasm/<Debug|Release>/MonCraft.html

Contribute

✔ Please do refer to CONTRIBUTING.md file.


World Interactions

  1. Moving Around --- WASD
  2. Look Around --- Move Mouse
  3. Detach Mouse --- Esc
  4. Block Placing --- RMB
  5. Selective Block Removal --- LMB
  6. Select Block --- Taget Block & Press Mouse Wheel Button
  7. Sprinting --- CTRL
  8. Filed of View (FOV) changes while sprinting ✅
  9. Chang View --- F5
  10. God Mode --- Double Space
  11. Ascend (In God Mode Only) --- Space
  12. Descend (In God Mode Only) --- Shift
  13. Crouch -- Coming Soon!
  14. Place on Edge -- Coming Soon!

Features 🔥

Solid Integration

MonCraft supports optimizations on both AMD and NVIDIA cards

✅ Nvidia extern "C" { _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;}

http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf

✅ AMD __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;


Frsutrum Culling


Shadow Engine 🌑

MonCraft has a fully fledged shadow engine that makes the terrain look more beautiful and crisp. Shadows also give the terrain some realism and highlight its features.

shadows


3D Fog

Fog is very popular element in computer graphics, so popular that in fact we are always introduced to it early in textbooks or tutorials. However these textbooks, tutorials and even APIs only go as far as a simple distance based color blending, and stop there. Even advanced demos, interactive applications and games go no further that the simple color blending. -- Inigo Quilez.

But Not MonCraft. We implements fog in a way even OG Minecraft failed to do. The fog implementation augments the terrain features like depth and curve it also quickly helps us understand the distances and therefore scale of objects, and the world itself.

The fog density depends on the direction of the sun, and the amount of global illumination in the area. The areas with less lighting have a more dense fog.

Same place, different direction :

fog

How does it work❓

       float sunAmount = max( dot(vec3(m_view), lightDirection), 0.0 );
       vec3  fogColor  = mix( vec3(0.5,0.6,0.7), // bluish
                              vec3(1.0,0.9,0.7), // yellowish
                              pow(sunAmount,8.0) );

Fractal Brownian Motion also makes the fog depend on the day/night cycle.

Fog moving :

shadows

But Wait There's More 💣

Fractal Brownian Motion was also implemented to give fog some procedurally generated animation.

fbm

$$f(p) = fbm( p + fbm( p + fbm( p ) ) )$$

This gives fog a crisp realistic effect.

Ambient Occlusion 🌗

Ambient occlusion is a shading and rendering method used for global background or indirect shading of objects. This method is used to add more realism to the render because it creates soft global shadows that contribute to the visual separation of objects. This is a global method, i.e., the brightness value of every point of the object depends on other objects in the scene. Shadows do not remain black, they dissipate, creating halftones and obscuring those places in space that get less light.

aoc


Beautiful Terrain

High Definition texture pack 🎨

Unique artistic textures with vivid colors. Made-In-House by the one & only @PinoulMarcel Mojang don't DMCA us.

world

Procedurally Generated World 🌐

Simplex Noise under src/noise/noise.cpp is used to create the world map. It's finely tuned to give different terrain heights and features, such as hills, mountains and oceans.

noise

Superb Terrain Blending 🌲

src/noise/voronoi.cpp is used for a seamless biome blending ⚡

vor

Biomes 🌍

Seven unique biomes with different features and characteristics.


Dynamic Blocks


Wide Texture Atlas 🧭


SkyBox 🌌

High Definition skybox using cubemaps.


Transparency 🔎

Moncraft implements transparent blocks such as Water_Block & Leaf_Block and more are to come!

How does it work ❓

Before each frame draw, we compute the position of the chunks in the camera space. that way, we can:

  • check that they are visible in the frustum -> only render visible chunks
  • compute their z-distance to the camera.

That way, we can sort the chunks back-to-front to render them in that order. The sort has a cost of nlogn : it would not be possible to sort each block ! but because blocks are grouped in chunks, and there are about 1000 chunks loaded at a time, the cost is not too high. inside each chunk, there is only one mesh. the EBO of the mesh is constructed that way :

  1. First, the solid blocks which require no sorting as long as they are rendered first
  2. Then, the transparent faces in ±x direction, then n ±y direction, then in ±z direction. those faces are stored from negative to positive (more or less)
  3. Finally, the same transparent faces as before, but in reverse order.

That way, we render first solid blocks, then transparent blocks in the direction we are looking at, back to front (choosing if we draw using the normal or reverse indices).


3D Chunks

It might look like a bug but it's definetly a feature.

3d


Eargasmic Music 🎶

Royalty-free high definition music that fits the game's atmosphere. 🥚

Track Name Artist ©
A New Sleep Arden Forest
Mays Van Sandano
Reconstruct Amaranth Cove
Minecraft Happy Music

Sound Effects

Literal bovine excrement 🙂 💘Memory leaks


Normal Map


Multithreading 👷‍♂️

Allows for huge performance gains by using multiple worker_threads to generate the environment. Under src/terrain/terrain.hpp.

Uses worker threads to generate chunks and precompute the opengl data. Because opengl is single-threaded, the vbos need to be created on the main thread. The workers do as much work as possible to make the task easier for the poor main thread. This allows for huge performance upgrades and a better playing experience as chunks are generated in a faster and a seamless way. We are proud to say that our game is well optimized so far, on medium budget cards the engine can easily output over 200fps (the fps counter is accessed by pressing the F key to pay respect)


No OS Specific dependencies 🐧


3D AABB Collision detection 💥


Player and World Animations

Block Breaking ⛏

3d

Player Movement Animations

wood

Water Surface Animation

We made a custom normal map in blender and used the fact that blocks are aligned with the x/y/z axis to our advantage : we didn’t need to send the tangent and bitangent, we could guess them from the faces alignment. We haven’t found an effective way to calculate reflection as the water is not a plane but a block that can be placed anywhere in the world. So we couldn’t calculate a reflection on each block without raytrace light. We only calculate specular light on water blocks, so in order to differentiate it from a mesh, we put the alpha component to 0 for the other normals.

water


The Team Behid MonCraft

Name GitHub Email
Brossier Mathis @k2d222 [email protected]
Mahmoud Houssem @OopsOverflow [email protected]
Surer Pierre @PignoulMarcel [email protected]

Refrences