A Snake game using SDL3 + Vulkan 1.3 + CMake, featuring:
- Fire shader (FBM noise, additive blending) bursts at the food position when the snake eats
- Soft drop shadows under every snake segment and the food
- Smooth snake taper — head is bright lime, tail fades to dark green
- Pulsing food circle with specular highlight and glow ring
- Zero vertex buffers — geometry is generated directly in the vertex shader
| Tool | Min version |
|---|---|
| CMake | 3.20 |
| C++ compiler | C++17 (GCC 11, Clang 14, MSVC 2022) |
| Vulkan SDK | 1.3.x — includes glslc |
| GPU driver | Vulkan 1.3 with dynamicRendering + synchronization2 |
Install the Vulkan SDK from https://vulkan.lunarg.com/ and make sure
glslc is on your PATH (or set VULKAN_SDK env variable).
All C++ dependencies (SDL3, fmt, vk-bootstrap, VulkanMemoryAllocator, glm)
are fetched automatically by CMake via FetchContent — no manual installs.
git clone <this-repo>
cd snake-vulkan
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
cd /build
./SnakeVulkan # Linux / macOS
cd build\Release #Windows
.\SnakeVulkan.exe # Windowscmake -B build-dbg -DCMAKE_BUILD_TYPE=Debug
cmake --build build-dbg
cd ./build-dbg
./SnakeVulkan| Key | Action |
|---|---|
W / ↑ |
Up |
S / ↓ |
Down |
A / ← |
Left |
D / → |
Right |
R |
Restart |
Esc |
Quit |
snake-vulkan/
├── CMakeLists.txt
├── shaders/
│ ├── quad.vert GLSL vertex — generates a quad from vertex index
│ └── quad.frag GLSL fragment — 4 modes: solid / fire / shadow / circle
└── src/
├── Types.hpp PushConstants, DrawMode, palette constants
├── Game.hpp / .cpp Pure game logic (no Vulkan)
├── VulkanContext.hpp / .cpp
│ Instance · physical device · logical device · swapchain
│ (vk-bootstrap) · VMA allocator · frame sync objects
├── Renderer.hpp / .cpp
│ Two pipelines (alpha-blend / additive) · draw calls ·
│ NDC coordinate helpers · dynamic rendering (VK 1.3)
└── main.cpp SDL3 window · event loop · game + renderer glue