Jump to content

  • Log In with Google      Sign In   
  • Create Account

Start with SFML or SDL?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
12 replies to this topic

#1 Greemax   Members   -  Reputation: 119

Like
0Likes
Like

Posted 01 July 2012 - 01:56 PM

Hey
I have been programing c++. I would like to start programming games and I heard that SFML and SDL would be good to start and to do great games, but witch one should I use. I also would like to ask for good tutorials for SDL and SFML.
Thanks.

Sponsor:

#2 Cornstalks   Crossbones+   -  Reputation: 6989

Like
5Likes
Like

Posted 01 July 2012 - 02:57 PM

It's not the end of the world if you choose one or the other. You really could pick either one and be just fine. This question gets asked all the time.

So I'll answer it the same as I've always answered it: I'd say go with SFML 2.0. It's great. It's got tutorials written by its author (he's still writing more) (SFML 1.6 tutorials can be used and pretty easily converted to SFML 2.0 while the author is still working on more 2.0 tutorials). SFML is incredibly simple and intuitive to use, I've found, and it's got good forums for support and questions. The main reason I say SFML, however, is that it's written in C++ and you're using C++, so it just feels more intuitive to use. If you used SDL, it's written in C, and mixing C and C++ is just fine if you know what you're doing, but if you're still learning C++ (which I'm assuming you are) you might get some C habits mixed in your C++ habits, which isn't the best way to learn things.

If, at the end of the day, you still can decide, flip a coin. The time you spend debating between one or the other is better spent just learning one.
[ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

#3 Canvas   Members   -  Reputation: 240

Like
1Likes
Like

Posted 01 July 2012 - 05:02 PM

To be honest I started a project with C++ and SDL, was going perfectly until sprite rotation. SDL isnt friendly with sprites to be honest, and as it uses the CPU only and not the GPU it isnt very good to do the rotation on the fly, as it could cause major lag on many machines, If you want to create a quite simple basic game or program I would say go for SDL as it is nearly supported by everything, If you want something that uses the GPU and doesnt cause a huge amount of process to the CPU go for SFML. I converted all my SDL project to SFML in a very short time, and as I have worked with SDL before I feel that SFML is much easier and well...just easier to understand.

Canvas

#4 wolfscaptain   Members   -  Reputation: 200

Like
2Likes
Like

Posted 01 July 2012 - 06:00 PM

SDL 1.3 (now named 2) runs on OpenGL behind the scenes, so it's the same as SFML regarding that.

I'd still go for SFML because it's easier to use, and the things that SDL supports and SFML doesn't (like multiple windows) are generally not needed.

#5 Dragonsoulj   Crossbones+   -  Reputation: 2111

Like
2Likes
Like

Posted 01 July 2012 - 06:40 PM

@wolfscaptain: SFML supports multiple windows.

#6 jbadams   Senior Staff   -  Reputation: 18577

Like
2Likes
Like

Posted 01 July 2012 - 06:54 PM

Lazy Foo's SDL tutorials are very popular if you wanted to go the SDL path.


Both APIs are very capable, and the core functionality is very similar (and as noted above, the latest version of SDL does use hardware rendering like SFML where possible) although you'll probably find that due to it's age there are more add-ons for SDL ('though due to their age some of them may not be currently maintained! Posted Image). Both APIs are very popular and have active and helpful communities. The documentation provided for SFML is fairly detailed and provides plenty of information to get started, but you'll probably find -- again due to the maturity of SDL -- that although SDL doesn't have quite as comprehensive official documentation there are quite a few more third party tutorials, articles and code samples available online; Lazy Foo's tutorials (linked above) are often suggested as a starting point for SDL, whilst SFML beginners simply start with the official documentation.

It mostly comes down to personal preference: I'd recommend taking a look at some of the tutorials and reference materials available for each API and choosing whichever makes more sense and looks like a better style to you.


All that being said, if you would like our suggested preferences, I personally prefer SFML -- I just felt the topic was a bit one-sided thus far and that SDL should also be properly presented as a viable choice, as both are capable APIs that you should be able to learn without undue difficulty. It's worth quickly noting also that due to the similarity of these (and other similar) APIs, if you learn either of them in detail you should find it relatively easy to learn the other at a later stage should you choose to do so.


Hope that's helpful! Posted Image

#7 Spirrwell   Members   -  Reputation: 265

Like
1Likes
Like

Posted 01 July 2012 - 07:31 PM

To be honest I started a project with C++ and SDL, was going perfectly until sprite rotation. SDL isnt friendly with sprites to be honest, and as it uses the CPU only and not the GPU it isnt very good to do the rotation on the fly, as it could cause major lag on many machines, If you want to create a quite simple basic game or program I would say go for SDL as it is nearly supported by everything, If you want something that uses the GPU and doesnt cause a huge amount of process to the CPU go for SFML. I converted all my SDL project to SFML in a very short time, and as I have worked with SDL before I feel that SFML is much easier and well...just easier to understand.

Canvas


Actually, you can mix OpenGL and SDL for hardware acceleration. (Someone correct me if I'm wrong). Basically you would use SDL_opengl.h for SDL's OpenGL functions.

Anyway, for simplicity and moderate portability, go SFML.

For massive portability and moderate difficulty, go SDL.

I haven't really used SFML, I just really found out about it yesterday in fact. It's really simple, or maybe I say that because I've been working with OpenGL and SDL for a while now. I personally strongly recommend SDL, as it's well matured and it has great portability. It's also a great starting point for understanding how some of the behind the scenes magic works. To me, SFML's weakness is its simplicity. That's just my personal opinion, I like being able to see what I'm working with and make it work for what I want it to.

I may not be the best guy to get an opinion from as I did just find out about SFML yesterday, but I did test it and got it to work no problem.

Edited by Spirrwell, 01 July 2012 - 07:32 PM.


#8 radioteeth   Prime Members   -  Reputation: 1052

Like
1Likes
Like

Posted 01 July 2012 - 08:48 PM

There is a C variant of SFML if you dig around on the SFML-dev.org website, so you're not forced into incorporating C++ code into your project if that's your intent.

Edited by radioteeth, 01 July 2012 - 08:49 PM.


#9 jbadams   Senior Staff   -  Reputation: 18577

Like
1Likes
Like

Posted 01 July 2012 - 09:41 PM

There is a C variant of SFML if you dig around on the SFML-dev.org website, so you're not forced into incorporating C++ code into your project if that's your intent.

Pretty unlikely given the OP specifically mentioned C++ and hasn't made mention of C...

#10 Zoomulator   Members   -  Reputation: 273

Like
3Likes
Like

Posted 02 July 2012 - 02:46 AM

I always go for SDL 1.2 with OpenGL for rendering. It's low level compared to most multimedia libraries and once you've done the init code and some basic abstraction over the event system you'll practically never touch SDL in your game again. That's the way I like it.

SFML has too many 'nifty' tools that I never use. It has the aim of being more of a helper library and tend to seep in everywhere. It just imposes itself a bit too much for my taste. The api is pretty OK for what it is though and most people doesn't want to get their hands gritty with opengl calls the way I do..

The many nifty things that it includes are indeed nifty, but they're usually not as versatile as if you'd get another specialized library for the specific purpose. It has network sockets for instance, which is nice and all, if you want something really simple in that way, but they are fairly limited.

If you need the easy basics of rendering a 2D game you should go for SFML. But if you're like me and want to try a few more advanced techniques on your own and rather not have anything in your way, I'd say SDL because it's just there silently in the background.

#11 sednihp   Members   -  Reputation: 241

Like
1Likes
Like

Posted 02 July 2012 - 02:22 PM

I've used SDL for a few games and found it easy enough to get along with. After picking up C++ again, I was building SDL games in a matter of weeks thanks to Lazy Foo. I've posted a few articles over at my blog about some different things I've come across whilst developing my SDL apps, which might come in helpful, along with the sourcecode to the games to download as well if you want to have a look at what kind of code SDL produces.

I've found it remarkably easy to use SDL, the only thing I've come across that it doesn't do (so far) is rotation. I'm sure if I played around with the OpenGL side though I could nail that down. Lazy Foo has a tutorial for everything that you could need and each one has working sourcecode that you can run and see working and interrogate to make changes and see how they impact the output. I really can't praise the man enough.

#12 Greemax   Members   -  Reputation: 119

Like
0Likes
Like

Posted 02 July 2012 - 03:50 PM

Thank u guys, very helpfull. I started with C before C++ and im still practicing object oriented programming with c++ but ill go with SFML then.

#13 jbadams   Senior Staff   -  Reputation: 18577

Like
0Likes
Like

Posted 02 July 2012 - 10:59 PM

I'd say SDL because it's just there silently in the background.

I just thought I'd quickly note that you can also use SFML in the same way -- and in the C++ spirit of "only paying for what you use" it's typically built as a series of separate components (some of which rely on each other) so that you can choose to only link against the functionality you're actually using.

@Greemax:
Great, glad we could be of help making your decision, good luck with it!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS