SFML Engine


SFML Implementation of a Backend-Agnostic Engine Architecture

SFML Engine Backend provides a concrete implementation of the abstractions defined by Engine Interface. Rather than exposing SFML directly throughout an application, it encapsulates the library behind a consistent set of interfaces, allowing application code to remain independent of any specific multimedia framework.

Developed alongside Engine Interface, the project demonstrates how dependency inversion and modular design can be applied to create a reusable backend that can be replaced or extended without affecting higher-level systems.


The Engineering Problem

While Engine Interface establishes a backend-independent architecture, applications still require concrete implementations for rendering, input, audio, resource management and windowing. Direct integration with SFML would introduce framework dependencies throughout the application, reducing portability and making future backend changes significantly more difficult.

The challenge was to provide a complete implementation of the interface layer while preserving the architectural separation between application logic and external libraries.

My Role

I designed and implemented the complete SFML backend, developing the concrete implementations for the Engine Interface contracts, encapsulating SFML behind reusable abstractions and organising the backend into cohesive modular systems that integrate seamlessly with the wider engine architecture.

The project demonstrates practical software implementation of an interface-driven architecture, with an emphasis on dependency inversion, backend abstraction and maintainable engineering practices.

Architecture Overview

Engine SFML Backend mirrors the architecture defined by Engine Interface by providing concrete implementations for each service while maintaining strict separation between backend code and application logic.

Each subsystem focuses on a specific responsibility and communicates through the interface layer, ensuring that applications remain independent of SFML while benefiting from its rendering and multimedia capabilities.

Core Framework

The backend is organised into three focused areas that translate the Engine Interface contracts into concrete SFML implementations. Each area groups related responsibilities while keeping framework-specific functionality isolated from application code.

Rendering & Windowing

Implements rendering, window management, cameras and drawable objects through the Engine Interface contracts. These systems translate backend-independent rendering requests into SFML operations while keeping framework-specific graphics functionality isolated from the app.

Resources & Media

Implements textures, fonts, shaders, sound and music services through the Engine Interface contracts. These systems manage resource loading, ownership and lifetime while keeping framework-specific multimedia functionality isolated from application code across application systems.

Input & World Systems

Implements input translation, collision grids and tile-based world components through the Engine Interface contracts. These systems support interaction, spatial management and gameplay functionality while keeping framework-specific behaviour isolated from application code safely.

Together, these systems provide the concrete services required by higher-level applications while preserving the separation between application logic and the underlying multimedia framework.

Engineering Principles

PrincipleApplication
Dependency InversionApplications depend on Engine Interface abstractions rather than SFML implementations.
Backend EncapsulationSFML is isolated entirely within the backend implementation.
ModularityRendering, resources, input and world systems are implemented as independent services.
Single Responsibility
Each implementation focuses on one interface and one responsibility.
ReusabilityThe backend can be reused across multiple projects implementing Engine Interface.
Maintainability
Backend services can be extended or replaced without impacting application code.

Key Design Decisions

One-to-One Implementations

Each Engine Interface contract is implemented by a dedicated SFML class, maintaining clear responsibility boundaries and ensuring consistent behaviour across backend services.

Framework Encapsulation

All SFML-specific types and functionality remain contained within the backend, preventing framework dependencies from propagating into application or engine code.

Modular Backend Systems

Rendering, resources, input and world systems are organised into cohesive subsystems, improving maintainability while supporting independent development and future extension.

Shared Architecture

Engine Interface is integrated as a Git submodule, ensuring implementation consistency while allowing the interface layer and backend to evolve together without duplication.

Technologies

Development

C++ 20

Visual Studio 2022

Git

Git Submodules

Engineering Approach

Interface-Driven Architecture

RAII

Dependency Inversion

Backend Abstraction

Resource encapsulation

Modular Architecture

Layered Architecture

Contract-Based Design

Engineering Outcome

Engine SFML Backend demonstrates how a modern C++ application can utilise a third-party multimedia framework without becoming tightly coupled to it. By implementing the contracts defined by Engine Interface, the project provides a reusable backend that supports clean architecture, modular development and future extensibility while serving as the foundation for higher-level applications such as Pong.

Repository

Explore the source code to see how the architectural principles are implemented throughout the framework.

Engineering Review

Read the accompanying architecture review for a detailed discussion of the design decisions, implementation strategy and engineering trade-offs behind the project.