Allegro or SDL?

Discussion in 'Game Development (Technical)' started by Ludiologist, Jun 20, 2012.

  1. Ludiologist

    Ludiologist New Member

    Joined:
    Mar 22, 2012
    Messages:
    10
    Likes Received:
    0
    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)
     
  2. esrix

    Original Member

    Joined:
    Aug 11, 2005
    Messages:
    143
    Likes Received:
    0
    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.
     
  3. Ludiologist

    Ludiologist New Member

    Joined:
    Mar 22, 2012
    Messages:
    10
    Likes Received:
    0
    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.
     
  4. esrix

    Original Member

    Joined:
    Aug 11, 2005
    Messages:
    143
    Likes Received:
    0
    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:

    SDL: http://www.amazon.com/Focus-On-SDL-Game-Development/dp/1592000304

    Allegro: http://www.amazon.com/Game-Programming-All-Jonathan-Harbour/dp/1592003834

    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.
     
  5. SLotman

    Original Member Indie Author

    Joined:
    Nov 12, 2005
    Messages:
    160
    Likes Received:
    9
    I'd say ditch both and go for plain opengl + c++ - much better option.
     
  6. Olofson

    Original Member

    Joined:
    Dec 11, 2005
    Messages:
    270
    Likes Received:
    0
    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...
     
  7. Bad Sector

    Original Member

    Joined:
    May 28, 2005
    Messages:
    2,742
    Likes Received:
    5
    One being GLFW which does exactly that: provides a cross platform way to create a context and handle input.
     
  8. Olofson

    Original Member

    Joined:
    Dec 11, 2005
    Messages:
    270
    Likes Received:
    0
    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.

    Choices, choices...
     
  9. esrix

    Original Member

    Joined:
    Aug 11, 2005
    Messages:
    143
    Likes Received:
    0
    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.
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer