Skip to content

Minimalist top-down-shooter prototype written from scratch using C++ and SDL2

Notifications You must be signed in to change notification settings

mfloriani/SDL_BSM

Repository files navigation

Top Down Shooter

It is a minimalist top-down-shooter game prototype. The goal is to eliminate all the enemies without been seen by them.

Tech

Gameplay video

Gameplay Video

Level Design

To design the levels I used a tool named Tiled to define the following objects:

  • Walls
  • Player initial position
  • Enemies initial position
  • Enemies patrol route

Then when the level was ready, I exported as a .lua file to be loaded and parsed by the game.

Below a level design inside Tiled:

[Level Design]

Then the same level loaded in the game (in debug mode)

[Debug Mode]

In blue the walls used by the line of sight (LOS) system. In green the box colliders. In purple the enemy patrol route. In red the direction and field of view (FOV).

Pathfinding

To move the enemies through the level I used the A* algorithm to navigate on a navgraph. The navgraph is created based on level data loaded from the .lua file.

Below a sample of the level with the navgraph highlighted in light blue:

[Navgraph]

Finite State Machine and Steering Behaviors

To define the enemies' actions I implemented an FSM with the following states:

  • Global (a special state that is always executed)
  • Idle
  • Patrol
  • Chase
  • Attack
  • Dying
  • Dead

Then to move the enemies based on the action set to the FSM I implemented some steering behaviors:

  • seek
  • arrive
  • follow path
  • wall avoidance (not used yet)

Messaging

The game objects communicate with each other using a messaging system.

About

Minimalist top-down-shooter prototype written from scratch using C++ and SDL2

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published