suggested C++ API for beginner

Started by
19 comments, last by Maveryck 15 years, 7 months ago
Hey, I've just been looking through the 'Suggested projects for beginning programmers' section of this website and saw projects like Tetris and Pacman which say to use an API of your choice when making these games. I was just wondering what API I should use when starting out and trying to create games like these??? Any suggestions would be greatly appreciated! Cheers
Advertisement
I would suggest SFML.

Although it has less resources than other popular libraries (SDL, Allegro), it is object oriented and (IMO) easier to work with.

Besides, once you've learned the basics of SFML (from the tutorials on the website and the documentation), you'll probably be able to read tutorials that use other APIs and translate the code to SFML.
I used Allegro. for some of my early 2d stuff found it easy to use and has a good community, I found it easy to get into with some examples and reference materials. I haven't used it for ages as I have been just working on 3D. But certainly had fun using it :)
For pure Windows I would stick to http://hge.relishgames.com/.
This is a fairly easy to use 2D-Api. For XPlatform-2D I would point you to Clanlib or Allegro.
If you want to start out directly with 3D, I would recommend Irrlicht.
regards
If you say "pls", because it is shorter than "please", I will say "no", because it is shorter than "yes"
http://nightlight2d.de/
Yeah do yourself a favor and use something like Allegro or SDL that has a short learning curve compared to straight win32 api or MFC that I'm using right now to make a tetris game!
[size="2"]Don't talk about writing games, don't write design docs, don't spend your time on web boards. Sit in your house write 20 games when you complete them you will either want to do it the rest of your life or not * Andre Lamothe
I suggest that you DON'T use C++ as a first language. Unless of course you developed in it for years now and want to try games programming. If so, SDL is always a good choice. If not, try out Python or C#, you'll save yourself TONS of grief. No, "But ManTis, all professional games are made in C++, lulz!" is not a good argument.
If only noobs were boobs... the world would be a better place.
Quote:Original post by ManTis
I suggest that you DON'T use C++ as a first language. Unless of course you developed in it for years now and want to try games programming. If so, SDL is always a good choice. If not, try out Python or C#, you'll save yourself TONS of grief. No, "But ManTis, all professional games are made in C++, lulz!" is not a good argument.


That's just your opinion. c++ has many advantages over other languages. It's by far the most portable language (especially when talking about non-pc platforms). There are more c++ engines available and they are more mature. And it doesn't force you to use a garbage collector.
Quote:Original post by captainfreedom
Quote:Original post by ManTis
I suggest that you DON'T use C++ as a first language. Unless of course you developed in it for years now and want to try games programming. If so, SDL is always a good choice. If not, try out Python or C#, you'll save yourself TONS of grief. No, "But ManTis, all professional games are made in C++, lulz!" is not a good argument.


That's just your opinion. c++ has many advantages over other languages. It's by far the most portable language (especially when talking about non-pc platforms). There are more c++ engines available and they are more mature. And it doesn't force you to use a garbage collector.


C is more portable then C++.
Quote:Original post by captainfreedom
Quote:Original post by ManTis
I suggest that you DON'T use C++ as a first language. Unless of course you developed in it for years now and want to try games programming. If so, SDL is always a good choice. If not, try out Python or C#, you'll save yourself TONS of grief. No, "But ManTis, all professional games are made in C++, lulz!" is not a good argument.


That's just your opinion. c++ has many advantages over other languages. It's by far the most portable language (especially when talking about non-pc platforms). There are more c++ engines available and they are more mature. And it doesn't force you to use a garbage collector.


You consider 'forcing you to use a garbage collector' bad thing for a beginner? Did you even read my post? Notice that I'm not arguing that C++ is in any way worse than those languages. It just has more traps and pitfalls that beginner (and experienced ones too) programmers tend to fall into. Language with less quirks is a solid recommendation, especially if it's as powerful as those two.
If only noobs were boobs... the world would be a better place.
Quote:Original post by johns700
Hey, I've just been looking through the 'Suggested projects for beginning programmers' section of this website and saw projects like Tetris and Pacman which say to use an API of your choice when making these games.

I was just wondering what API I should use when starting out and trying to create games like these???

Any suggestions would be greatly appreciated! Cheers


Hi johns700,

This might be a bit hard for you to believe, but the above posts are delusive in helping you. You should not start game programming with C++. You will fall into a lot of problems with the language it self.

This forum has seen an incredible amount of newcomers wanting to begin game programming with C++ and/or start their first game off as another WoW/MMO clone. Blank truth: it just isn't happening. I'll explain why. There are a few problems with C/C++, which I will explain now:


  1. C, and consenquently C++, does not shield the programmer from the system. The memory is almost-fully exposed to you and it's quite easy to mess things up like having game objects that do not exist. Put another way: C was originally used to program an Operating System known as UNIX; C++ adds a poorly implemented model that's oriented around objects/classes to a language that's oriented around procedures/functions. Hell ensues.

  2. Continuing from number one, this makes debugging a nightmare, and for beginners reading things like core dumps and following addresses and basically "why something happened" is very very hard, you have to understand the language and what it does underneath to understand some of the errors that arise.

  3. Continuing from number two, the language is quite big and you have to remember a lot of things to figure out why something happened the way it did. In short, you'll have to read an introductory book on programming in C++, followed by a few books that discuss the topics that no one else discusses, then read the reference book by the author of C++, Bjarne Stroustrup.

  4. And finally, there are parts of the language that are not explicitly defined. That is, who knows what might happen.

  5. Last but not least, C++ is a general purpose language meant for programming for the hardware to programming every day applications. This is NOT something you want for a game because it exposes you to things you shouldn't have to think about when programming a game.



Instead, I reject the posts above and urge you to try basic "game development" suites meant to ease you into harder stuff (such as C and C++). Afterwards, you can use a few languages that aren't as "harsh" as C or C++.

Firstly, there's the suite known as Multimedia Fusion 2, or MMF. A few of my friends made games this way very quickly.

Secondly, there is another suite known as Game Maker. GM is akin to MMF in a few ways so take your pick.

Now, you can use a programming language that is less likely to cause you problems. Unfortunately, you still have to read the manuals. The good part is, these languages are thought out and they provide walkthroughs and tutorials.

There is Python. Python has a moderately good game library called PyGame. Note their C++-poking logo. Python is clear and has good documentation.

As a side note, a lot of modern C++ games use Python or some other scripting language to actually hide as much C++ as possible. They do this for more practical reasons other than the fact that problems are harder to detect when using an "open" language like C or C++.

Either way, I hope this has persuaded you to not use C++ as your first game programming language, as it has a high chance of leading you to failure.

This topic is closed to new replies.

Advertisement