Best language to be "versatile" in game making.

Started by
67 comments, last by kop0113 11 years, 7 months ago

I've been programming in C++ for a little over a year, and according to you it's likely that I have yet to encounter any of the world-ending, flood-causing, tsunami stirring disastrous mistakes that you can make when writing C++. Which means, then, that none of these vague, non-specified horrors actually apply to a beginner. Right?


Wrong.
Just because you haven't seen the outcome of your mistakes does NOT mean you have not made them.
Welcome to C++ - when you do something wrong you don't always get tripped up on it.
Doesn't make what you did RIGHT it just means you've been lucky.

Does it sound vague as a reason? Yes.
Welcome to C++.


I haven't come across them yet, my life isn't a waking nightmare, and I enjoy C++ and coding games with it. So then how is it a bad language for beginners, exactly? I'll never understand this use of vague scare tactics to keep people from just trying the damn language out. Don't do it! There's stuff hidden! You're too stupid to make the mistakes, that's why you haven't made them yet!!!! Oh, well then I guess I'm all good then. And when I do make the mistakes, I'll probably do what you did: Learn from them.
[/quote]

No, it is not a matter of 'being too stupid to learn from your mistakes' it is that C++ makes those mistakes hard to spot, hard to understand, vague due to the massive amount of 'undefined behaviour' which is allowed and more importantly makes the whole process of learning HARDER for BEGINNERS which implies, very heavily, that this is their FIRST language.

Which is why we advice against it and point out that C++ is a BAD language to start with - not that it is impossible but because you are making your life harder for yourself by trying to both learn to program AND learn to program around C++'s own vagueness and issues which is NOT helpful. C++ as a starting language WILL teach bad habits and WILL teach bad design - how do we know this? because we have seen it both in ourselves and many many times over the years.


Typical forum behavior. You see someone who's honest about their possible ignorance and try to inflate it to a size reasonable enough for you to discredit his opinions. Instead of arguing against what I say reasonably, you try to take away my voice by reminding me and everyone else that "You haven't been doing it enough yet to ruin everything." But as I've already shown, if I've been doing it a year and I still haven't encountered the horrors, that means beginners won't encounter the horrors until they're not beginners anymore. And even if I do find out something and want to switch languages, is that the death of my programming career? Is Java an entirely different world? Or Python? Or any other object-oriented language? Was my time spent with C++ wasted? Will I start from scratch? This is ridiculous.
[/quote]

Yes, it is typical behavior of people who have more experiance than you in a subject.
You wouldn't take 1 year of a maths class and then declare that the maths behind QM is easy - nor to should someone who is, regardless of if your ego likes it or not, a beginner in the subject be saying 'oh, I've had no problems, it must be easy'.

Many people with many more years of experiance KNOW you are wrong by saying 'C++ is easy' so YES your lack of experiance IS important when giving advice to other people who are just starting out.

And no, it isn't rediculous it is advice given after years of experiance in both learning the language ourselves and watching others trying to learn it too. Your claim that it is easy and that everyone has to touch it at some point is the thing which is rediculous here.
(Also throwing around sentences like 'world-ending, flood-causing, tsunami stirring disastrous mistakes' in an attempt to make the person you are replying to look like they are over stating the problem is also rediculous and a tactic so transparent you'd have to be blind to not see through it.)

You want to learn C++? Fine. Great. Knock yourself out.
HOWEVER the moment you come here and claim it is 'easy' expect this reply because those of us who know better WILL take you to task on it because not doing so is a disservice to those who follow you and think 'oh hey, this random guy who has only been doing it for a year says it is easy so it must be!' and end up taking longer to learn to code than they might well have done with something like Python (and in many cases Python would have got them where they want to go faster and with less mess than trying to deal with C++).
Advertisement
@Shaquil: As a fellow C++ user myself, I know what you mean when you say C++ isn't as hard as everyone makes it out to be. C++ isn't "hard" to learn, but it is "harder" than other languages more suitable for a beginner. I learned C++ as my first language (and it's still my primary language), but I did so knowing it'll be harder than other easier alternatives like Python. So though I made that choice for myself, when people ask my recommendation for a beginner, I recommend Python.

One thing Python has over C++: Run-time interpretation, meaning no need to compile, meaning faster development time and easier experimentation for beginners trying to learn.

Why is C++ harder (though not "hard") that Python or some other languages?
1) It's more low-level, which requires more boilerplate to learn. It requires alot of, "Don't ask what this does, you'll learn about it later in the tutorials in chapter 27 - it just works, okay?".
Example:
std::cout << "Hello world!" << std::endl;

  • Why is the bitshifting operator << being used here? Operator overloading, you'll learn about it later.
  • What is the weird 'std::' or the 'using namespace std;' doing? Namespaces, you'll learn about them later.
  • What is 'std::endl', and why am I printing it like text? It's actually a callback function being passed in to std::cout - you'll learn about how it works later.
  • What is std::cout anyway? An ouput stream class inherited from ios inherited from ios_base - you'll learn about classes and inheritance later.
  • Why are there brackets in std::vector<int> and what do they mean? Templates, you'll learn about them later.

This isn't bad, and will always be there to some extent (C++ just happens to have alot of that), but does add to confusion (and fear) in people learning it. I personally avoided templates for a long time, because I was afraid of them. laugh.png
Note: I avoided using classes that use templates. I didn't actually write my own templated classes for even longer.

2) C++ also has alot of "Don't pay for what you don't need", which is one of it's strengths... but new programmers don't know about what they do need, and when they do know, they don't know it already exists and is waiting for them to use. How many C++ new users stick with char* strings because someone told them not to use std::strings, or because the API they use requires or returns char*, and they don't know they can convert to and from std::string?
How many manually use new and delete (because they saw someone else do it), when variables on the stack would be better in 90% of their cases, and shared pointers in the other 9%?

3) C++ is a great language. It is powerful, it is flexible, it is stable, it is fast. But it also requires you to have alot of knowledge about how and when to use what it offers, that requires alot more memorization for someone who is at the same time trying to learn programming in general. C++ has alot of features, and some non-uniform syntax issues, and so many corner cases and asterisks that a programmer won't learn for years before he suddenly encounters them. Even this week, I was surprised to find out (in a forum thread here by someone actually using them) that C++ allows 'and' and 'or' as keywords instead of the much more common && and || - and I've been programming C++ for 7 years. rolleyes.gif

The C++11 standard makes C++ much better for new (and old) users. But I can't truly recommend that to new users, because of a real lack of books and tutorials teaching beginners in the new C++11 way (there are some, but google will turn up way too many old C++ tutorials), and also, a lack of full support for C++11 from IDEs and compilers, though we are getting closer. When C++11 practices are mainstream in the C++ community, then it'll be much easier to recommend new programmers to start there. And even so, that'll make it (hopefully) even with Python in terms of friendliness to new programmers.

Learning Python teaches you the basics of programming in general, which when you do decide to pick up C++, makes it much easier. Also, you won't give up Python when you learn C++, you'll use them both. So it's not like it's wasted effort.

[quote name='Shaquil' timestamp='1347115335' post='4977987']
But when we're talking about making games, I reiterate, you're going to have to read some C at some point).


No you aren't.
There is no ultimate 'you must use a C language for making games' requirement anywhere.

People make games in Python, in C#, in Java, in JavaScript, in Lua and others without touching a line of C or C++.

If Python fits the need of the OP then there is NOTHING to be gained by going to a more complex language which is considerably more dangerous to use. And lets not fools ourselves here; C++ IS a complex language. Yes, you can use it for a year and go 'hey, there is nothing hard here..' but that's because you've been using it for a year and you've no idea what lurks in the darker areas of the language or how many mistakes you have already made which haven't come back to bite you yet.

At one year of using C++, more so if its your first language, I do not believe you are qualified to say how hard the language is. You are still very firmly a beginner and more than likely are making mistakes which you are lucky haven't blown up in your face yet. I work with professionals on a daily basis who have been using C++ (as well as many other languages; C++ is not an end point either, most professionals if any degree of skill will know a few languages and can switch between them at will) for years and still make mistakes which can lead to hours in a debugger tracking them down.

So no, C++ is not easy.
It might look easy but that's just because you don't know what you are doing wrong.
(and that's coming from someone with 10+ years of using the language behind them.)
[/quote]
I know that from personal experience

In my opinion it depends on platform really, i would pick c# for windows because of XNA and its xbox and windows phone support while on others i would say python and pygame due to the simplicity of it of the day i have tested it.

Good luck
Guys, let's not turn this into a language flame war thread, okay?

@OP: As you can see, it's not really about the tools so much as it is about the craftsman. Any of the languages mentioned will be more than enough for your needs, and any language you choose is going to offer up plenty of learning opportunities. There is a lot of argument and discussion about the easiest language, the hardest language, etc... but rest assured that all of them offer challenges aplenty, and all of them offer ways to both create awesome things and shoot yourself in the foot many times in the process. The important thing is that whatever you choose, be it C#, C++, Python, Lua or something more esoteric like D or even (don't do this) Brainf**k; stick with it and give yourself plenty of time to learn it and gain experience. A good programmer can change languages very quickly; after all, most languages have far more in common with one another than differences.

C++ is widely considered the "main" gaming language.
You can't be more right !!


Typical forum behavior. You see someone who's honest about their possible ignorance and try to inflate it to a size reasonable enough for you to discredit his opinions. Instead of arguing against what I say reasonably, you try to take away my voice by reminding me and everyone else that "You haven't been doing it enough yet to ruin everything." But as I've already shown, if I've been doing it a year and I still haven't encountered the horrors, that means beginners won't encounter the horrors until they're not beginners anymore. And even if I do find out something and want to switch languages, is that the death of my programming career? Is Java an entirely different world? Or Python? Or any other object-oriented language? Was my time spent with C++ wasted? Will I start from scratch? This is ridiculous.


Yes, it is typical behavior of people who have more experiance than you in a subject.
You wouldn't take 1 year of a maths class and then declare that the maths behind QM is easy - nor to should someone who is, regardless of if your ego likes it or not, a beginner in the subject be saying 'oh, I've had no problems, it must be easy'.
[/quote]

Did you honestly compare C++ to the mathematics behind Quantum Mechanics? I think that's a fitting end to this conversation.
I'd like to have a go at addressing one of the points Shaquil has raised:


C++ is widely considered the "main" gaming language. It's what industry professionals use, it's what indie devs use, and it's what you'll probably have to learn eventually.


Yes, C++ is generally the go-to language for professional developers working on AAA projects, but it increasingly isn't what indie developers use, and there's absolutely no reason the OP will necessarily have to learn it eventually. Even in the industry, it's increasingly common the use C or C++ for lower-level performance critical code and a higher-level language (Lua, Python, UnrealScript, UnityScript, et al.) for the rest of the code.

The reasons professional developers often choose C++ are, for the most part, sensible and pragmatic, but many of them simply do not apply to someone who isn't coding in that environment with that level of experience:

  • AAA studios often employ large teams of developers, many of whom already have extensive experience with C++. The average beginner will be working alone or in very small teams for at least a couple of years, and by definition does not have any background experience.
  • Consoles often have limited compiler and library support, forcing professional to work with what is provided or spend a lot of time and resources working on their own new tool chains. Beginners are rarely (if ever) placed in this environment, and therefore need not be limited in this way.
  • AAA studios have large existing code-bases written in C or C++ and can often save time and effort by building upon that code. The average beginner does not have an existing code-base, and will either be starting from scratch or working with third-party code; as long as there are some good libraries available in their language of choice they should be fine.
  • Professional developers have the knowledge and experience to take advantages of the lower-level access that C++ can provide to write more optimal code, and often need to do this to meet their performance targets. Beginners do not have those difficult-to-achieve performance targets, and lack the experience to make the necessary optimizations anyway.

Indie developers are increasingly using languages other than C++, although it does remain a popular choice. C#, Lua, Flash-targeting languages (ActionScript, Flex, HaXe), JavaScript, and others are being used for their advantages in productivity, and are perfectly capable of providing a performant and professional-quality game play experience.


That being said, you're right that there are a lot of libraries and documentation available to C++ developers of any skill level, and that there is plenty of support available. These are real points in favour of the language -- but not necessarily an advantage given the same is true of many other options as well. I think C++ is a valuable language to learn, and I think it will continue to be a useful language for years to come; but I remain unconvinced that it's a good choice for the average beginner.

- Jason Astle-Adams

Shaquil is not making his point very well, but he is not wrong.


No, it is not a matter of 'being too stupid to learn from your mistakes'

That is not what he said. He said he is too stupid to make them. Which is basically how it works.

You will have more opportunities to make mistakes once you get into advanced class usage, multiple inheritance, and exceptions, but beginners are limited in the mistakes that are available to them. For someone who is just barely more advanced than getting a Windows® window on the screen, using a few classes with no or few virtual functions, and a bit of dynamic memory, the only real mistakes available are related to leaking memory/handles (obviously design issues are not considered here) and bad memory access.

C++ provides you chances at shooting yourself in the foot around every corner, but you are all making it seem as if it is possible to turn 2 corners at once.
We grow up in any language by taking one corner at a time. We turn the next corner when we are ready.




Wrong.
Just because you haven't seen the outcome of your mistakes does NOT mean you have not made them.

That is quite likely true. But the counter-argument is that having a language hold your hand is not very beneficial for your overall growth either. If you aren’t allowed to make mistakes, you aren’t able to learn from them.
I am sure his code is full of errors, and if it is then he will someday have a chance to learn from them, if not now.



As for the actual question, everybody’s growth will be different.
I started with languages that had no manual allocation system, so when I moved to C++ it took me a lot longer to figure out how to properly handle my memory.
If I had started with C++ I would have learned this sooner, but would have had other difficulties in other places.
Some people recommend Python whereas I am glad I have never had to write a line of Python in my life.
Everyone’s learning experience will be different. Why don’t you just pick a language and see how it works out?
Start with C++ and, if it overwhelms you, downgrade yourself to a different language.
I started learning C++ and Glide graphics programming at the same time and I realized it was too much. I took Glide off my plate and focused just on C++ and re-tackled Glide a year later when I had better footing.


The problem with asking people on a forum is that it assumes we know you and your abilities.
Again, everyone is different, so know your own abilities, try the language of your choice, and see how it goes for yourself. Programming in any language is hard and no matter what language you choose you have many years of hard lessons to learn and changes in your mentality and style ahead of you. So just get on with it.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Personally my idea that those so called 'easy languages' are a joke, they are not easy and allow you to screw up very badly as well. My programming history stated with BASIC on a commodore 64, although I never made any serious and larger projects back then. On the PC I started with visual basic, as that was suppose to be easy. Truth is, it's not. My first application made with VB crashed more often then the first project I made with C++, it didn't do what it was suppose to do in lots of cases and eventually got abandoned because the code base was simply unmaintainable. Clearly, choosing an 'easy language' here didn't help to guarantee the success of the project.

In my experience, the language is a minor factor in the learning curve, and your learning method and attitude are of major influence on how easy or hard it will be. Trying to take steps that are to large will undoubtedly result in failure, no matter the language. If you start with learning how to program by making a MMORPG, you will probably not succeed. However if you take small steps, using a good book or tutorial, you should be able to learn any language you want. With some languages you might be able to jump to get more results quicker, like jumping into 3D much faster, however as said this does not give guarantees for the success of the project, as going to fast in any language is bad.

In fact, it's very dangerous to use a so called 'easy language' in order to get results faster, as you may be rushing over the basic fundamentals and jump into GUI or 3D to fast, and eventually the project becomes unmanageable because you rushed over the fundamentals. I'm not saying you shouldn't use these languages, but not for the reason of being able to jump into 3D programming faster. While C++ might have it's raw memory management that needs to get used to (although you don't have to touch that for your first c++ program at all), but a garbage collector isn't something you don't have to understand either, it has several pitfalls and nasty side-effects (object resurrection anyone?) so also for managed languages you really have to understand memory management after all or your project will fail.

In the end, I would say if somebody wants to learn C++ straight away, let him. It may take longer to get a 3D scene up and running, but what is the use in quickly getting simple 3D scene up and running if you then have to throw away your code because you skipped the basics and the code is unmanageable and you have to start all over again rather then extend it into your game? You should set your goals straight, don't try to make a game if you want to learn how to program, learn to program instead. If your goal is to make a game rather then to learn how to program, then you shouldn't use C++, but neither should you use any other programming language, pick an engine with a ready-to-use level editor with a simple (preferably visual) scripting language that allows you to write small pieces of script logic, rather then whole programs. By writing small independent pieces of script code you don't have the risk of getting unmanageable code, as there is no direct relationship between the individual scripts, as with a whole program.

[quote name='phantom' timestamp='1347139809' post='4978107']
Wrong.
Just because you haven't seen the outcome of your mistakes does NOT mean you have not made them.

That is quite likely true. But the counter-argument is that having a language hold your hand is not very beneficial for your overall growth either. If you aren’t allowed to make mistakes, you aren’t able to learn from them.
[/quote]

The problem is that until you see those mistakes you can't learn from them.

You can write C++ code which during an array traversal wanders out of bounds and gets away with it because you've been lucky. You never encounter the error, you never learn from it.
Something like C# is going to very quickly yell at you about doing so giving you a chance to catch the mistake and the algorithmic error which comes from it allowing you to learn.

It's about setting up solid foundations, the ability to reason about a problem and write the code without being tripped up by the little things along the way.

Once someone decides to learn to work with C++ this will give them a sound basis to work from when it comes to programming knowledge and make the transistion to the unprotected world of C++ easier.

This topic is closed to new replies.

Advertisement