Skip to content

shiers/SpaceShooter3D

Repository files navigation

SpaceShooter3D

A top-down 3D space shooter built with Direct3D 11 and C++20, supporting 1–2 players with keyboard and Xbox controller input.

Prerequisites

  • Windows 10 or later
  • Visual Studio 2019 (16.10+) or later with the C++ desktop workload
  • CMake 3.20+
  • Windows 10 SDK (no legacy DirectX SDK required)

Note: The project requires MSVC. MinGW/Clang are not supported due to D3D11 header and COM requirements.

Building

Visual Studio (recommended)

  1. Open the project folder in Visual Studio or CLion with an MSVC toolchain.
  2. CMake will auto-configure, fetching DirectXTK and RapidCheck via FetchContent.
  3. Select Debug or Release and build.

Command line (Developer Command Prompt)

mkdir build && cd build
cmake .. -G "Visual Studio 17 2022"
cmake --build . --config Release

Or with Ninja:

mkdir build && cd build
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release
cmake --build .

The build automatically copies Media/, config/, and shaders/ directories next to the executable.

Running Property Tests

cd build
ctest --output-on-failure

Nine property-based tests (using RapidCheck) validate math, rendering, and input logic.

Running

Launch SpaceShooter3D.exe from the build output directory. The game opens a title screen where you choose 1-player or 2-player mode.

Controls

Title Screen

Action Keyboard Controller
Navigate menu Up / Down arrows Left stick
Confirm selection Enter A button

In-Game - Player 1

Action Keyboard Controller (slot 1)
Move Arrow keys Left stick
Aim / Fire Automatic (fires in movement direction) Right stick

In-Game - Player 2

Action Keyboard Controller (slot 2)
Move W / A / S / D Left stick
Aim / Fire Automatic (fires in movement direction) Right stick

General

Key Action
Escape Quit / Back
F11 Screenshot (saved as ScreenShot1.bmp)

Debug-only (Debug build)

Key Action
F7 Toggle debug camera
F8 Toggle wireframe
F9 Toggle bounding volumes

Configuration

Game settings are read from INI files in the config/ directory:

  • config/game.ini - general game settings
  • config/level.ini - level-specific parameters (speed, lives, etc.)

Project Structure

src/           - C++ source files
include/       - Header files
shaders/       - HLSL vertex and pixel shaders
Media/         - Game assets (meshes, textures, fonts)
config/        - INI configuration files
tests/         - Property-based tests (RapidCheck)
docs/          - Project documentation

Documentation

  • docs/modernisation-2026.md - Detailed account of the D3D11 + C++20 migration (project history, what changed, before/after comparisons)

Technology Stack

Component Technology
Graphics Direct3D 11
Shaders HLSL (compiled at runtime via D3DCompile)
Math DirectXMath (header-only, SIMD)
Mesh loading DirectXTK (Model, SDKMesh/CMO)
Text rendering DirectXTK (SpriteBatch + SpriteFont)
Keyboard input Win32 GetAsyncKeyState
Controller input XInput
C++ standard C++20
Build system CMake 3.20+ with FetchContent
Testing RapidCheck (property-based)

About

A 3D space shooter game built with DirectX and C++

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages