cs381/as5/README.md

2.2 KiB

Building and Running

Clone the repository, navigate to the root of the project, and initialize the submodules:

git clone https://github.com/humanoidsandvichdispenser/cs381.git
cd cs381
git submodule update --init --recursive

Navigate to the as5 directory, create a build directory, and run CMake to generate the build files:

cd as5
mkdir -p build
cd build
cmake ..

Compile the code using make:

make

This should create an executable named as5 in the build directory. You can run the executable with the following command:

./as5

Instructions on how to use the program

If the selected entity is a penguin, hold W and S to accelerate it forward and backward. Use A and D to change heading direction.

Use TAB to switch between entities. The currently selected entity will be drawn with a bounding box.

Readme Question

Having a bool stored per object to dictate whether or not to draw the bounding box could be storage inefficient as it requires an additional byte per object. This is less apparent when using a component-based architecture (although might not be the best solution), as the visibility component is only added to entities that need it (you can compose it down further by having a component specifically for bounding boxes). In the monolithic architecture, this would require every entity to have this. In the ad-hoc architecture, it is simply not scalable as it requires tracking multiple booleans and requires a lot of branching logic to determine which entities should have bounding boxes drawn.

Calculating whether or not to draw the bounding box in the rendering system can be more efficient, especially in a monolithic architecture. This does not require additional storage per entity, and can be done by simply checking if the entity is the currently selected entity. This can however cause a lot of branching logic in the rendering system.

Splitting bounding box drawing into a separate system can be more efficient in terms of computation and storage. However, it is harder to maintain, since if you want to modify how a bounded model is drawn, you would have to modify the draw calls in multiple places.

Extra Credit

The camera follows the currently selected entity using similar.