Skip to content

kcccr123/myCraft

 
 

Repository files navigation

myCraft

Minecraft style game built using C++ and OpenGL

Table of Contents
  1. About The Project
  2. Getting Started
  3. Controls
  4. Patch Notes
  5. Contact

About The Project

This is an ongoing personal learning project to help us familiarize ourselves with GPU API's such as OpenGL and continue to further our skill as game developers.

The game is a Minecraft style, procedurally generated voxel sandbox.

Example

Built With

C++ OpenGL

Used Dear ImGui to develop GUI: https://github.com/ocornut/imgui

Getting Started

To try it out for yourself, please download the zip file from the latest github release.

OR

please clone the project and run it in Visual Studio,

OR

please download a zip file of your prefered version from the google drive below: https://drive.google.com/drive/folders/1fvPoZl2YKkkZlZOwAT1dJBEqEvWAMplM?usp=sharing

Extract and run myCraft.exe located in the extracted folder.

Controls

The basic control layout is:

W, A, S, D - Forward, Left, Backwards, Right

SPACEBAR - Jump

ESC - Menu

TAB - Inventory

Left click - Break block

Right click - Place block

Note that the controls are displayed in-game in the menu!

(back to top)

Patch Notes

Update 0.2 [LATEST PATCH]

Basic GUI and Inventory Update!

Added the nessecary core functionality and a proper HUD to make MyCraft feel more like a real game!

Camera

  • Player camera is now locked to follow the cursor, similar to most FPS games.
  • Added a crosshair to represent the center of the screen and the player cursor.

Breaking and Placing Blocks

  • Improved upon from the previous patch, player can now place and break blocks via ray casting using mouse left click and right.
  • Breaking a block adds it to your invetory.
  • To place a block, the player must select a block from their inventory by clicking on a non-empty slot in the inventory interface.
  • The selected block is displayed in the bottom right of the players HUD.
break.mp4

Inventory

  • Added an inventory that can be accessed when player hits TAB. Allows the player to store destroyed blocks.
  • Inventory has 20 slots, which each can hold up to 16 blocks of the same type.
  • Player can select a slot by clicking on the slot.

inventory1

In the future, I plan to add an information section in the inventory that provides valuable information about the item in the currently selected slot.

inventory2

Menu

  • Player can hit ESC to access a basic menu interface.
  • Option to exit the game.
  • Quick access to control scheme guide.

menu

Update 0.1

Release Patch!

Hi! Here is some stuff we added.

Basic Procedural Generation via Simplex Noise

  • Map is generated in chunks, 32 x 32 x 32 blocks in size.
  • The blocks in each chunk are all drawn as one mesh to reduce the number of draw calls sent to the GPU per frame. I started by rendering each block as an individual mesh, and this caused SIGNIFICANT performance issues. By switching to rendering chunks, performance has greatly increased, as we are only sending 9 draw calls, as only 9 chunks are ever loaded at the same time.
run.mp4

General Collision Detection using Swept AABB

  • Initially started with basic AABB for collision detection but could not create smooth 3D collision reactions with so many different possible collision objects in the gamespace.
  • Swept AABB instead calculates the future position of an entity and sees if it collides with any block. If it does, it stops the object just before touching the block. This greatly reduces clipping and allows our reactions to be more seamless.

[EXPERIMENTAL] Block Destruction

  • Player can press P to cast a ray; if the ray finds a block, that block is deleted.
  • Very janky right now, as while the ray casting works well, the way we get the possible blocks for the ray to collide with is by getting all loaded blocks and checking if the ray collides with each one. There is currently no check to see which block the ray should remove in the list of blocks, so it removes the first one it finds in the list. This means it will not necessarily remove the block that the player intends to remove but rather the first block along the ray that it encounters within the list of all blocks. So it could remove a block on the far side of the hill, instead of the block the player is staring at.

(back to top)

Contact

Feel free to contact us at:

@Kevin Chen - kevinz.chen@mail.utoronto.ca
@Joshua Luo - jla818@sfu.ca

(back to top)

About

Minecraft Inspired, 3D Sandbox built with OpenGL and C++.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • C++ 80.3%
  • C 17.2%
  • Objective-C++ 1.4%
  • Objective-C 0.5%
  • Makefile 0.3%
  • Batchfile 0.1%
  • Other 0.2%