Advertisement

C++ For Absolute Beginner

Started by August 02, 2017 09:12 PM
12 comments, last by RobertCunningham 7 years, 3 months ago

Hello again! I'm looking for a really good place (or books, but the internet would be my preference) where a COMPLETE beginner with NO programming knowledge can learn to understand and code C++ (if this helps, I'm using UE4 for my game development needs). Thanks!

Also, just as a side-note question, is the process of debugging the same as programming? Curious as to how that works. Thanks again!

44 minutes ago, Writersface13 said:

I'm looking for ... COMPLETE beginner with NO programming knowledge can learn to understand and code C++

"Accelerated C++" by Koenig and Moo.  It should get you started quickly. It is a little dated, but still one of the best.

"C++ Primer" (5th Edition) by Lippman, Lajoie, and Moo if Accelerated C++ is too fast. This is slightly more current.

44 minutes ago, Writersface13 said:

Also, just as a side-note question, is the process of debugging the same as programming?

Debugging is finding errors in the code and correcting them.

The process is different, just like editing text is different from writing text.  Before either can be done well you must be literate. It is difficult to read code and search for errors if you don't know how to write and interpret code in the first place.

Advertisement

Thanks a bunch! Would you know of any online resources or tutorials that may be of help as well?

I would second C++ Primer (I would avoid the closely named book C++ Primer Plus - it's not from the same series) Accelerated C++ is also a very good book as well.

You will pretty much need the following to get started:

(Took this list online from SFML - It's a good reference)

  • Compiling, building
  • Basic program structure (main(), header includes ...)
  • Basic data types
  • Composite data types
  • Control structures (if, for, while ...)
  • Basic functions, function signatures
  • Function parameter passing
  • Classes and general OOP
  • STL - Standard Template Library
  • Dynamic memory allocation, pointers
  • Type casting
  • Advanced OOP, inheritance, polymorphism
  • Advanced program structure, header files, linking
  • Debugging techniques This is important to be able to help yourself when the situation arises.
  • Templates
  • Operator overloading
  • Namespaces
  • Move semantics and other C++11 features
  • Metaprogramming

Then you would want to move into learning UE4 specifically. I strongly do not recommend moving into game programming until you have a good grasp of the above in C++.

You can learn online if you wish, but I strongly suggest learning from books that teach best practices. The investment in one of those books is well worth it.

Programmer and 3D Artist

Another discussion is fairly relevant to your case -- you might want to consider learning C++ outside of Unreal (at least initially).

See some thoughts on that here:

 

Hello to all my stalkers.

Thank you all for your advice! I will check out one of the books as soon as I can

Advertisement
1 hour ago, Writersface13 said:

(or books, but the internet would be my preference)

I always recomend this playlist :P

 

I would recommend C++ Programming: Program Design and Data Structures by D.S Malik.  I had this as a text book for two semesters of C++ in college.  The book isn't the best written C++ book I can think of, but it provides solid examples and good exercises.  No matter which book you choose as a tutorial I would recommend that you use C++ Programming Language 4th Edition by Stroustrup (The creator of C++) as a reference.  This books provides solid, but somewhat academic examples, but it also provides valuable details about proper use and even some insight into why the features of the language exist.

A little advice on C++ somewhere around class implementation and pointers most people start to fade.  They see that they can accomplish much just using procedural programming and fail to understand why grasping these complex concepts and the details of their proper implementation is crucial to their success as a C++ programmer.  The simple fact is if you fail to grasp these concepts you are not a C++ programmer at all.  I encourage you to approach your study of the language with the idea that the complex concepts within the language are valuable milestones in your development as a programmer not unnecessary complexities.  

Lastly, congratulations on your decision to take the first steps toward completing your game. 

The Quarry Works Creed

We who shape mere stone must always envision cathedrals

Thank you very much for your advice! Do you have any tips on understanding class implementation and pointers? 

My only advice would be to keep an open mind and don't just do the minimum.  Type out examples in the book and change them, break them, then fix them.  Learn code by reading and studying but also interact with the code.  

Specifically, when it comes to pointers forget your first inclination.  Everyone's first inclination is to say, I don't need a value that points to the location of a value when I already have a variable that labels the memory location of that value for reference.  Without spoiling the surprise or typing a book in the chat window.  YES YOU DO!!! LOL.  Accept that and read up on pointers and use them.

As far as Classes.  Classes are mechanisms that allow you to combine data and operations into a singular unit.  Think of a class as a blueprint for a machine.  You will be constructing objects from these blueprints and they will perform simple tasks.  These object will interact with objects to perform complex tasks.   These classes are blueprints for workers who know and do things in your programs.

By the time you reach classes you will have learned many of the built-in data types and utilized their associated operators and functions.  Just know that classes are really just Abstract Data Types.  When you create a class you are defining a data type.  You are defining the data it holds, the functions that it can perform and the operations that can be performed on it.

Polymorphism a big word, but the gist of this one is that once a blueprint is created a more specific version of the blueprint can be created by adding the details that make it unique from the original.  The original is the base, parent or polymorphic type, the other is the derived, child or subtype.  You may have a class such as Hero.  The hero is defined by his attributes of Strength, Speed and Health.  He performs the function of acceptQuest().  The Hero may then be the parent class of the child class Fighter who has all of the above but also has member variables sword and armor.  He may additionally perform the function swordAttack().  Another child may be Rogue who has all of the attributes of hero but also has a dagger member variable and a lockPicking() function.  This one of the types of relationships defined in concept of polymorphism.

These analogies are intentionally vague and will likely grow weak and useless overtime as you acquire solid knowledge of the associated concepts,  but I hope to give you a general idea of what these concept are and a feel for why they are powerful.  C++ doesn't have that steep of a learning curve.  It just has some really rough speed bumps and a long road toward mastery that we all inch along daily.

Oh last thing,  I have recently been reading a book called Level Up.  It has some good information on the elements of game development and offers practical advice.  You may want to check it out!

The Quarry Works Creed

We who shape mere stone must always envision cathedrals

This topic is closed to new replies.

Advertisement