• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Having a hard time learning C++

Tristicus

Diamond Member
Alright, so, last year I decided I was going to start learning how to program in C++. I have a game idea in mind, and I set it as a project for myself to start working on, especially last year when everything released for free like the Unity game engine and Epic's UDK. I've used this tutorial (first 20 lessons) and then started "over" in the C++ for Dummies book, but I've found it very hard to push myself and start learning it. I've seen people saying C++ is a hard first language to learn, but I don't know if it is that or just me. So, I need to know if it would benefit me to start with an easier language for right now. Flash or Java would be something easier, right? I'm not actually sure if it is just an easier language I need to learn first to either push myself or actually speed up my learning of C++, but I need to try something. The reason I chose C++ is because it is (how I've read) universal and programs like UDK use it.
 
I don't know if Flash would be easier. ActionScript is kind of unintuitive in a lot of ways. Java or C# would be easier because there are many lower-level concerns such as memory allocation/deallocation that you don't have to worry about. In any event, regardless of which language you choose if you're motivated you should be able to chew through it. If you're running out of steam on the tutorials I would say abandon that approach, and just start implementing some simple program idea, using the many web resources as reference and QA material to get you over the parts you don't understand yet.
 
I don't know if it is so much the language that is the problem as it is the fact that you are trying to do a difficult task.

Learning any language IMO is about the same difficulty (Functional languages not include). The problem is, you are trying to learn a language by making a game. This, IMHO, is not the best way to do things. Game programming, regardless of the language, isn't an easy thing. Learning to a language and learning game programming is a fairly difficult process.

I would suggest starting out with simpler things, learn how to make a program that says hello when you push a button, make a n log n sorting algorithm, learn how to use different libraries, like zlib, ect. Become familiar with the language first, then start the game programming.
 
I don't know if Flash would be easier. ActionScript is kind of unintuitive in a lot of ways. Java or C# would be easier because there are many lower-level concerns such as memory allocation/deallocation that you don't have to worry about. In any event, regardless of which language you choose if you're motivated you should be able to chew through it. If you're running out of steam on the tutorials I would say abandon that approach, and just start implementing some simple program idea, using the many web resources as reference and QA material to get you over the parts you don't understand yet.

C# is what is used with XNA if I'm correct..so that wouldn't be bad to start out with. Would this also propel me further in C++ when I delve into that? I want to end up with C++, but I want to (now) get my feet wet in something else (that is "easier"). Who knows, maybe I'll end up using the language I learn first anyways and put off C++ until later.

I don't know if it is so much the language that is the problem as it is the fact that you are trying to do a difficult task.

Learning any language IMO is about the same difficulty (Functional languages not include). The problem is, you are trying to learn a language by making a game. This, IMHO, is not the best way to do things. Game programming, regardless of the language, isn't an easy thing. Learning to a language and learning game programming is a fairly difficult process.

I would suggest starting out with simpler things, learn how to make a program that says hello when you push a button, make a n log n sorting algorithm, learn how to use different libraries, like zlib, ect. Become familiar with the language first, then start the game programming.

Well, I'm not trying to just instantly start programming a game. For instance, the Dummies book has several programs that you type up and learn to do. I understand I won't be just making a game the instant I start learning the base of the language, that is just my goal.

EDIT: After reading a few more things and finding GPWiki, I think I'll use Python to start off.
 
Last edited:
If you want to program a game I'd suggest learning C# and the XNA game studio. MS has a ton of awesome tutorials and the IDE/tools are some of the best out there, and many are available for free.
 
I second GA's suggestion to look into using C# and XNA. I'm a .NET developer and IMO Microsoft's tools are extremely handy and easy to learn.
 
That's one thing I do like about XNA and C#, is that as of now it has a strong following. Are there pros and cons between that and Python? I figure C# will be a better beginner language if I go to C++ later though.
 
I recommend you try a very high-level language, in which you can make something interesting quickly. Once you've had a taste of that, you might find yourself more interested in the details of lower-level languages.

The other thread (on scripting) reminded me of AutoHotkey (http://www.autohotkey.com/), which is easy to learn and you can do all sorts of neat stuff with it.
 
I'll look into that. What about GML? It's the programming language used in the program Game Maker (which I used to play around with). Would that be an example of a high-level language?
 
Last edited:
I'll look into that. What about GML? It's the programming language used in the program Game Maker (which I used to play around with). Would that be an example of a high-level language?

I know next to nothing about GML, but it sounds like it might be a good place to start.

The trouble is that in C++ and languages like it, you the newbie programmer are exposed to every nasty detail. It can be very frustrating to start that way. Your reward is usually the bleak satisfaction of seeing your code print something to the console. People who have worked in programming for a while have a lot of appreciation for things that print on console, so experienced programmers often find that to be a gratifying experience... but its not very motivating for someone just starting off.

For beginners, it is more gratifying to see instant glitter. E.g., with something like this:
Code:
Run Calc
WinWait Calc
Sleep 500
SendInput 44
Sleep 500
SendInput {+}
Sleep 500
SendInput 22
Sleep 500
SendInput {enter}
Sleep 500
WinClose

Admittedly, not the most elegant thing I've ever written. But it is nifty and gratifying, especially to newbies.

(Thats a real AHK script to start Windows Calculator, add 44 and 22 (sleeps in between so it doesn't go too fast), and show the result)
 
Well damn, that actually seems like a nice program. Can that relate to other tasks and programs as well? Like for instance, could I set a key to make my fan speed 50 and one 75 in ATI CCC?
 
Well damn, that actually seems like a nice program. Can that relate to other tasks and programs as well? Like for instance, could I set a key to make my fan speed 50 and one 75 in ATI CCC?

AHK can automate almost anything you could normally do with a command line or a GUI. So yes, it can probably be made to automate ATI's control panel.
 
I recommend you try a very high-level language, in which you can make something interesting quickly. Once you've had a taste of that, you might find yourself more interested in the details of lower-level languages.

The other thread (on scripting) reminded me of AutoHotkey (http://www.autohotkey.com/), which is easy to learn and you can do all sorts of neat stuff with it.

David Brin wrote an opinion piece a few years back bemoaning the death of a universally available interpreted language like BASIC.

http://www.salon.com/tech/feature/2006/09/14/basic/index.html

I think he's on to something. You really didn't need anything to start using it, other than to type 'basic' at the command prompt.
 
Well, I tried to screw around with the AHK, and made this, but it doesn't seem to work:


#0::Run CCC
Sleep 5000
WinActivate ATI Catalyst™ Control Center
MouseMove, 186, 417
Click 186, 417

Don't know why, but also haven't looked at any other examples. It seems like a neat program though.
 
Well, I tried to screw around with the AHK, and made this, but it doesn't seem to work:


#0::Run CCC
Sleep 5000
WinActivate ATI Catalyst™ Control Center
MouseMove, 186, 417
Click 186, 417

Don't know why, but also haven't looked at any other examples. It seems like a neat program though.

"it doesn't seem to work" is not very descriptive. What part fails? Any specific error message?

Stuff to consider:

I don't recall what the # does, but it might not be necessary.

The argument to 'Run' is a command, in the system path, to launch. If CCC isn't in the path, it won't launch. Try specifying the full path.

WinActivate doesn't need the full title -- just a subset of it. E.g.,
WinActivate ATI Catalyst

Anyway, be sure to read through and DO the tutorials.
 
# is for the Windows key, 0 being the zero key so I press both to activate CCC which does activate, but it does not click anywhere.
I read through the quick-start to at least do that much, but I'll read some more/find more tutorials. Anyways, thanks for the responses people.

EDIT: I'm actually using GML with Game Maker right now, and it is very easy. For instance...

Code:
view_object = MainCharacterWithGun;

instance_change(MainCharacterWithGun, 0)
if sprite_index = MainCharacterFront
    {sprite_replace = MainCharacterFrontGun;
    }
if sprite_index = MainCharacterBack
    {sprite_replace = MainCharacterBackGun;
    }
if sprite_index = MainCharacterRight
    {sprite_replace = MainCharacterRightGun;
    }
if sprite_index = MainCharacterLeft
    {sprite_replace = MainCharacterLeftGun;
    }
 
Last edited:
# is for the Windows key, 0 being the zero key so I press both to activate CCC which does activate...

The run command is triggered by Start+0 -- but the rest of the script just runs whenever you start the script. So the WinActivate, etc., probably isn't happening after you hit Start+0... so the click ends up doing nothing at all.
 
Depending on how much programming you know, you may want to start simple with something like scratch (scratch.mit.edu)

http://www.pygame.org/ is also a nice game engine to learn some programming basics with, and it can grow with you. Eventually C++ is something everyone needs to sit down and learn however.
 
Well I know none, so..😛 Thanks.

I did start learning GML though, and as said above, it is fairly simple. The program Game Maker is drag and drop with coding optional, but coding gives you more choices and allows you to tweak things. I had all mind drag and drop, then someone gave me this to replace it:

Code:
if vknokey=true
    {
    motion_set(direction,0);
    }
if vkright=true && vkup=false && vkleft=false && vkdown=false
    {
    motion_set(0,7);
    }
if vkright=false && vkup=true && vkleft=false && vkdown=false
    {
    motion_set(90,7);
    }
if vkright=false && vkup=false && vkleft=true && vkdown=false
    {
    motion_set(180,7);
    }
if vkright=false && vkup=false && vkleft=false && vkdown=true
    {
    motion_set(270,7);
    }
if vkright=true && vkup=true && vkleft=false && vkdown=false
    {
    motion_set(direction,7);
    }
if vkright=false && vkup=true && vkleft=true && vkdown=false
    {
    motion_set(direction,7);
    }
if vkright=false && vkup=false && vkleft=true && vkdown=true
    {
    motion_set(direction,7);
    }
if vkright=true && vkup=false && vkleft=false && vkdown=true
    {
    motion_set(direction,7);
    }
if vkright=true && vkup=true && vkleft=true && vkdown=false
    {
    motion_set(90,7);
    }
if vkright=false && vkup=true && vkleft=true && vkdown=true
    {
    motion_set(180,7);
    }
if vkright=true && vkup=false && vkleft=true && vkdown=true
    {
    motion_set(270,7);
    }
if vkright=true && vkup=true && vkleft=false && vkdown=true
    {
    motion_set(0,7);
    }
if vkright=true && vkup=true && vkleft=true && vkdown=true
    {
    motion_set(direction,0);
    }

//change sprite relative to direction
if direction=0
    {
    if hasgun=true
        {
        sprite_index=MainCharacterRightGun;
        }
    else if hasgun=false
        {
        sprite_index=MainCharacterRight;
        }
    }
if direction=90
    {
    if hasgun=true
        {
        sprite_index=MainCharacterBackGun;
        }
    else if hasgun=false
        {
        sprite_index=MainCharacterBack;
        }
    }
if direction=180
    {
    if hasgun=true
        {
        sprite_index=MainCharacterLeftGun;
        }
    else if hasgun=false
        {
        sprite_index=MainCharacterLeft;
        }
    }
if direction=270
    {
    if hasgun=true
        {
        sprite_index=MainCharacterFrontGun;
        }
    else if hasgun=false
        {
        sprite_index=MainCharacterFront;
        }
    }
if vkspace=true
    {
    if hasgun=true
        {
        vkspace=true
        }
    if hasgun=false
        {
        vkspace=false
        }
    }

Well not that exactly, I've edited that, but you get the point. I'm finding it fairly easy to learn and tweak, so after I master this well enough I think I'll move onto something like Python.
 
Well I know none, so..😛 Thanks.
...I think I'll move onto something like Python.

Whatever you move on to, keep in mind that there's more to programming than making working programs. If you intend to get serious, either as a professional or as a hobby enthusiast, you should take the time to learn about data structures, algorithms, and software engineering. Wikipedia should be a good start on any/all of those.

And, of course, as you learn python/whatever, we the forum trolls are here to help out and criticize, too.
 
Back
Top