This is my sumbition for udacity capstone project in c++. it's a simple shooter game made with sdl. your goal is to have the highest score possible. my personal best is 62. each time you kill an ennemy. 2 ennemies will spawn
- arrow keys to move and change shooting direction while moving.
- hold space to charge your shot. release space to shoot.
- press r to restart
.
├── assets # folder containing resources
│ ├── fonts #
│ └── texture #
├── cmake # build tools
└── src # src code
├── bot # bot behaviour encapsulation
├── bullet # bullet physics, rendering
├── camera # camera following player
├── collidable # interface ICollidable used for collision detection
├── constants # some game contants, folder and file path...
├── drawable # interface IDrawable used for rendering
├── event_dispatcher #
├── font # wrapper around SDL_font* + some utility method
├── game # class containging all game simulation
├── input # input key definitions
├── main # creating game and running it
├── physics # collision detection betweenn 2 ICollidable
├── player # player behaviour
├── prop_generator # procedural world generation (grass and dirt)
├── prop # simple Drawanle wrapper around a texture
├── renderer # rendering functionalities
├── spawner # bot and bullet spawner using CTRP
├── spritesheet # logic around spritesheets
├── targerable # Itargetable interface used by camera and bots to track player
├── texture # wrapper around SDL_Texture pointer
├── thread_pool # pool of thread executing aynchronous tasks
├── time # time functionalites
└── vec2 # vector with 2 components and some helper functionalites
- cmake >= 3.7
- All OSes: click here for installation instructions
- make >= 4.1 (Linux, Mac), 3.81 (Windows)
- Linux: make is installed by default on most Linux distros
- Mac: install Xcode command line tools to get make
- Windows: Click here for installation instructions
- SDL2 >= 2.0
- All installation instructions can be found here
Note that for Linux, an
apt
orapt-get
installation is preferred to building from source. - gcc/g++ >= 5.4
- Linux: gcc / g++ is installed by default on most Linux distros
- Mac: same deal as make - install Xcode command line tools
- Windows: recommend using MinGW
- Clone this repo.
- Make a build directory in the top level directory:
mkdir build && cd build
- Compile:
cmake .. && make
- Run it:
./game
.
criteria | status | commentary |
---|---|---|
C++ functions and control structures. | ✔️ | |
The project reads data from a file and process the data, or the program writes data to a file. | ✔️ | loading textures and font and rendering it |
The project accepts user input and processes the input. | ✔️ | user input is accesesd through sdl event system then dispatch then processed by player & game class through my own event system |
criteria | status |
---|---|
The project uses Object Oriented Programming techniques. | ✔️ |
Classes use appropriate access specifiers for class members. | ✔️ |
Class constructors utilize member initialization lists. | ✔️ |
Classes abstract implementation details from their interfaces. | ✔️ |
Classes encapsulate behavior. | ✔️ |
Classes follow an appropriate inheritance hierarchy. & Derived class functions override virtual base class functions. | ✔️ |
Overloaded functions allow the same function to operate on different parameters. | ✔️ |
Templates generalize functions in the project. | ✔️ |
criteria | status |
---|---|
The project makes use of references in function declarations. | ✔️ |
The project uses destructors appropriately. | ✔️ |
The project uses scope / Resource Acquisition Is Initialization (RAII) where appropriate. | ✔️ |
The project follows the Rule of 5. | ✔️ |
The project uses move semantics to move data, instead of copying it, where possible. | ✔️ |
The project uses smart pointers instead of raw pointers. | ✔️ |
criteria | status |
---|---|
The project uses multithreading. | ✔️ |
A promise and future is used in the project. | ✔️ |
A mutex or lock is used in the project. | ✔️ |
A condition variable is used in the project. | ✔️ |
multithreading is used for infinite procedural props generation. It's done asynchrounously when the camera reveal space where prop. A procedural world generation task is then pushed to the thread pool managing all thread synchronisation mechanism.
Free assets by penusbmic and ansimuz
The source code is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.