Thread: A Complete C++ Game Programming Tutorial

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    48

    Lightbulb A Complete C++ Game Programming Tutorial

    Hello all, long time lurker; first time poster. I know this site has a great many excellent tutorials on all facets of C++ programming, so I hope it isn't a breach of etiquette to post one more. I have put together a moderate-advanced ( read, long ) tutorial that walks you through the process of creating a simple C++ game from scratch using SFML. It has been well received by others and I hope some of you here find it useful.


    Essentially, I found there was a gap in tutorials that spanned the distance between the basics of learning C++ and cover the gap of actually using it in a production environment, writing readable, maintainable and performant code using modern C++. So that is what I set out to write. One of the big reasons few such tutorials exist is because frankly, its a long topic, an extremely long one in fact. Which is why my simple pong clone is already 8! chapters long and isn't in fact complete. In the end it will probably end up around the 12 chapter mark I would estimate. It is however to the point you can extrapolate what you have learned and create a game ( or other project ) of your own. As I like to call it, it is the worlds most over engineered pong clone.

    It's not really about teaching you how to program a game, although that is the end result. It doesn't in fact teach you how to program at all. It assumes you have prior knowledge of the basics of C++ programming, or at least C programming. If you understand variables, loops and flow constructs like ifs and while loops, this is the perfect tutorial for you. It is also an iterative process, so in some cases you actually will write some code then re-write it later in a better manner, as to know why something is good, you often need to experience how bad it could be! In essense, this tutorial is about taking the basics you already know and guiding you to the next step of actually using them.

    Along the way you will learn about splitting your code into multiple pieces, class design, precompiled headers, statics, enums, templates, structs/classes, inheritance ( virtual/abstract/pure virtual ), constructors, stl data types ( map specifically ), asserts, const correctness and a myriad of other topics and shiny bits of trivia I found interesting at the time. All demonstrated in actual code you would write in the real world, not as some abstract sample. It is often easier to learn about inheritance using it in a real world example than it is using some abstract example about animals and making a dog bark and a cat meow. It even touches a bit on design patterns towards the end.

    Anyways, if that sounds interesting to you give it a read. If you aren't using Visual Studio or don't care about setting up SFML, you can freely skip ahead to chapter 2, as the first two chapters are about setting up your project. The code compiles with minimal changes on Linux and Mac OS as well. Although I have a number of years of experience both with C++ and programming in general, C++ is a tricky language and I make mistakes. If you see any glaring mistakes, of course let me know, and I will address them!

    Tutorial link:
    Link removed by moderator
    Jump directly to the coding bits:
    Link removed by moderator
    This is just one of many intended tutorials I am writing, so any and all feedback is appreciated! This is ultimately about teaching, so if you don't understand something, I have failed at my task. Any and all comments are encouraged and will only assist me in creating better content going forward.



    Also, hello all. Now that I am a post-lurker, I will be much more active in these part. Next time, with less text!

    Cheers



    /Oh, and moderators, if this post was a breach of proper etiquette, I apologize and feel free to delete it without offence taken!
    Last edited by VirtualAce; 11-27-2011 at 11:08 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WINDOWS/GAME Programming Tutorial CD
    By paulogrady in forum Game Programming
    Replies: 9
    Last Post: 11-17-2008, 07:59 PM
  2. Dostris (a complete game in 3 hours)
    By Jeremy G in forum Game Programming
    Replies: 8
    Last Post: 08-30-2003, 02:17 PM
  3. Okay, game is ALMOST complete, but i need an AI
    By Blizzarddog in forum Game Programming
    Replies: 4
    Last Post: 12-07-2002, 10:08 PM
  4. Complete Game programming forum
    By gogo in forum Game Programming
    Replies: 5
    Last Post: 03-25-2002, 10:53 PM
  5. Yay! My first game is complete! Come look!
    By Leeman_s in forum Game Programming
    Replies: 2
    Last Post: 11-05-2001, 10:23 PM

Tags for this Thread