Gold Finder is a top-down 2D tile-based treasure hunt game built using SDL3. The goal is to find hidden gold tiles scattered across the map. You have to successfully complete consecutive levels by locating and collecting all hidden gold pieces on the map before the time runs out.
A screenshots of Gold Finder is shown below.
- Cross-platform compatibility (Linux, Windows, macOS).
- Dynamic camera system with "Screen Edge Panning."
- Distance-based "Hot/Cold" hint system to guide players to the hidden gold.
- Expandable world map.
You control a walking sprite player moving the player to search the map for hidden gold tiles. When you move the player over a hidden gold spot the normal grass tile turns into a gold tile to reveal gold. Collecting gold tiles increases your score.
| Control | Action |
|---|---|
| WASD or Arrow Keys | Move the player sprite. |
| + / - | Zoom In / Zoom Out. |
| R | Reset the game and randomize gold locations. |
| C | Snow On/off. |
| ESC | Exit the game. |
🎅 To give the treasure hunt demo a Christmas-theme you can use the C key to toggle a festive snowfall effect. If you save the current sprite man called player_walk as a different name and then rename player_santa to player_walk you will have Santa as the player when you restart the game.
The game operates on a level-by-level score system that increases in difficulty.
Objective: The goal is to successfully complete consecutive levels by locating and collecting all hidden gold pieces on the map before the time runs out.
Level Advancement: Upon collecting all gold in a level, you receive a score bonus and advance to the next, more difficult level. Each successive level requires collecting more gold and provides less time.
Level Failure: If the timer reaches zero, the game ends, and you must restart from Level 1.
Screenshot with levels 1 and 2 completed are shown below.
Your Total Score accumulates across the levels and is calculated when a level is completed:
- Gold Score: Points awarded for each gold piece collected.
- Time Bonus: A multiplier applied to your remaining time, rewarding quick completion.
- Level Bonus: A flat score awarded for completing the level successfully.
The HUD counter tracks your progress and score after successfully completing a level.
This demo is built using SDL3 (Simple DirectMedia Layer), chosen for its cross-platform portability, efficient rendering and simple event handling.
Pre-built binaries of Gold Finder for x86 Debian/Ubuntu and ARM64 Raspberry Pi computers running the latest RPi OS (Trixie) are available and can be downloaded from the binary directory. To change permissions and run Gold Finder from the terminal use the commands below.
chmod +x gold-finder
./gold-digger
You need to install the SDL3 libraries to run the game using the command below.
sudo apt install libsdl3-dev libsdl3-image-dev libsdl3-ttf-dev
The game assets (player_walk.png, wall_tile.png, grass_tile.png, gold_tile.png, font.ttf) should be located in the same directory as the gold-finder binary.
Gold Finder is a SDL3 2D tile-based game designed to demonstrate basic game development concepts, including camera controls, tile collision and state management. The source code is found in the src directory and is released with a GPL 3.0 license.
The instructions below show how to build and run the game from source using Debian-based distributions including Raspberry Pi 5/500 running the latest RPi OS. The simulator was originally developed and tested on Debian Trixie.
- Install SDL3 Dependencies:
You need the essential build tools and the SDL3 development packages (libsdl3-dev and libsdl3-image-dev, libsdl3-ttf-dev). SDL_Image is required for loading images like PNGs into SDL3 surfaces which are converted into textures. SDL_ttf is required for rendering text using the provided font.ttf.
Update the package list before installing these packages as shown below.
sudo apt update
sudo apt upgrade
sudo apt install build-essential pkg-config
sudo apt install libsdl3-dev libsdl3-image-dev libsdl3-ttf-dev
- Compile the Source:
Navigate to your source directory and use the provided Makefile to build the project. Simply run make at the command line.
make
- Run the Game:
./gold-finder
Make sure the game assets (player_walk.png, wall_tile.png, grass_tile.png, gold_tile.png, font.ttf) are located in the same directory as the binary.
The screenshot below shows Gold Finder running on a Raspberry Pi 500.
To install Gold Finder to the local menu system create .desktop" file and copy this into in the ~/.local/share/applications/ directory. If the applications directory does not exist create it.
A desktop file has a .desktop extension and provides metadata about an application such as its name, icon, command to execute and other properties. A "GoldFinder.desktop" file is shown below for the Raspberry Pi. You need to modify this by using your own user name and directory locations. In this example, the executable path for a Raspberry Pi has the default user name "pi" and the binary executable is "Exec=/home/pi/Software/gold-finder/gold-finder". The Exec variable defines the command to execute when launching an application, in this case, the "gold-finder" binary executable. The Path variable specifies that Gold Finder should use this directory as its working directory where the game assets (e.g. images) should be stored. In a .desktop file, you need to use absolute and full paths.
[Desktop Entry]
Version=0.1.0
Type=Application
Name=Gold Finder
Comment=Treasure Hunt Game for Raspberry Pi OS
Exec=/home/pi/Software/gold-finder/gold-finder
Path=/home/pi/Software/gold-finder
Terminal=false
Categories=Game;
StartupNotify=true
Name[en_GB]=GoldFinder
The easiest way to compile on Windows is by using the MSYS2 environment, which provides a Unix-like command line and the MinGW-w64 GCC compiler.
-
Install MSYS2 (MinGW-w64)
- Download and install from the official MSYS2 website.
- Follow the installation defaults.
-
Install Required Libraries via MSYS2 Terminal
Start the MSYS2 MINGW64 terminal and run the following commands to install the compiler and SDL3 development files. You must first update the package database, then install install GCC (mingw) and SDL3 libraries.
pacman -Syu
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-SDL3 mingw-w64-x86_64-SDL3_image mingw-w64-x86_64-SDL3_ttf
This method should automatically handle the paths and necessary .dll files.
- Compile the Source
In the MSYS2 MINGW64 terminal, navigate to your source folder and compile. Include the necessary libraries (-lSDL3, -lSDL3_image, -lSDL3_ttf) and the math library (-lm).
gcc main.c -o gold-finder.exe -lSDL3 -lSDL3_image -lSDL3_ttf -lm
-
- Run the Game You can run the game directly from the MSYS2 terminal:
./gold-finder.exe
The SDL3 DLLs should automatically be available within the MSYS2 environment. If not make sure SDL3.dll and the other dlls are located with the executable along with the game assets.
Building on macOS requires using the Homebrew package manager.
- Install Homebrew (if not already installed)
Open Terminal and follow the instructions from the Homebrew website.
- Install SDL3 Dependencies Use Homebrew to install the necessary libraries.
brew install sdl3 sdl3_image sdl3_ttf
- Compile the Source
The command uses sdl3-config to automatically find and link the correct headers and libraries installed by Homebrew.
gcc main.c $(sdl3-config --cflags --libs) -lSDL3_image -lSDL3_ttf -lm -o gold-finder
- Run the Game
./gold-finder
Gold finder is released under the terms of the GNU Lesser General Public License version 3.0.
SemVer is used for versioning. The version number has the form 0.0.0 representing major, minor and bug fix changes.
- Alan Crispin Github
Christmas mini project.




