Skip to content

Alisa997/echolocation-game

Repository files navigation

EchoHunt

EchoHunt is a sonar-based stealth and exploration game prototype developed in C++.

Instead of traditional lighting or vision, the player navigates a dark environment using echolocation. Sonar pulses reveal enemies, obstacles, and pickups temporarily, forcing the player to rely on sound and memory to survive.

The project focuses on technical systems design, where gameplay emerges from interacting systems such as ray propagation, AI behavior, and resource management.


Gameplay Demo

https://youtu.be/I11oPh5R62g


Features

  • Ray-based sonar / echolocation system
  • Multi-bounce ray reflections for indirect sound propagation
  • Dynamic visibility reveal system
  • Enemy AI with warning → lunge → recovery attack behavior
  • Upgrade-based progression system
  • Energy resource management
  • Modular system-based architecture

Gameplay Overview

The player explores a dark environment where visibility is extremely limited.

Instead of seeing the world directly, the player emits sonar pulses that propagate through the level and temporarily reveal objects.

These pulses can reveal:

  • walls and obstacles
  • enemies
  • pickups

However, sonar pulses also alert nearby enemies, forcing the player to balance between information gathering and stealth.

Gameplay Loop

  1. Navigate using limited visibility
  2. Use sonar pulses to reveal the environment
  3. Avoid or fight enemies
  4. Manage limited energy resources
  5. Survive until the level timer ends
  6. Choose upgrades between levels

Core Technical Systems

Sonar / Echolocation System

The sonar system is the core mechanic of EchoHunt.

When activated, the player emits a sonar pulse that spawns multiple rays radially from the player's position.

Each ray propagates through the level until it reaches a maximum range or collides with an obstacle. When a ray intersects with an enemy, pickup, or wall, the object becomes visible for a short period.

This allows the player to reconstruct the environment through sound rather than vision.


Ray Reflection

Sonar rays can reflect off obstacles instead of stopping immediately.

Reflections are computed using the surface orientation of obstacles, allowing rays to bounce around corners and reveal objects that are not directly visible.

Each ray has:

  • a maximum travel distance
  • a limited number of reflections

This prevents infinite propagation while maintaining performance.


Reveal System

Objects are not permanently visible.

Entities become visible only when:

  • hit by a sonar ray
  • the player moves very close to them

Each object has a visibility value that fades over time, forcing the player to continuously refresh their awareness using sonar.


AI System

Enemies are controlled using a simple state machine.

States include:

  • wandering
  • chasing the player
  • investigating the last known player position
  • attacking

Enemy Attack Pattern

Enemies attack using a three-phase behavior:

  1. Warn phase
    The enemy stops and flashes rapidly, signaling an incoming attack.

  2. Lunge phase
    The enemy dashes toward the player in a fixed direction.

  3. Recovery phase
    The enemy slows down briefly before returning to normal behavior.

This pattern keeps combat readable even in low visibility.


Upgrade System

After completing a level, the player selects one upgrade from three random options.

Possible upgrades include:

  • increased movement speed
  • larger sonar range
  • additional sonar rays
  • faster energy regeneration
  • increased maximum energy
  • healing

Because upgrades are randomized, different runs encourage different playstyles.


Energy System

EchoHunt uses an energy system to limit sonar usage and attacks.

Each sonar pulse and attack consumes energy.
Energy regenerates gradually over time.

This forces the player to use sonar strategically rather than scanning the environment continuously.


Supporting Gameplay Systems

Several additional systems support the core mechanics:

Movement System

Handles player position updates and movement physics.

Input System

Centralizes controller and keyboard input and converts raw input into gameplay actions.

Attack System

Implements close-range combat with energy cost and area damage.

Pickup System

Manages item interactions such as healing and energy restoration.

Spawn System

Controls enemy and pickup spawning while scaling difficulty over time.

Audio System

Provides sound feedback for sonar pulses, combat, pickups, and UI events.

Menu System

Handles main menu navigation and UI rendering.


Project Architecture

EchoHunt is organized using a modular system-based architecture where data, utilities, and gameplay logic are clearly separated.

src/
├─ Game/
│  ├─ Player/
│  │  └─ PlayerController.cpp
│  ├─ Enemies/
│  │  └─ EnemyController.cpp
│  ├─ Systems/
│  │  ├─ SonarSystem.cpp
│  │  └─ UpgradeSystem.cpp
│  ├─ Core/
│  │  └─ GameManager.cpp
│  └─ main.cpp

Responsibilities are separated as follows:

  • Entities store game data
  • Systems implement gameplay logic
  • Helpers provide shared utilities
  • Game loop coordinates game states and flow
  • Levels define environment layout and progression

This architecture makes it easier to add new gameplay systems without modifying existing code.


Build and Run

EchoHunt was developed using the Ubisoft NEXT Contest API and supports Windows and macOS.


Dependencies

Windows


macOS

Install Homebrew:

https://brew.sh/

Then install required packages:

brew install cmake
brew install freeglut
brew install SDL3

About

Sonar-based stealth exploration game prototype built in C++, featuring an echolocation system, ray reflections, AI enemies, and modular gameplay systems.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages