Allegro or SDL?
I've been poring over the beginning C++ game development book that I have as well as another C++ tutorial book, and I believe I am ready to give game programming a shot. At the very least I want to see how much more I will need to improve before I can proficiently use the game developers IDE.
So I am curious, which would be a better thing to try: Allegro or SDL? (I have been using the DevC++ IDE)
I'd be willing to bet the code semantics are bit different with the libraries so that is why I am somewhat anxious to get a jump on learning it. I just need to know which one would be better to learn.
(I've read pros and cons for each but I still cannot really decide without getting a more seasoned input)
Well, both of them are free, so my suggestion is to choose a small game (pong, tic-tac-toe, etc) and try programming it in both. See which one you like the best.
I want to use the one that is best in the long run. I've heard SDL lets you do more in some way, but it is more difficult to use. (dunno if that is true...) I could try both, but I would like a bit of input on either one none the less.
Arguably, there is no "best" out of the two. People have been arguing about this for quite some time. It is going to boil down to personal opinion.
In any case, my information may be a bit dated as I haven't touched either of them in a looong time, but...
From my understanding, SDL is liked by a lot of programmers because it could be ported to other platforms (namely Mac) easier than older versions of Allegro. The thing about SDL, though, is that if you want extended functionality, you have to get the add-on libraries (which are also available on the SDL website). So the original library gives you some functionality, but if you want support for things like playing certain sound file formats, displaying text or rotating surfaces at runtime, you'll have to download extensions. There are also a LOT of language bindings for SDL. In fact, if you like Python and don't want to bind it yourself, you can just download PyGame and use that.
Until recently, Allegro was notorious for not running on Macs very well, but supposedly this has been taken care of with Allegro 5.0. Still, it does readily support nearly as many platforms as SDL (which will probably not be a big problem unless you're running on some variant of UNIX). It also doesn't have as many language bindings readily available from the website. It does have a few more features than SDL out of the box, such as being able to display text and rotate images without need of additional libraries. You'll probably want to download additional libraries anyway.
In any case, another thing to remember is that NEITHER of these is technically a game engine; they are libraries aimed at creating multimedia programs. They do a lot of grunt work, but they don't handle a lot of game specific tasks like entity management, collision detection, etc. You will have to build those yourself.
Both of them have a ton of tutorials online and both of them also have printed books that you can check out:
I'm still of the opinion that you should try both of them out. Try to keep your logic and data separate from the visual code of the game and you can easily port it from one library to the other.
I'd say ditch both and go for plain opengl + c++ - much better option.
Except then you can't avoid platform specific code for input, setting up the OpenGL context and some stuff like that. There are more lightweight libraries for that, though...
Originally Posted by SLotman
One being GLFW which does exactly that: provides a cross platform way to create a context and handle input.
Yes... Maybe an alternative I should consider, instead of moving Kobo II to SDL2? Going to merge my two GUI toolkit branches anyway (the old, "advanced" branch is SDL 2D only; used for some tools), ZeeSpace has it's own surfaces etc, so I can just wire that directly to OpenGL instead of using SDL surfaces (going to have to drop SDL there anyway as I need multithreaded rendering) - and I've just added a driver backend to the sound engine, so I'd just need to add PortAudio or something.
Originally Posted by Bad Sector
One thing I forgot to point out that I think is really important...
Regardless of whether it's SDL, Allegro or straight OpenGL, one thing you'll want to keep in mind is that when it comes to programming, there is rarely a "one framework fits all" library.
The beauty of it all, though, is that you can often mix and match. Have one library handle audio, another handle graphics, one for physics and a fourth handling network connections (if it's an online game).
Hence why I encourage working with each and determining which you like best for what task. Experiment. Learn the strengths and weaknesses of each one. Create your own set of libraries to run on top of them in an efficient and reusable manner.