SDL for 2d game engine development?

Hello everyone!! I’ve been doing lots of thinking and research on 2d game engine built by individuals on reddit and github(maybe not game engine, but rather a game without an existing engine). I actually like the idea of building my very own 2d game engine with popular libraries such as SDL, but kind of feel of discouragement because there are some who may have not use this library to develop a 2d game engine. So, to anyone who reads this post, did you make your very own 2d game engine with this library? SDL seems to be a very great choice when it comes to certain projects such as emulators and games.

I use SDL to create games (not engines). I have created a simple car racing game and I’m working on an adventure game with text-parser input (similar to the old Sierra adventure games).

I’ve never really considered using a game engine. Using an engine would remove a lot of the fun for me. I like programming and I find it easier to motivate myself to work on the programming parts. Creating all the graphics, sound, dialog, etc. is the tedious part (even though I want to do it).

I’m also afraid that using an engine would make my game look like other games and that it would restrict what I could do. It’s more interesting when things are created from scratch.


Wow so you use sdl for everything? Including 2d rendering with sprites?

Yes, I have created my own Sprite class.

You can use SDL for literally anything that requires 2D and 3D rendering (SDL, SDL_image), audio playback (SDL_mixer), or network communication (SDL_net). These can be games, but also various tools — after all, SDL is a multimedia library, not a game engine.

I know sdl is not a game engine. But im just saying, that sdl can be used for developing a 2d game engine(or maybe just a 2d renderer with sprites) and just not bother with libraries like glfw or even glad

I forgot to answer the original question. :wink:

Yeah, I did Fairtris — sources are open. I still play it from time to time.

Now I’m working on a larger action-adventure game (retro style, pixel art, pseudo 3D), but this time it involves a lot of code, so first I create a separate engine and the necessary tools (some editors), and only when they are ready, I make the actual game. For now in SDL2, but when the stable SDL3 appears, I will switch to it.

SDL sits in the same place in the stack that GLFW would. It handles window creation, input, etc., all the stuff GLFW does. It also gives you a hardware-accelerated 2D renderer if you want it, audio recording and playback, threading and thread synchronization, file abstraction, etc etc etc

If you’re gonna use OpenGL directly (as opposed to via the 2D renderer), I’d recommend using SDL+glad.

Thats what i was thinking! Sdl is alot like glfw but it has the upper hand. Like having a metal renderer for example. But i guess I wasn’t too sure about that because im a bit concern that i had to use another library to achieve what im trying to do.

Just looked into your github and keeping it retro!!
But as for your 3d project, will you be using sdl? Im using sdl(probably) because its has more features than glfw or glad. Pretty much using sdl for all my upcoming 2d projects(or 2d game engine)

Of course. This library implements everything needed for the engine to run, i.e. window, input, hardware rendering, and sound mixer support. Rendering of the game world will be based mainly on my own implementation, due to the specificity of the engine (a multi-threaded raytracer running on the CPU), but everything else will be rendered using textures, on the GPU side. And then post-processed, when SDL will support its own shaders (I have a time to wait).

The only dependency I use is SDL — I don’t use any other libraries, I implement everything myself to avoid unnecessary abstractions and licensing problems. SDL2 has almost everything I need, and when SDL3 comes out, then I will have all the functionality I need. SDL is simply amazing, I love it. If there was no SDL, I would probably use the allegro library, because it is more or less the same shelf.

SDL is used by EyeLink to render (usually time critical) eye-tracking experiments. I am writing an experiment using SDL (GitHub - cpicanco/stimulus-control-sdl2: A teaching machine for free behavioral experiments) and I found it great. It is usually very consistent, have a great community, and is well documented. An “experiment” engine would be well received by me. I am writing some blueprints and I hope to have enough time in the near future to write the engine I want.

Will you be using sdl for your rendering as well?

I am using it for rendering.

Well… take a look
→ there are 2 3D graphic engines in the world:
DirectX and OpenGl.

All this Programms …unreal, unity and so on
Use one of this engines.

You can include via SDL2 the OpenGL stuff.
for Mobile Devices you need OpenGL-ES !!!
(today its “Vulcane”)

But its very hard and not the same.

:grin:i need an 3d obj loader and Surface loader
… i experiment 5 years with it but it kills me ^^

For 2d: you need only c/c++ SDL2

works on android with “c4droid compiler” and sdl2_plugin too. → later you can save as real apk

you can find c4droid only via google with playstore link, but you cant find it in playstore … i dont know why

DirectX and OpenGL are just libraries for rendering! unity and unreal uses those for the engine. also, i’ll just be using for window, input, and 2d rendering(for animations, im using a very special 2d animation software to render animation, and turns out it supports sdl so i already implemented this into my 2d engine with the help of sdl!). Also i’ll be using box2d


i need an 3d obj loader

see raylib

I’m making a game with SDL and I love it.
Evaluate your alternatives. SDL is not that great for games. There are tons of features which could exist but don’t. Other packages are slightly less powerful and much, much better for making games. Check out love2D or libcinder. Stuff like that is probably more what you’re looking for. Unless you’re making a pixel-art game and you love to spend hours coding when you just don’t have to, you probably want to use a codebase/body of work more specifically tailored to your needs.