Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Why would I choose SFML over SDL2?  (Read 38221 times)

0 Members and 1 Guest are viewing this topic.

solenoid

  • Newbie
  • *
  • Posts: 2
    • View Profile
Why would I choose SFML over SDL2?
« on: December 22, 2020, 09:17:32 pm »
I have novice C++ experience, I have played with SFML before but i hear SDL2 is more cross platform. Is this true? My question is in your opinion; Why I would use SFML over SDL2?

Thak you in advance  :). I am also asking the opposite question on the SDL forums.

Kvaz1r

  • Newbie
  • *
  • Posts: 39
    • View Profile
    • Email
Re: Why would I choose SFML over SDL2?
« Reply #1 on: December 23, 2020, 12:49:58 pm »
I think it would be better if you just give a chance both. But if you have experience with SFML why you want to switch to something else?

SFMLNewGuy

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Re: Why would I choose SFML over SDL2?
« Reply #2 on: December 24, 2020, 02:31:13 am »
Hello,

When I first started to program I went back and forth over SDL and SFML. Multiple times I would decide, "Nah, I like the other better you can do X or Y easier."

You will find a lot of games (industry even) made with SDL and it has been around A LOT longer and has a bigger community. What you will find is SDL feels more like working with C, or at least that's what I felt like to me. It's written in C behind the scenes. I also felt like it gave you a lot more control in certain aspects. It's harder to use for sure. I can't recall exactly what I loved more about it off the top of my head. This might not be a fact, but I believe they are done with it as well and SFML keeps improving and older games become outdated. But because of that, you won't ever have to find the correct version like SFML.

SFML is laid out very nicely using objects and just so simple to work with C++. I've committed to SFML long term, I'm not 100% that was the right move or not, but both are great libraries. A lot of people sure have helped me here including the founders.

Either way, you can complete an awesome 2D game with any of them and I suggest you actually build a small little engine using both. Build the same game even with the different libraries. It seems people will live or die with one or the other.

BOOKS I highly suggest in order:

(SFML)
Beginning C++ Game Programming 2nd Edition:
 (Creates LumberJack game, Pong, Zombie Arena Shooter, 2 player shapes game, space invaders at the end)
SFML Game Development By Example by Raimonday Pupius (easily my favorite) :
 (Bouncing Mushroom, Snake, 2D platformer, Design Patterns, Components, complex GUI System, RPG, Online RPG) it also has a follow-up book called Mastering SFML, which goes into OpenGL and shaders and building a map editor)
SFML Game Development:

 Journey through making a top-down airplane shooter (and multiplayer), and gives you a good idea of the progression on making a complete project and making a cool game engine with some design patterns. Goes through some shaders for the missiles
Procedural Content Generation using C++:
(Teaches A*, Maze Generation, and applying new stuff to a barebone action roguelike engine. It's a really basic game engine though) but explaining A* and randomization was very helpful
SFML Essentials:
(Basic game loop, and running through what SFML offers and show off some animations, shaders, and multiplayer)
C++ Game Development By Example, Siddharh Shekar:
I never finished this book, it's really great for beginners though, and would help anyone. It creates a phone like a side scroller game. It leads into OpenGL later
You will find some amazing YouTube videos and stuff on Udemy as well. Specifically, a guy who made an Action RPG from scratch (200 videos or something).

NOTE: I would NOT recommend SFML Blueprint, at all. I tried many times to give it a chance. Just no.  :-X But if you really must, the first few chapters on asteroids are very nice.

SDL:
Foo's Tutorials: -
Search it up on google, it's a great starting point
The Black Art of Multiplatform Game Programming, Jazon Yamamoto C:
Really awesome SDL book, progresses a game engine, paddle game, tilemaps, scene management, factory design and script,s and finishes with a really cool horizontal side scroller space game.
Game Programming in C++ Creating 3D Games (Game Design), Sanjay Madhav -
 Teaching you some really cool things and does an asteroid project, pathfinding, tiles, and eventually leads into OpenGL from SDL.
SDL Game Development, Shaun Mitchell:
 This was a good book to read when I first started SDL, but I had a lot of trouble with it at the time because stuff was outdated.


solenoid

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Why would I choose SFML over SDL2?
« Reply #3 on: December 24, 2020, 05:24:32 am »
Thank you for the Long response!  Ill will definatly try SDL out and see if a like it.
You will find a lot of games (industry even) made with SDL and it has been around A LOT longer and has a bigger community.
Do you think that SFML is less popular because it is newer?

Stauricus

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
    • A Mafia Graphic Novel
    • Email
Re: Why would I choose SFML over SDL2?
« Reply #4 on: December 24, 2020, 12:59:54 pm »
Do you think that SFML is less popular because it is newer?
yes, and because SDL has a compatibility layer to lots of plataforms, and many times it is the only thing used from the library at all.

but SFML performs greatly in most plataforms also: Linux, Windows, MAC... not forgetting Android, of course.
SFML just seems built in a more modern way, mainly in the memory management point.
Visit my game site (and hopefully help funding it? )
Website | IndieDB

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Why would I choose SFML over SDL2?
« Reply #5 on: January 03, 2021, 11:00:54 pm »
It depends on what you need. Factors to decide can be:
  • Are you going to use the extra platforms that SDL supports?
  • Is there a feature in one or the other library which you must have?
  • You have some experience in SFML, are you willing to re-learn?
  • Is it worth to "downgrade" from C++ to C? It means you will need to do more things by hand, bother with memory management, etc.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Sub

  • Full Member
  • ***
  • Posts: 159
    • View Profile
Re: Why would I choose SFML over SDL2?
« Reply #6 on: January 05, 2021, 10:39:38 pm »
Do you think that SFML is less popular because it is newer?

SFML is definitely less popular. SDL is the industry standard with financial backing from Valve. I think it's likely that SDL (or some descendant fork) will be alive and well decades from now where as SFML's future is more up in the air because it's a smaller volunteer run library. SFML has a pretty active and friendly discord where people are likely to answer your questions, though. If SDL has an active irc or discord community it's news to me. I feel like this forum is also more active than the SDL forum but that's not saying much.

I personally like the API of SFML more (and prefer c++ to c), with the biggest positive over SDL imo is a more complete wrapper over OpenGL, but it's a matter of personal preference here. As for cross platform support, SFML works well on Windows, Linux, and MacOS. Not sure how well it works on ios and android. I think someone has a version of SFML running on the switch but if you're planning on getting something up and running on a console then SDL is certainly a more well traveled path with more documentation and support.
« Last Edit: January 05, 2021, 10:43:35 pm by Sub »