How do I start C++ game programming?
Hello, this is my first post, I think I put it in the right forum, but please move it if it is not.
OK, so I have used C++ for a bit and I have worked through 'Teach yourself C++ in 21 Days' and built some programs using that, but I would like to move on to making some simple 2D games and then some 3D games. How do I start? What program should I use?
I am using 3 different IDEs, VS C++ Express, Code::Blocks and Dev C++, so I need it to work easily with them. I would also like it to be cross platform (I am switching my computer over to Linux soon).
Also, I would prefer it to handle as many things as possible (graphics, sound etc) but that is not necessary, and as small as possible (in memory size).
Almost finally, it would be better if it was low cost, I am 14, so I don't have a lot of money and my parents hate paying for stuff off the internet.
Finally, how do you make normal C++ GUIs that are cross platform? (A little off topic, maybe I should start a new thread on it)
I hope these things are not to unreasonable, I don't mind changing some of my requests a bit.
Thanks,
Sophie
Hi and welcome! Great to see a 14year old girl interested in game programming!
If you already know about C++ that's already a very good start, most people ask how to code game before knowing the language. It help to know more advanced stuff like class inheritance and more important memory manipulation (new / delete / pointers / function arguments by pointer, reference or by value).
Once you know all that and what you seem to be asking is where to go. What you need is to use a graphical library. Theres plenty of them out there.
For non-commercial games lot of people use SDL, it's principally 2D and it's cross-platform. It also offer support for input and sounds :
http://www.libsdl.org/
Then there's OpenGL. It's the major cross-platform 3d library. the .lib/.h files to use it come with VC++ and most linux distribution.I started to learn with it some years ago using nehe tutorials:
http://nehe.gamedev.net/
Still, for commercial games OpenGL is kinda dead. Nearly every games today use DirectX and if you want to learn something why not start with the real thing? It's powerful and allow you to use all the latest video cards features. Sure it's not cross-platform but do you really care? I don't :P It work flawlessly with visual studio. DirectX contain Direct3D for graphics but also DirectSound, DirectInput, etc. To use it you must download the February 2007 DirectX SDK. Some example and tutorials comes with it.
http://msdn.microsoft.com/directx/
This might help for better tutorials : http://www.codesampler.com/source.htm
Then there's XNA Game Studio, Microsoft new baby for beginners. It force you to code in C# and use DirectX underneath but it's a lot easier.
If you already know about C++ that's already a very good start, most people ask how to code game before knowing the language. It help to know more advanced stuff like class inheritance and more important memory manipulation (new / delete / pointers / function arguments by pointer, reference or by value).
Once you know all that and what you seem to be asking is where to go. What you need is to use a graphical library. Theres plenty of them out there.
For non-commercial games lot of people use SDL, it's principally 2D and it's cross-platform. It also offer support for input and sounds :
http://www.libsdl.org/
Then there's OpenGL. It's the major cross-platform 3d library. the .lib/.h files to use it come with VC++ and most linux distribution.I started to learn with it some years ago using nehe tutorials:
http://nehe.gamedev.net/
Still, for commercial games OpenGL is kinda dead. Nearly every games today use DirectX and if you want to learn something why not start with the real thing? It's powerful and allow you to use all the latest video cards features. Sure it's not cross-platform but do you really care? I don't :P It work flawlessly with visual studio. DirectX contain Direct3D for graphics but also DirectSound, DirectInput, etc. To use it you must download the February 2007 DirectX SDK. Some example and tutorials comes with it.
http://msdn.microsoft.com/directx/
This might help for better tutorials : http://www.codesampler.com/source.htm
Then there's XNA Game Studio, Microsoft new baby for beginners. It force you to code in C# and use DirectX underneath but it's a lot easier.
Quote:Original post by PowerPython
Hello, this is my first post, I think I put it in the right forum, but please move it if it is not.
Perfect forum, as far as I'm concerned.
Quote:
OK, so I have used C++ for a bit and I have worked through 'Teach yourself C++ in 21 Days' and built some programs using that, but I would like to move on to making some simple 2D games and then some 3D games. How do I start? What program should I use?
I am using 3 different IDEs, VS C++ Express, Code::Blocks and Dev C++, so I need it to work easily with them. I would also like it to be cross platform (I am switching my computer over to Linux soon).
Also, I would prefer it to handle as many things as possible (graphics, sound etc) but that is not necessary,
A free IDE and compiler + a bunch of free libraries is all you need. But I would warn you against doing as much as you can do - it's a lot of work, and it's more likely to become frustrating in the end. You'd better use existing libraries to handle things that are difficult to code (image files reading/writing, physics or collision handling, and so on). The faster you'll get a small game, the better you'll feel, and the easier it will be to begin a bigger project in which you'll code more things by yourself.
It's quite easy find 2D or 3D engines out there (but be careful about 3D: 3D models are hard to get, and in fact you need a lot more content to make a 3D game than to make a 2D game. Creating content is not difficult - you have the right age to learn 3D modeling and content creation - but it's quite slow, especially if you also do the coding).
You'll also easily find free 3D modelers (blender comes to mind) and 2D image manipulation programs (for example, The Gimp).
In fact, everything you need can be found on the intarweb.
and as small as possible (in memory size).
As of today, there is no real need for memory constraints - unless you end with a software that use several gygabytes of memory, which is quite rae [smile].Quote:Almost finally, it would be better if it was low cost, I am 14, so I don't have a lot of money and my parents hate paying for stuff off the internet.
You can develop games for 0 bucks - you only need time (which is also a valuable resource, but the investment is up to you).Quote:Finally, how do you make normal C++ GUIs that are cross platform? (A little off topic, maybe I should start a new thread on it)
Keep it in that thread - we don't mind answering multiple related questions in one single thread.
There are different C++ GUI libraries out there: wxwidget is one of them (open source). You can search for many other GUI on the intarweb as well.Quote:I hope these things are not to unreasonable, I don't mind changing some of my requests a bit.
Thanks,
Sophie
Asking for World Peace in unreasonable. Asking for free software and information isn't [smile].
Good luck with your projects!
I'd definitely recommend SDL. It's a cross-platform 2D library, and it also includes optional libraries for stuff like image loading, sound, and even networking.
I'd advise that you stick with 2D until you have more experienced; don't jump into 3D yet. 3D is much more complicated and has more setup involved. It's better to get experience making games in 2D and have some completed projects, instead of trying to jump right into DirectX.
I'd advise that you stick with 2D until you have more experienced; don't jump into 3D yet. 3D is much more complicated and has more setup involved. It's better to get experience making games in 2D and have some completed projects, instead of trying to jump right into DirectX.
Quote:Original post by DungeAre you sure that no commercial games use SDL?
For non-commercial games lot of people use SDL...
Quote:Still, for commercial games OpenGL is kinda dead. Nearly every games today use DirectX and if you want to learn something why not start with the real thing? It's powerful and allow you to use all the latest video cards features. Sure it's not cross-platform but do you really care? I don't :P It work flawlessly with visual studio. DirectX contain Direct3D for graphics but also DirectSound, DirectInput, etc. To use it you must download the February 2007 DirectX SDK. Some example and tutorials comes with it.From the OP's post:
Quote:I would also like it to be cross platform (I am switching my computer over to Linux soon). [emphasis mine]Keep in mind that many people do in fact care about portability and the ability to target multiple platforms :)
For GUI:s take a look at GTK+, QT or wxWidgets. And for game programming I suggest SDL, at least in the beginning. SDL is quite easy to understand and crossplatform.
Some links:
http://www.gtk.org/
http://www.wxwidgets.org/
http://www.trolltech.com/products/qt/
http://www.libsdl.org/
Good luck with the programming!
P.S I'm just one year older than you. I thought I nearly was the only one interested in programming at that age. :P
Some links:
http://www.gtk.org/
http://www.wxwidgets.org/
http://www.trolltech.com/products/qt/
http://www.libsdl.org/
Good luck with the programming!
P.S I'm just one year older than you. I thought I nearly was the only one interested in programming at that age. :P
A girl interesting in game programming, it's strange :d.
So as others has said, SDL is a good point if you know C++, but you'll be limited in 2D. Then you can move on with 3D with OpenGL ! There is a very good website in French that teaches you SDL, but it's in French :/ (maybe you understand : http://www.siteduzero.com/tuto-3-8-0-apprenez-a-programmer-en-c-c.html#part_1544 ).
So as others has said, SDL is a good point if you know C++, but you'll be limited in 2D. Then you can move on with 3D with OpenGL ! There is a very good website in French that teaches you SDL, but it's in French :/ (maybe you understand : http://www.siteduzero.com/tuto-3-8-0-apprenez-a-programmer-en-c-c.html#part_1544 ).
Quote:Original post by Adam4444
For GUI:s take a look at GTK+, QT or wxWidgets. And for game programming I suggest SDL, at least in the beginning. SDL is quite easy to understand and crossplatform.
Some links:
http://www.gtk.org/
http://www.wxwidgets.org/
http://www.trolltech.com/products/qt/
http://www.libsdl.org/
Good luck with the programming!
P.S I'm just one year older than you. I thought I nearly was the only one interested in programming at that age. :P
More to say about these: GTK+ is a pure C library, although you may find C++ bindings. Architecture-wise, it's a bit overengineered, and really not easy to use. I somewhat dislike it (and that's not because I don't know it: I used to be the GTK+ FAQ maintainer, and I've dived into the code quite often).
Qt is a fairly good library - I used it for many personnal AND professional projects. But it's doomed with a problem: if you intend to distribute your program, you will only have two solutions:
1) pay for a license. Be aware that It Costs A Lot.
2) distribute your software under the terms of the GPL.
Of course, if you don't distribute your work, you can use it freely.
But It's really great software - and the Qt Designer will help you to build your graphical interface fastly. Their signal/slot mechanism is a bit awkward at a first glance, but it was designed before the standard compliant compiler era, so forgive them [smile].
WxWidget is also a good cross platform libary, with concepts similar to the MFC (Microsoft Foundation Class). It's not limited by any restriction, and is now very mature. It's worth a try.
Regards,
Many people have suggested using SDL and I can only agree with them. Using SDL is pretty easy and there are some nice tutorials out there. The largest advantage of SDL is that you'll probably end up with some nice results in a short amount of time. I can't comment on your patience, of course, but I always find it very valuable to see results quickly because they motivate me to continue with something. Undoubtedly the same goes for many people.
As for OpenGL, I would not start using that yet. OpenGL is a great API, don't get me wrong here, but it's designed with the purpose of showing 3D graphics in mind, and using it for 2D graphics to start with might be confusing as you probably won't care so much about projections etc. yet. Also, OpenGL requires you to either know how to create windows for a certain platform (winAPI for windows, XLib for UNIX systems...) or use external libraries that set up windows for you. SDL doesn't have all these sources of confusion - SDL handles all that itself so it's much quicker to get started with game coding, rather than 'set-up' coding.
Having said that, I realise this post would be pretty useless without a link to a good tutorial. I am surprised nobody mentioned Lazy Foo's tutorials for SDL yet, but I think you will find them very handy - at least, I did.
You can find Lazy Foo's tutorials here!
Regards,
Rogier
As for OpenGL, I would not start using that yet. OpenGL is a great API, don't get me wrong here, but it's designed with the purpose of showing 3D graphics in mind, and using it for 2D graphics to start with might be confusing as you probably won't care so much about projections etc. yet. Also, OpenGL requires you to either know how to create windows for a certain platform (winAPI for windows, XLib for UNIX systems...) or use external libraries that set up windows for you. SDL doesn't have all these sources of confusion - SDL handles all that itself so it's much quicker to get started with game coding, rather than 'set-up' coding.
Having said that, I realise this post would be pretty useless without a link to a good tutorial. I am surprised nobody mentioned Lazy Foo's tutorials for SDL yet, but I think you will find them very handy - at least, I did.
You can find Lazy Foo's tutorials here!
Regards,
Rogier
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement