You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Overview
It has come to our attention that no user action input has been made as of yet. We would like to create a player input that would "mine" the materials from the world and add them to inventory. An action from the user would be registered (aka. a key action listener) that would trigger the "mining" action. The action would be conducted on the closest block of material. A function that would take into account material hp remaining and material durability would be implemented. And when the materials hp goes to 0 the block would be removed from the world map and added to inventory.cpp.
Finding the nearest block to mine would consist of a constant-time function that returns all blocks within a small sphere of the player. Basically, given a radius r (probably 1 or 2), get all blocks with x, y, and z positions within +/- r of the player's location. Out of this list of nearby blocks, we will use a form of raycast based on the camera's angle to find the one block the player is looking at. This voxel will be passed by reference into the mine function to be mined upon.
Runtime
Runtime for this action would be conducted in constant time. The search algorithm to find the closest block will be O(r^3), where r is constant. Gathering user input and conducting the mine function don't depend on input size, so the final runtime is O(1).
The text was updated successfully, but these errors were encountered:
Colter Tucker & Cameron Edwards
The text was updated successfully, but these errors were encountered: