Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

C++


Ristar

Recommended Posts

so i'm sat here with a bacon sarnie, on cprogramming.com

i've got my compiler and i know a couple of commands.

does anyone here knock about with the language much? how steep is the learning curve? any suggestions on tutorials/books (note i'm a retard when it comes to reading books)?

i know it's a pretty valuable language to learn... but it's also my first. i'm just wanting to code little applications for my degree show at the end of next year... reckon i can do it?

cheers babes.

Link to comment
Share on other sites

Yes! C++, I've found, is incredibly easy to pick up on. I've never spent any real time with the language, but every time I look it up again (or take a peek at source code for whatever reason), I can generally understand whats going on. A lot of understanding C++, I've learned, comes from understanding more basic programming principles.

You can do it buddy.

Link to comment
Share on other sites

so i'm sat here with a bacon sarnie, on cprogramming.com

i've got my compiler and i know a couple of commands.

does anyone here knock about with the language much? how steep is the learning curve? any suggestions on tutorials/books (note i'm a retard when it comes to reading books)?

i know it's a pretty valuable language to learn... but it's also my first. i'm just wanting to code little applications for my degree show at the end of next year... reckon i can do it?

cheers babes.

I mostly do C# and Java, but yeah, C++ isn't outside of my folder.

Basically, if you can do C you can do C++. It's just that C++ adds in OOP to the mix. What you'll need to understand at the most basic level are functions, and how long it'll take you to have a proper grasp of functions varies from person to person.

Honestly, I wouldn't recommend C++ for your first object oriented language, because it's a bit more complicated than the more recent alternatives. If OOP isn't something you need or plan to use though, go for it.

As for books and tutorials... eh, I can't think of any that are all that useful off-hand. Most of what I know of C++ is from classes I've taken, and I've never really used my books aside from for doing homework assignments.

Link to comment
Share on other sites

Yeah, C++ is actually surprisingly easy, but it's not a managed language, so it's easy to screw up, and if you do, it's effectively like shooting yourself in the foot. And then creating a hundred clones and shooting them as well. So be careful when you're working with it.

Link to comment
Share on other sites

Actually Ristar if you are interested in learning the basic of OOP I don't think GML in Game Maker is a bad place to start. It allows you to grasp the structure that's basic to all OOP I *think*. I know you were asking about GameMaker the other day is there a reason you've moved on so quickly?

Link to comment
Share on other sites

Actually Ristar if you are interested in learning the basic of OOP I don't think GML in Game Maker is a bad place to start. It allows you to grasp the structure that's basic to all OOP I *think*. I know you were asking about GameMaker the other day is there a reason you've moved on so quickly?

well i tried learning c++ a few years back but i think i was a bit too young to understand the whole thing. but yeah i've been interested in making games and stuff and i just thought it might be useful to learn c++... i might be starting a bit too big though.

Link to comment
Share on other sites

If you start on entry-level C and learn (in this order): Variables, Arrays, Loops, Functions then Pointers. Give yourself some time to understand how pointers work, they are fundamental.

Try to understand the different stages of how a compiler builds a program as well as the different types of errors and how to debug.

Once you understand those, you can move onto structs, then move onto C++. You _can_ jump into C++ and learn all this as well if you want to skip C altogether but imo C teaches some good coding practices (like declaring variables at the top of each code block).

If you have trouble, post and I and I'm sure others will attempt to help you.

Link to comment
Share on other sites

It depends on what you understand of programming logic already. If you've never even touched anything remotely like a programming language, yes, starting with Python or Java is a great idea. But if you know bits and pieces of programming logic, it wouldn't hurt to give c++ a shot first.

Link to comment
Share on other sites

well I've started learning darkBASIC - it's apparently good for games and at the very least it'll teach me programming etiquette.

it is interesting when you can look at code and actually have a vague idea of what's going on.

Link to comment
Share on other sites

I started off with a variant of BASIC, BlitzBASIC for gaming. Didn't finish the book that came with it, but a few years later I jumped into C++ with no real problems; I've been using it since 2004. It depends on how strong you are in terms of understanding fundamental concepts of computing. I learned most of what I needed from sites like cprogramming.com and they've got one kick-ass community there to help people at the forums. cplusplus.com I've found to be the most in-depth for references too. I took a class at my university last semester, just to see if my knowledge was up to task, and it was an easy A. Just saying that you can effectively learn C++ on your own time and effort if you apply yourself. It's really not as hard as some people perceive it to be.

Currently I'm using C++ and SDL (graphics library) for making small games to get experience. Nothing major so far. A prior language before learning C++ is always nice to establish the fundamentals. If darkBASIC doesn't suit your needs, I'd really go with JavaScript rather than Python or Java. It's a bit more accessible and flexible. The syntax is C like and it'll provide a nice foundation for other languages. It's technically also not an OOP language, but it still makes use of objects.

  • Like 1
Link to comment
Share on other sites

tbf i never expected such support! hahaaaaaaa

i've taken bits of all your advice and i'm surprised how quickly i'm picking up on stuff. i've got my head around variables and loops... not too sure about arrays quite yet. i understand the concept of functions and subroutines.

what i still don't understand is how I can use these things to make a MEGAGAME.

Link to comment
Share on other sites

Well, any game is a loop. It goes through the Initialization stage, then loops through logic (movement, user input, collision) and rendering. You use variables to hold stuff, obviously. Anything. Like positions, window size, a sprite's width. You then modify that data over time based on certain events.

You'd use a function to reuse repetitive code, as you've probably figured out. If you haven't, buy Sam's Teach Yourself C++ in One Hour a Day. It's a fantastic book that teaches the basics to advanced C++ in a nice learning curve. Loads of exercises in the book as well. It's very hands-on.

int main()
{
	Init();
	bool isRunning = true;

	while( isRunning )
	{
		if( escape is pressed )
		{
			isRunning = false; // exit out of whileloop
		}

		Logic();
		Render();
	}
}

Your logic can (and will) contain checks for user input, checks for collision and so forth.

e: that is very basic though, but you get the idea.

  • Like 1
Link to comment
Share on other sites

I think GML would be a great way to get your mind around C. It's how I started and now I'm pretty good with C++. I'm starting to think that Java is better for game development though since there's a lot more organization and standardized packages available. For example, most of C++'s libraries are not too well supported in terms of technical documentation. They don't even have a standard for installing for either Allegro or SFML for Visual Studio 2010 yet so I'm kinda bummed by that -_-

Link to comment
Share on other sites

A better choice for being new to programming would be C while learning some x86 ASM as you go along. That way, you're always prepared for doing stuff low-level. C++ is a whole lot more complicated, though you could get off with it if you didn't go into complicated things like templates and polymorphism. Just don't start in GML or any similar, underpowered language, or when you DO go onto C/C++ it will absolutely rape you with new concepts like manual memory management and pointers, and you'll have to relearn almost as much anyway.

Oh and, be sure to learn how to use your debugger very early in your learning. Using a debugger is absolutely vital if you don't want to tear your hair out trying to solve programs, when you find a quick null check somewhere can fix that.

Link to comment
Share on other sites

Learning the "low-level" stuff is not really necessary anymore, since operating systems have mostly hindered a programmer's ability to get "close to the metal" as the saying goes.

This is not to say it isn't useful to know what's happening at a low level, only that it's not strictly necessary.

I say feel free to start with a higher level language. C++ is fine as it's still used and supported, but old enough to have a very large base of books, libraries, sample code and technique advice.

Only thing I can stress is to learn the difference between coding and programming. Learn to program, not to code.

=Smidge=

Link to comment
Share on other sites

Smidge: That depends on your perspective; if you plan to do it professionally then you just might be screwed if your company/business relies on your knowledge for something related. A lot of people claim Java is the end all be all language but for million dollar systems, its going to pay off to know all of the low level details for the sake of optimization. But for hobbyists? Sure hell yeah, screw all of that shit.

Also the reason I recommend GML is because I think it takes a person of extreme... nerdiness to want to devote your time delving into low level programming with no immediate purpose(e.g. something with graphics/sound?). Or even to try to learn the concept of programming AND get familiar with a library, not to mention build your own systems for the sake of a very simple game. Not to judge or anything, but its sort of like why you learn C/C++/Java in a standard college curriculum before you jump into Assembly Language and then even further in depth into some low-level material during graduate school.

When you've worked with something at the high level, the inner workings just seem to make so much more sense. When you're looking at bytes, words, binary arithmetic and CPU registers then I can't imagine it would feel like fun at all unless you have some really special interests(more-special-than-this-website-interests ;P). And if anyone thinks its fun(the purpose of this site I think) to learn how to manually mess around with a stack frame when you haven't gotten around to being really familiar with basic functions and understanding the concept of an RTS, then that person is on crack!

Link to comment
Share on other sites

A lot of people claim Java is the end all be all language but for million dollar systems, its going to pay off to know all of the low level details for the sake of optimization.

Yeah... no. There's virtually no low-level optimization to be done in Java, or any runtime-compiled language (like anything .NET for example). You are not going to be putting ASM code into a Java app.

Now learning how the Java runtime virtual machine works... that might be useful. But otherwise modern languages are so managed and opaque there really is no point in learning anything deeper because you're powerless to do affect any of it.

Technically speaking, even learning x86 assembly is somewhat futile since no modern CPUs run x86 bytecode anymore... it all gets translated to native microcode before execution.

Ristar: I don't think it's possible to remake that game "tastefully."

=Smidge=

Link to comment
Share on other sites

Programming is way more about concepts than it is languages. If you know the concepts, you can language hop pretty easily. Take that statement with a grain of salt though; the jump to Objective-C was hard for me cause I wasn't used to delegation. When I was just starting out, PHP was an easy entry point because I already knew some HTML and I didn't have to concern myself with maintaining a runtime loop.

I can get around in C/++ but I really don't like working with it because it's so low-level that your code bulks up. You have to be very mindful of memory management and garbage collection, etc. It's strictly typed (Almost madness-inducingly). There are a lot of resources available, sure, but when you're beginning it can be a bit overwhelming.

Java has its ups and downs. It comes with a ton of libraries and stuff packaged in and the syntax is nearly identical to C. The biggest drawback is Java apps run in a Virtual Machine (for the most part... yes I know native compilers exist), so performance tends to suck. It's a great learning language though... It's what I learned a lot of programming concepts in while I was in High School. Java is a lot easier to hop right in and start making little games with than C++ is. It's totally object-oriented, but OOP (object oriented programming) is extremely valuable knowledge anyway.

BASIC is, in my opinion, not a very professionally applicable language anymore. I'm sure somebody somewhere would say otherwise but all my BASIC knowledge has only really been useful for little programs I made on my graphing calculator in high school.

Python is a good choice, although I don't know much about it. I have been meaning to learn it. It can do web apps, enterprise apps, games, etc. Google uses it for a lot of their stuff and it's the language of choice in a lot of Computer Science programs.

The order in which I learned the programming languages I know:

BASIC, PHP, Visual Basic, Java, C++, Scala, Objective-C

Easiest answer: start with Java and move to C++ when you're comfortable with all the concepts.

Link to comment
Share on other sites

I started with C++, and I think it's a perfectly fine language to learn as your first. I mean, look at me...even I learned to program something primitive with it.

I recommend the SDL lib when you build. It's fairly easy to learn and cross-compatible with the three big OSs. It might be a little bloated, but that's the trade-off you get for ease and portability.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...