What are the most important things that should make me consider moving to C++?

Started by
46 comments, last by Washu 11 years, 7 months ago
Hello, new user here.

I started to program in C# about a year ago, after having some random general knowledge. Well, things change over time and now I'm pretty confident about my amateur-ish skills in C#.
Lately, though, I'm considering moving to C++. Being used to VisualC# I downloaded its counterpart, Visual C++. Which is good, simple and powerful. Lacks intellisense, but I guess I can deal with it.

Anyway, what really made me consider this option was seeing actual C++ source code. All those "shortcut symbols", pointers and more control over the code were what caught my eye. I'm not entirely sure about what I saw and am trying to code, and this is why I started the thread. Is C++ a viable (and better) option for amateur programmers or is it only useful to more experienced users?

On a related note, what would be a good library to make games in? I'm used to XNA, I think I can shift to something else though. I've heard that it all boils down to OpenGL vs DirectX.
Advertisement
Anyway, what really made me consider this option was seeing actual C++ source code. All those "shortcut symbols", pointers and more control over the code were what caught my eye. I'm not entirely sure about what I saw and am trying to code, and this is why I started the thread. Is C++ a viable (and better) option for amateur programmers or is it only useful to more experienced users?[/quote]

Back when dinosaurs roamed the earth - and I was still in school - I cut my programming teeth on C/C++. It's not that it's a more "professional" language, it's really just more expressive. This can be good: one could construct exactly the types of things one wants pretty much without exception. This can be bad: one can easily construct themselves into very nasty dark corners of their computers.

Don't let the bad deter you though, it's an incredibly interesting language to learn. One that I've found to be far more elucidating of the workings of a computer than managed languages - Java/C#/AS3/etc. Granted, someone who knows more about it can use it far more elegantly than someone who does not, but that's universally true of all languages. Your first program is not going to be as "good" as your last provided you're always learning and trying new things.

On a related note, what would be a good library to make games in?[/quote]

I've found SDL to be a pretty good library for making 2D games. There are plenty of tutorials out there for it if you Google around, and there plenty of DirectX/OpenGL tutorials as well if you want to get straight into 3D. As for the language itself, you can get started here or here. The sites themselves will also end up being pretty invaluable resources for the language and the STL once you're ready for that.
Thanks vertex, your answer pretty much covers all my questions.
Speaking of the resources you posted, thanks again. I'll surely look into SDL as I need to get familiar with 2D programming, but is it good if I need to use some 3D models? There's a project I want to realize with a friend (who is in the same situation as me, migrating from a managed language to c++) and it could work in 2D, but I was thinking of making it 3D to learn some more while performing almost every calculation on a 2D grid (Tower defense says enough?).
Speaking of the resources you posted, thanks again. I'll surely look into SDL as I need to get familiar with 2D programming, but is it good if I need to use some 3D models?[/quote]

SDL essentially wraps OpenGL to provide its graphics functionality so you could definitely mix the two. There's a sub set of calls in SDL that allow you to operate directly on the OpenGL context should you need to.

There's a project I want to realize with a friend (who is in the same situation as me, migrating from a managed language to c++) and it could work in 2D, but I was thinking of making it 3D to learn some more while performing almost every calculation on a 2D grid (Tower defense says enough?).[/quote]

I should warn you that adding a dimension sometimes complicates things severely. Instead of using sprite sheets for characters, for example, you're now skinning animated skeletons, applying textures to them, etc. If you're new to game programming in general, consider taking smaller steps first. If not, by all means, 2D is - mathematically - a subset of 3D so anything expressible in the lower-order dimension is expressible in the higher.

My opinion on the whole 2D/3D argument is that you should consider carefully what you're getting out of using the extra dimension versus what you're adding to your workload to pay for it. If the benefits are clearly there, then that's enough of an argument for. If not, that's enough of an argument against. In your case, I'm not sure you're going to get anything beyond the "cool" factor. Maybe I'm way off on that, but consider it in any case.
Quick addendum: you might want to check out SFML over SDL, I just stumbled across another thread where they were talking about it and it appears to be an object-oriented cousin of SDL.
Yeah, it would be strictly related to the 'cool' factor, while being essentially a 2D game under most aspects. That's why I tought that making it 3D wouldn't be such a big deal, but I'll take my time to see and consider what I can do.

@Addendum: Even better, thanks again (again ph34r.png )!
I won't comment on whether the move to C++ is wise or not ([size=2]I'm not experienced enough in multiple languages to make that call, I mostly just use C++ myself - it's the only language I know in-depth), but if you do make the move to C++, I'd suggest SFML as a good 2D library... and you can use it with OpenGL if you are going to make the move to 3D. SFML will setup the window and handle input, if you want to use OpenGL (OpenGL doesn't handle that stuff for you).

However, DirectX may be a better option overall - I'm not versed enough in the OpenGL vs DirectX debate... but I am familiar with the SDL vs SFML choice (being very experienced in both), and I'd recommend SFML, but either one is a viable option.
What are your objectives? Why do you want to move to the C++ language?

What are your objectives? Why do you want to move to the C++ language?

That's what I'm asking in this thread.
Why should I move to it?

Anyway, I've already got enough replies to think that I'll just move to it. I prefer the syntax and it's good to know that I can do more than before, even if maybe I'll need those functions rarely.

That's what I'm asking in this thread.
Why should I move to it?


Do you have a bunch of existing code in C++ that's easy to reuse?
Is your team a pile of experienced C++ developers without much exposure to other things?
Does your target platform only support C++, but that's where the money is?
Did your boss/class demand you use it?

These are really the only reasons, given the headaches the language puts on you to use it.

This topic is closed to new replies.

Advertisement