Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Mine Action #49

Open
ColterTucker opened this issue Apr 2, 2015 · 0 comments
Open

User Mine Action #49

ColterTucker opened this issue Apr 2, 2015 · 0 comments

Comments

@ColterTucker
Copy link

Colter Tucker & Cameron Edwards

         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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant