Sign in to follow this  
Greemaxc

Start with SFML or SDL?

Recommended Posts

Greemaxc    119
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.

Share this post


Link to post
Share on other sites
Canvas    246
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

Share this post


Link to post
Share on other sites
wolfscaptain    200
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.

Share this post


Link to post
Share on other sites
jbadams    25713
[url="http://lazyfoo.net/SDL_tutorials/index.php"]Lazy Foo's SDL tutorials[/url] 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 [i]their[/i] age some of them may not be currently maintained! [img]http://public.gamedev.net//public/style_emoticons/default/wink.png[/img]). 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 [i]to you[/i].


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! [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

Share this post


Link to post
Share on other sites
MichaelBarth    341
[quote name='Canvas' timestamp='1341183738' post='4954679']
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
[/quote]

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

Share this post


Link to post
Share on other sites
deftware    1778
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

Share this post


Link to post
Share on other sites
jbadams    25713
[quote name='radioteeth' timestamp='1341197295' post='4954740']
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.
[/quote]
Pretty unlikely given the OP specifically mentioned C++ and hasn't made mention of C...

Share this post


Link to post
Share on other sites
Zoomulator    273
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.

Share this post


Link to post
Share on other sites
sednihp    241
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 [url="http://sednihp.wordpress.com/"]my blog[/url] 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.

Share this post


Link to post
Share on other sites
Greemaxc    119
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.

Share this post


Link to post
Share on other sites
jbadams    25713
[quote name='Zoomulator' timestamp='1341218802' post='4954832']
I'd say SDL because it's just there silently in the background.
[/quote]
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.

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this