2D Game Engine in C++

sdl

At the start of 2017 I really wanted to make my own 2D strategy game, similar to “FTL” and other indie games. I started by getting to know the SDL (Simple Directmedia Layer) library in C++ by using it in a variety of test projects, before eventually deciding that I wanted to make a simple game engine.

I never did finish this project, but I did get a lot of the core functionality done, like the “level-editor” which is shown above. Here’s how it works in the engine of C++ objects:

Untitled Diagram (1)

Here is a list of functions that my level-editor/game engine can currently do. Almost all of the functionality is done through the manipulation of C++ objects and the SDL library.

  • Supports loading and saving XML files with texture, level layout, and character data
  • Multiple texture files can be used, including sprite animations
  • Camera¬†object allows panning
  • Allows the used to draw a map using textures by generating blocks inside a vector array
  • Blocks have parameters including: light levels, health, object properties, and more…
  • Proper garbage collection of objects, textures, and XML data
  • Blocks can interact with each other (collision detection)

Even though I never made a game using this code, I did manage to teach myself a lot of the C++ programming language. My favorite resources to use were the C++ reference, the Lazyfoo SDL tutorials, and this YouTube video series about how to make a RPG (although I’m not a big fan of the RPG genre).

You can download the source code as part of a Visual Studio 2015 Project here.

Leave a Reply

Your email address will not be published. Required fields are marked *