RTS Game Basics in SDL with 3D

Hi Every Body :wave:
I wish to learn SDL to develop an RTS Game with 3D units and buildings (Like Tiberian Sun or Red Alert 2). I look for an advice is it possible to do in SDL, If yes where to look for a starter or example project for study and what learning paths should I take. I am good at developing in ObjectPascal (I own Delphi 10 Seattle) and I have managed to get header translation for SDL in pascal from GitHub. I have also visited Free Pascal meets SDL but it does not contain anything fancy except dead basics. Any help will be appreciated.

For 3D graphics, SDL only gets you as far as opening a window with an OpenGL context (It also supports Vulcan, now.) It doesn’t actually contain code for loading or handling 3D graphics on it’s own. You have to do all that yourself. If you really want to do everything from scratch, you could begin by doing some tutorials on OpenGL, for example this one:


If you’re a beginner to 3D graphics, this could be a long and hard road, and it might be a few years before you’re really ready to make an RTS game. If you’re really serious about learning to to program 3D graphics, it’s not a bad way to go, but you’d basically be writing an entire engine from scratch.

Perhaps the better, shorter, answer is, NO, it doesn’t really do what it sounds like you’re looking for. If your main interest is in making an RTS game, you might be better off using an existing Game Engine, and learning the low level details of Game Engine design later on.

Incidentally, there are a few engines that are built on top of SDL. Some are listed on this page:

I hope that helps to clarify what SDL does. Good luck with your game programming adventures :slight_smile:

I think Tiberian Sun and Red Alert 2 aren’t 3D graphics games though, they’re both ‘isometric’ games, so they use 2D graphics to give a slight illusion of 3D-ness and so SDL is perfect for that.

I’m working on an isometric game myself at the moment, see https://www.youtube.com/watch?v=IYyC472tqbY and I’ll be using SDL when I port it to Android and Windows - as I do with all my games!

@SeanOConnor - Quite Right! Thanks for pointing that out. I saw the word “3D” and assumed @KhuchKhana wanted to use SDL for realtime 3D graphics. SDL does indeed include a relatively easy to use, built in 2D renderer. It’s pretty simple, and is actually a very good fit for isometric / tile based rendering. I use it myself, and like it a lot, for its simplicity. I enjoy this “blitting” style of rendering for 2D and isometric style games.
In that case, I’d say SDL2 could be quite a good fit for making an isometric RTS.

SDL2 is not a full game engine, but it’s an excellent platform on which to make one (especially if you want it to be cross-platform). With the built-in 2D api you can get up and running very quickly, and start working on your game logic, rather than having to build a full renderer first.

I wrote a wrapper for the 2D API, so that it would be possible to swap out the renderer with a custom one if i decided I wanted better performance or more advanced rendering capabilities (eg shaders, etc). That means that most of my game code doesn’t directly use the SDL APIs, although they resemble them quite closely.

1 Like