Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

C++ Game Programming

Options
  • 04-07-2011 5:30pm
    #1
    Registered Users Posts: 180 ✭✭


    I want to learn c++ programming. I thought that I could learn most of the basics and then make a simple 2d game. Is there a book that would cover this sort of stuff and then deal with gui's instead of console stuff all the time?


Comments

  • Registered Users Posts: 7,157 ✭✭✭srsly78


    Use XNA Game studio for a more gentle introduction, uses C#. Will teach you lots of relevant stuff, you could learn C++ later. Alternatively, android+java could be a way to start (http://developer.android.com/sdk/installing.html).

    Everything you need to start is here: http://msdn.microsoft.com/en-us/library/bb200104.aspx

    If you insist on doing things the hard way you could learn with raw c++ and OGRE (http://www.ogre3d.org/). For IDE choose from lots of free ones, like visual studio express.


  • Registered Users Posts: 179 ✭✭Neodymium


    the guy over at thenewboston.com has started a tutorial series in game development using the Unreal Development Kit (UDK) which is the same game engine used by games such as Gears of War and Borderlands and is completely free to use.

    He has tutorials at the moment using the udk. I think he will be starting Unreal script soon to acompany the unreal engine to develop game mechanics etc. Im not too sure about unreal script about what language it is based on or anything.

    You can check out his UDK tutorials here: http://www.thenewboston.com/?cat=69&pOpen=tutorial


  • Registered Users Posts: 981 ✭✭✭fasty


    They guy said he wanted to learn C++ then do a simple 2D game, folks! OGRE is a large body of code for 3D graphics, and horribly over engineered.

    How about Allegro? as a library. Plenty of tutorials and examples. It's was originally started by Shaun Hargreaves, who was involved in MotoGP 1 and 2 on Xbox and is now one of the main people behind XNA.


  • Registered Users Posts: 180 ✭✭Darkphenom


    fasty wrote: »
    They guy said he wanted to learn C++ then do a simple 2D game, folks! OGRE is a large body of code for 3D graphics, and horribly over engineered.

    How about Allegro? as a library. Plenty of tutorials and examples. It's was originally started by Shaun Hargreaves, who was involved in MotoGP 1 and 2 on Xbox and is now one of the main people behind XNA.

    Is allegro up to date? Any good tutorials/books for it? It would be nice if there was a book which covered the learning of c++ and then moved into doing games (eg. moving onto allegro).


  • Registered Users Posts: 830 ✭✭✭Robby91


    Neodymium wrote: »
    the guy over at thenewboston.com has started a tutorial series in game development using the Unreal Development Kit (UDK) which is the same game engine used by games such as Gears of War and Borderlands and is completely free to use.

    He has tutorials at the moment using the udk. I think he will be starting Unreal script soon to acompany the unreal engine to develop game mechanics etc. Im not too sure about unreal script about what language it is based on or anything.

    You can check out his UDK tutorials here: http://www.thenewboston.com/?cat=69&pOpen=tutorial
    There's also the Unreal Developer Network for UDK-based development.

    Personally, I've found the video tutorials over at 3DBuzz to be quite helpful (although, I was only interested in the UnrealScript tutorials so I can't comment on the quality of their other tutorials :P). They have a pretty large collection of videos covering game programming with a number of languages (incl. C++) and engines, along with a range of other subjects (such as Photoshop and 3D modelling suites if they may be useful to you in the future)


  • Advertisement
  • Registered Users Posts: 180 ✭✭Darkphenom


    Robby91 wrote: »
    Personally, I've found the video tutorials over at 3DBuzz to be quite helpful

    They seem like quite good tutorials but quite expensive seeing as they are just videos and there is no support or one-to-one.


  • Closed Accounts Posts: 4,564 ✭✭✭Naikon


    Have you looked into XNA?


  • Registered Users Posts: 1,481 ✭✭✭satchmo


    You don't need a book, just go through the tutorials on LearnCPP.com or cplusplus.com - they're both well laid out and easy to follow. Don't expect to follow it all first time, but just read as much as you can and start experimenting.

    Once you have a grasp of the basics, get SDL which is a library for doing input, 2D/3D graphics, audio, file loading and so on. It's a pretty simple API and there are plenty of tutorials out there, I reckon it's a great starting place for doing your first game.


  • Registered Users Posts: 180 ✭✭Darkphenom


    Naikon wrote: »
    Have you looked into XNA?

    I have looked at it before but then I got busy with school and I dropped it for a while. I wanted to learn c++ because it is quite popular, it is multi-platform and its what a lot of great games are run off.

    I'm not too sure what graphics library to use but I think I'll try allegro. My main goal for the moment is to learn enough to make a classic game like space invaders or pong.


  • Closed Accounts Posts: 5,482 ✭✭✭Kidchameleon


    OP,

    I use this:

    http://www.sfml-dev.org/

    Its a great library, I've found it better than Allegro and SDL.

    I use Code::Blocks IDE with MinGW for compile. Ive made some nice 2d games with it.


  • Advertisement
  • Registered Users Posts: 3,945 ✭✭✭Anima


    Code::Blocks IDE with MinGW

    I'd avoid that at all costs, get Visual Studio if you can. Free to all students from dreamspark.com


  • Registered Users Posts: 627 ✭✭✭Dboy85


    I'm studying Games Dev and heres my 2c:

    If your in a hurry to get programming; download Visual Studio express, as stated, and start off on c#.

    Visual Studio has features to build your U.I's and can add all sorts of components to your form\application and is by far the easiest to work with.

    C++ can be a complicated starting block as you have to be tidy. By this I mean be aware of memory leaks. C# takes care of all this for you so its less error prone. You WILL run into problems in c++ if your starting from scratch.
    But like everything can be mastered with practice. C# is the way to explore games dev fast and all you learn can be applied to c++.

    In visual c# you can stick a picture box on a form and draw your 2d games in there. Games like battleship, Tetris, Monopoly etc to give you a taste for 2d.
    For 3d have a look at opengl libraries and get some shapes on screen instead of jumping into Ogre3d or any engines. Learn the languages and explore core logic like creating player objects, enemy objects etc and how they can interact with each other.

    You might get a bit sick over this but start looking at some applied maths like Trigonometry, Vectors and matices. If your getting into games dev these cant be avoided and tbh are easy enough as you see how they are applied by moving objects, vectors/matrices, in a 3d world.

    If you want some code examples let me know and I'll give you some to get you started. Games logic will force you to be a better programmer and can be stressful, but its cool :)


  • Closed Accounts Posts: 5,482 ✭✭✭Kidchameleon


    Anima wrote: »
    I'd avoid that at all costs, get Visual Studio if you can. Free to all students from dreamspark.com

    Any particular reason? Cant stand Visual Studio myself.


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    Any particular reason? Cant stand Visual Studio myself.
    Actually visual studio is quite amazing once you use it properly. It's quite powerful. Least in my opinion. Nothing that I know is close to it.


  • Registered Users Posts: 3,945 ✭✭✭Anima


    Basically what WebMonkey said. It's the best IDE for C++ out there really. Most C++ programmers I see (on forums etc) use it. There is a lot in there but you can really boost your productivity if you learn to work with it.

    Codeblocks, Netbeans or Eclipse are alright I guess but they're usually quite minimal in features and essentially just text editors. GCC can be less friendly as well when it comes to error messages.


  • Registered Users Posts: 1,481 ✭✭✭satchmo


    Dboy85 wrote: »
    C++ can be a complicated starting block as you have to be tidy. By this I mean be aware of memory leaks. C# takes care of all this for you so its less error prone. You WILL run into problems in c++ if your starting from scratch.
    This sort of argument bothers me. Not to pick on you in particular, I've heard it plenty of times before - someone says "I want to learn C++ and make games", and then everyone else says "don't use C++, it's too hard", or "use XNA, it's easier".

    Learning C++ gives you a great foundation for not just programming in general, but also knowledge of memory usage, performance, compilers, and hardware usage in general - all of which of huge importance in games. Yes C++ is hard, but not significantly harder than any other language. XNA might help you get a game made quicker, but if you're serious about getting into games as a career then it's nothing more than a crutch.

    It drives me nuts that C# and XNA is being taught in gamedev courses. On serious dev teams, C# is mostly used for tools (which it's quite good at) and scripting. If you're looking to get into a job doing graphics/AI/physics/engine/etc programming, C# is going to be of little use. Courses should be teaching C++ as a base, with maybe a module in C# to give an introduction on the differences.

    My advice to any student in a gamedev course is that if you're only being taught C#, you should be learning C++ on your own time. Your future career will thank you for it.

    And yes, definitely use Visual Studio - it's infuriating at times, but for C++ its debugger is better than anything else out there.


  • Registered Users Posts: 7,157 ✭✭✭srsly78


    Anyone would spend ages bogged down learning C++ before they even get something simple running. This would put a lot of people off, this is why we recommend easier ways of starting. I was a gamedev, and learned it through C++ because there was no alternative back then. Things are different today.

    C++ is no longer the "one true language" for writing games. Smart developers use a combination of high and low level languages as appropriate (my current project is combination of c++/directx embedded inside c# wpf for example). I would recommend smartphone development to beginners, java or objective C. For stuff like directx/opengl it really doesn't matter what language you use. Learning OpenGL ES is the way to go, since it looks like WebGL will use the same API.

    Games as a career is rubbish btw. There are no well paying jobs. After learning all that maths/programming stuff I quit gamedev and went to work for a bank.


  • Registered Users Posts: 627 ✭✭✭Dboy85


    srsly78 wrote: »
    Games as a career is rubbish btw. There are no well paying jobs. After learning all that maths/programming stuff I quit gamedev and went to work for a bank.

    Not in Ireland and its lubriciously competitive.

    With regards to C++ vs C#, personally I recommended it that way cos I learned it that way. I was taught C# and then progressed on to C++ and learned x8086 in between and I found it a good progression. Start off learning programming high level without being bogged down in memory management is the way I always recommend.
    C++ isn't black magic but you do need to learn low level fundamentals to make full use of it. Let the compiler worry about it man :pac:

    C++ is the foundation language on my course but I still prefer to code in c# where I can. The debugging is so much easier.

    Let the guy get some core logic under his belt and then worry about efficiency


  • Registered Users Posts: 1,481 ✭✭✭satchmo


    srsly78 wrote:
    C++ is no longer the "one true language" for writing games.
    It is if you're working on console or PC games.
    srsly78 wrote:
    Games as a career is rubbish btw. There are no well paying jobs.
    It's true, there are very few jobs in Ireland unless you want to work in middleware, and even then you have to be very good. That hardly makes it 'rubbish' as a career though.
    Dboy85 wrote:
    I was taught C# and then progressed on to C++ and learned x8086 in between and I found it a good progression. Start off learning programming high level without being bogged down in memory management is the way I always recommend.
    Yeah that makes sense. I just get frustrated when people knock C++ for being 'too hard' when I don't think it's significantly harder than C# or Java, and has much more direct relevance to the games industry. What course are you doing anyway?


  • Registered Users Posts: 180 ✭✭Darkphenom


    Dboy85 wrote: »
    I'm studying Games Dev and heres my 2c:

    If your in a hurry to get programming; download Visual Studio express, as stated, and start off on c#.

    Visual Studio has features to build your U.I's and can add all sorts of components to your form\application and is by far the easiest to work with.

    C++ can be a complicated starting block as you have to be tidy. By this I mean be aware of memory leaks. C# takes care of all this for you so its less error prone. You WILL run into problems in c++ if your starting from scratch.
    But like everything can be mastered with practice. C# is the way to explore games dev fast and all you learn can be applied to c++.

    In visual c# you can stick a picture box on a form and draw your 2d games in there. Games like battleship, Tetris, Monopoly etc to give you a taste for 2d.
    For 3d have a look at opengl libraries and get some shapes on screen instead of jumping into Ogre3d or any engines. Learn the languages and explore core logic like creating player objects, enemy objects etc and how they can interact with each other.

    You might get a bit sick over this but start looking at some applied maths like Trigonometry, Vectors and matices. If your getting into games dev these cant be avoided and tbh are easy enough as you see how they are applied by moving objects, vectors/matrices, in a 3d world.

    If you want some code examples let me know and I'll give you some to get you started. Games logic will force you to be a better programmer and can be stressful, but its cool :)

    Thanks for sharing your experience of game dev. I have tried c# for a while but I have decided to learn c++, given that it could be more difficult to learn. I think that C++ could be more rewarding than learning c# for me.


  • Advertisement
  • Registered Users Posts: 7,182 ✭✭✭Genghiz Cohen


    Darkphenom wrote: »
    Thanks for sharing your experience of game dev. I have tried c# for a while but I have decided to learn c++, given that it could be more difficult to learn. I think that C++ could be more rewarding than learning c# for me.

    C# will give you a lot of C++ with a nice safety net. (Memory management and protection from NULL pointers and all that)
    Once you are comfortable with all C# has to offer ( a lot) then quite a lot of it applies directly to C++.

    Plus, you'll be learning all the maths, design patterns & UI stuff that goes with game dev in either language, so why not cut your workload a little, at no real cost to your flexibility. (unless you want to port to PS3 :p)

    Speaking as a games dev graduate and C++ programmer; If someone asked me to quickly mock up a prototype, I'd be off to C#. It's faster and easier, while retaining the important stuff.


  • Registered Users Posts: 180 ✭✭Darkphenom


    C# will give you a lot of C++ with a nice safety net. (Memory management and protection from NULL pointers and all that)
    Once you are comfortable with all C# has to offer ( a lot) then quite a lot of it applies directly to C++.

    Plus, you'll be learning all the maths, design patterns & UI stuff that goes with game dev in either language, so why not cut your workload a little, at no real cost to your flexibility. (unless you want to port to PS3 :p)

    Speaking as a games dev graduate and C++ programmer; If someone asked me to quickly mock up a prototype, I'd be off to C#. It's faster and easier, while retaining the important stuff.

    OK I think I will develop with C# for now XD. I honestly didn't think that people would ever recommend C# over C++. So many people have recommended it that makes me think it could be the way forward. My plan for now is to learn C#, with some XNA and pick up where I left off... I still think that I will pick up c++ eventually :P

    Thanks for all the replies ;)


  • Registered Users Posts: 7,182 ✭✭✭Genghiz Cohen


    Darkphenom wrote: »
    I still think that I will pick up c++ eventually :P

    You should, plus knowing C# will make it that bit easier.


  • Closed Accounts Posts: 5,482 ✭✭✭Kidchameleon


    Darkphenom wrote: »
    OK I think I will develop with C# for now XD. I honestly didn't think that people would ever recommend C# over C++. So many people have recommended it that makes me think it could be the way forward. My plan for now is to learn C#, with some XNA and pick up where I left off... I still think that I will pick up c++ eventually :P

    Thanks for all the replies ;)

    Only problem with XNA is that you will have trouble sharing your creations with your friends. To deploy on XBox is way too much leg work, to deploy on PC means the host PC will have to be of a very specific configuration...


  • Registered Users Posts: 7,157 ✭✭✭srsly78


    Noone is saying use XNA for real work. Just use it to mess around and get started.


  • Registered Users Posts: 981 ✭✭✭fasty


    I don't agree with people saying to start with C# and move to C++. But XNA can be used and is used in commercial games these days.

    It's pretty to easy to make installers and include the XNA runtime you know!


  • Registered Users Posts: 7,157 ✭✭✭srsly78


    It gets used for some xbox live titles which don't make **** all money for the developers (read an article saying the most they have earned is about e1000). What serious projects has XNA been used for? None that I know of.

    Anyway, what's important is learning DirectX and various other APIs. XNA is a high level version of this, easy to get started with. OP you should know the difference between learning languages and learning APIs, you will need to do both :)

    You can also use DirectX from C# using the microsoft wrapper (this only possible in the last year, it didn't work properly before that).


  • Registered Users Posts: 981 ✭✭✭fasty


    There are a good few games on Steam that use XNA. Recent ones I've bought include Magicka and Capsized.

    There's Slim DX in addition to the recent MS wrapper if you want to use D3D from C# and it works okay.


Advertisement