This repo contains my Udacity Capstone project, called ArkNix, it is a mix between Galaga and Space Invaders.
I selected the Capstone Option 1 and I made a Video game.
demo.mp4
- Move across menu and player with
arrow keys
- Use
Escape
key to go back to Main Menu - Fire with
Ctrl-Left
orCtrl-Right
keys - Use
Enter
Key to select options
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
In order to clone this project, be sure to use the --recurse-submodules flag.
git clone --recurse-submodules https://github.com/BennyFranco/CppND-Capstone-Galaga.git
The project includes the following submodules:
- SDL2
- SDL2_Image
- SDL2_Mixer
- SDL2_ttf
- yaml-cpp
- CMake >= 3.20
- Instructions here
- gcc/g++ >= 7.4.0
- In Ubuntu, you could install build-essential with
sudo apt install build-essential
command.
- In Ubuntu, you could install build-essential with
- Install Visual Studio 2022
- Ensure you install the c++ support. Check this post about C++ development with vstudio.
- This project was NOT tested with MinGW in Windows.
- Xcode command line tools
Follow the next steps to compile this project:
- Create a folder called
build
:
mkdir build && cd build
- To compile a debug version, run the following cmake config command:
cmake .. -DCMAKE_BUILD_TYPE=Debug
- Build the project with:
cmake --build .
The executable will be placed inside build directory, run it with the following command:
./ArkNix
In some Ubuntu versions, I had issues creating the window and the renderer of SDL2, if the game shows the following error in the console:
[SDLRenderer] Window cannot be created. Error: No available video device
[SDLRenderer] Renderer cannot be created. Error: Parameter 'window' is invalid
you will need to install xorg-dev
with the following command:
sudo apt-get install xorg-dev
you can find more information about this in the following link.
In some Ubuntu versions, I had issues initializing the audio with SDL_mixer, if the game shows the following message in the console:
[SDLAudio] Cannot be initialized. Error: dsp: No such audio device
Please, install libasound2-dev
and libpulse-dev
with the following command:
sudo apt-get install libasound2-dev libpulse-dev
more information about this issue in this link.
Root folders description
Folder | Description |
---|---|
assets | all stuff as images, sounds, fonts, etc. goes here. |
config | currently only scenes order setup is here |
docs | documentation stuff |
engine | it has base elements as audio, base components, main game loop, asset manager, etc. |
game | game specific components and game start point. |
scenes | scenes files in yaml |
thirdparty | all project submodules goes here. |
The following diagram is a representation of the most important elements of the engine, these are designed to be generic.
The following diagram shows the most important elements of the game, this components are designed in an specific way for this game.
- The project demonstrates an understanding of C++ functions and control structures.
- A variety of control structures are used in the project: Yes, and some examples in code
can be found in the following classes and lines of code <classname:line_number>:
- Asset reading in: asset_manager.cpp:29
- Update Loop pattern in game.cpp:47
- Collision Test in collision_detector.cpp:35
- The project code is clearly organized into functions: Yes any component in the project is organized as a class
Check the following classes as examples:
- game.cpp
- game_object.cpp
- sprite_component.cpp
- A variety of control structures are used in the project: Yes, and some examples in code
can be found in the following classes and lines of code <classname:line_number>:
- The project reads data from a file and process the data, or the program writes data to a file.
- Yes, the game reads scenes from
yaml
files, all scenes are saved in the scenes folder and the reader is located in,scene.cpp:95
. I use yaml-cpp library to read this type of files. - Also, the game reads images, sounds, fonts using SDL.
- Yes, the game reads scenes from
- The project accepts user input and processes the input.
- Yes, the game accepts keyboard input, the keys are described above.
- The project uses Object-Oriented Programming techniques.
- Yes, as I mention before, the project is organized in classes, check any component in
Components
folder, for examplesprite_component.cpp
,sound_component.cpp
,text_component.cpp
, etc.
- Yes, as I mention before, the project is organized in classes, check any component in
- Classes use appropriate access specifiers for class members.
- Yes, please check the classes mentioned before, or any other component.
- Classes abstract implementation details from their interfaces.
- Yes, please check any component, they use
component.h
as interface.
- Yes, please check any component, they use
- Classes encapsulate behavior.
- Classes follow an appropriate inheritance hierarchy.
- Overloaded functions allow the same function to operate on different parameters.
- Derived class functions override virtual base class functions.
- Feel free to check components folder inside engine,
engine/components
- Feel free to check components folder inside engine,
- Templates generalize functions in the project.
- Please, check the following class:
asset_manager.h:26
- Please, check the following class:
- The project makes use of references in function declarations.
- Yes, Transform is owned by
GameObject
and it's passed as reference to components to sync positions with its parent. Check any component inengine/components
.
- Yes, Transform is owned by
- The project uses scope / Resource Acquisition Is Initialization (RAII) where appropriate.
- The project follows the Rule of 5.
- All components were created thinking on this last points, feel free to review any of them.
- The project uses move semantics to move data, instead of copying it, where possible.
- Check
bullet_controller.cpp:94
as an example.
- Check
- The project uses smart pointers instead of raw pointers.
- Please check:
transform.h:65
andgame_object.h:60
.
- Please check:
- The project uses multithreading.
- Check
game_object.cpp:104
- Check
- A mutex or lock is used in the project.
- Check
scene.cpp:72
- Check