C or C++ for game development? SFML 2.0 or Allegro 5?

Ok, I know C++ is newer, and both are quite fast, but(I don't know how much) C is faster due to less overhead from what I've read on the internet. Speed is a major factor in game development, and the industry standard is C++. I know this is a C++ forum, but please don't be biased and give both arguments. I'm planning on making a simple 2D side-scroller, so not a HD Call Of Duty 3D clone or anything.

My next problem is, whether I choose C or C++, I'm going to need an API/Framework/Library to code my games in. SFML has been said to be a LOT better than SDL, but it's designed for multimedia and not games, though I don't think that hurts it. Allegro is designed for games. I don't know what to choose.

So yeah, thanks for reading and thanks in advance for your answer! :)
C++ with more overhead and slower than c ?
Never heard that before .
Just write a simple c program and compile it with a c++ and c compiler then compare the results.
If you want to make games, language doesn't matter that much. If you can't optimize your code, even the fastest language(?) will be slow.

So basically, choose whatever language you want, and also whatever tool you want. SDL isn't that bad, there are quite a few nice games made using it(Toribash for sure, and idk if Cave Story wasn't also using SDL), but there are also games using Allegro and SFML. Remember, that these are only the tools - you should do the job. If you don't know how, even the best tool will not do, and if you know how to get things done - even some bad API will do for you.

If you have no idea about programming, you may want to look around, and maybe try easier language - some people advise not to learn C/C++ as first programming language because it may be hard, although I learned it first and didn't have massive problems.

tl;dr - It's your choice. Don't look at unneccessary things, focus on learning how to program. Good luck!
I know how to program. I made the mistake of starting with C++. I now know over 12 programming languages. I think I'll use C though tbh, just because I prefer it. It's still a popular language, right? :) And I think I'll play around with SDL, SFML and Allegro and see what one I prefer. Thanks!
Last edited on
As far as I know.... SMFL should be a C++ library.... so if you plan to use C you will probably forced to choose between SDL and Allegro (and not SMFL).

However take mind that not all the infos you will find in the net are correct. There are a lot of people that "speak as faction" (both C and C++ supporters).

The truth is that C and C++ have advantages and disadvantages each.
For example it is not true that C is faster than C++.... it depends of type of code and the type of task. Some (critical and objective) experiments demonstrated that, for the same application with an efficient code, there are cases where C application is faster than the C++ one, but also there other situations where the C++ application is instead fastr than C.

So... the fact the C is faster is a sort of "Urban Legend", becouse it can be true, but it is not necessary true.

If you said "I am planning to make a new OS or rewrite some linux component" I would say "use C: defenitly better in your situation".... This also becouse C++ is more "dependant" by the compiler..... So generated binary on C++ often can vary from compiler to compiler (so, if you make a library in C++ you should need to recompile it by your own before using it with your "system compiler".... to be more sure that it will work in your system without problems) while C code can be used without any problem even if it was compiled with a different compiler (for example if the library was compiled with gcc 3.x and you link on a program compiled in gcc 4.x you should have no problem...... if the library was in c++, instead, it could not work and you could be forced to recompile it with gcc 4.x)

But if you plan to make a game, the situation is different.
C++ offers you the chance to use classes, function overloads, etc etc that can be helpful to design your game.
C is more error prone.... however some people (like you) still prefer it.

Well... I think that the only important thing to consider if it is better C or C++..... is to use the language you are more confortable with, imho.
So if you fell more confortable with C it is nice to choose C

(PS I am not a so good programmer.... But I am more or less "unable" to use "pure" C... I find C++ a bit simplier)
If you're getting into game development, I'd say go C++.

There is a one reason I go with this: OOP, is like JESUS when you are in game dev. Seriously, if I didn't have it I think I'd quit game dev. Not saying it can't be done without it, I'm saying having functions all packed up in a class with the addition of inheritance, etc. just makes my life easier.

There are many places where I'd recommend C, just game dev isn't that place.
In a nutshell, i can say that c++ isn't slower than c but some programming patterns closely attached to object oriented programming are slow , if you implement the same in c using structs etc. you should expect the same loss .
Get it straight c++ isn't simply an oop language but a multi-paradigm language , use the methodology you prefer.
Topic archived. No new replies allowed.