|
|
||
|---|---|---|
| .. | ||
| generated | ||
| CMakeLists.txt | ||
| CO.cpp | ||
| README.md | ||
| as8.cpp | ||
| component_counter.cpp | ||
| skybox.cpp | ||
| skybox.hpp | ||
README.md
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 as8 directory, create a build directory, and run CMake to
generate the build files:
cd as8
mkdir -p build
cd build
cmake ..
Compile the code using make:
make
This should create an executable named as8 in the build directory. You can
run the executable with the following command:
./as8
Instructions on how to use the program
Hold W and S to accelerate the selected entity forward and backward. Use A and D to change heading direction. This allows you to steer the entity around the environment.
Use TAB to switch between entities. The currently selected entity will be drawn with a bounding box.
When the eagle is selected, press Q and Z to change the pitch, and R and F to change the roll.
Readme Question
One reason ECS outperforms component-oriented is that it allows for better cache locality. The components are stored a continguous array, so that when a loop iterates over the components, they are likely to be in the cache. In contrast, in a component-oriented design, the components may or may not be stored contiguously, so there could be more cache misses which increases the latency of the program.
In addition, another reason is that ECS allows for parallel systems/processing of components. In an ECS design, two disjoint systems can be processed in parallel without locking or risk of race conditions. In a component-oriented design, behaviors are bundled with components rather than being separate systems that access shared state, so it is more difficult to parallelize the processing of components.