Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How much more difficult is it to become competent at C++ in the real world compared to C#?

Discussion in 'General Discussion' started by CodeSlug, Sep 19, 2021.

  1. CodeSlug

    CodeSlug

    Joined:
    Feb 17, 2018
    Posts:
    132
    Since C# is the official scripting language of Unity I thought it would be a great place to ask this question.

    What kind of analogy would be used here?

    Is there any real benefit in investing crucial and limited time in learning C++ as opposed to investing all that time to master C# if you are most likely never to use C++?

    This "under the hood" benefit of C++ to know whats going on under the hood does that have any merit in building a 2D indie game or working in C# and Java?

    I heard someone say it's like comparing driving an automatic car to a helicopter.

    Or its like comparing learning how basic electricity works vs quantum physics.
     
  2. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,357
    eh, it's more like driving an automatic car vs driving a car with a stick-shift. You'll learn some, but it's really not all that different.
     
  3. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    you didn't say what your goal is though
     
  4. CodeSlug

    CodeSlug

    Joined:
    Feb 17, 2018
    Posts:
    132
    Digital Image Processing like software to work with finger print scanner, iris scanner, website databases etc

    Also Artificial Intelligence.

    And also simple 2D games as a hobby.

    My final year degree course in Business Computing titled "Image Processing" has MATLAB for some weird reason even tho there was hardly any math even discussed in the first 2 years.

    https://www.amazon.com/MATLAB-Pract...p-0128154799/dp/0128154799/ref=dp_ob_title_bk

    ^ This is the book they said I should get. Would learning C# be beneficial at the same time?
     
    Last edited: Sep 19, 2021
  5. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    It's really unlikely you're ever going to use c++ unless you're going into low level software. There is merit to learning lower level language, as you'll have a better understanding of how memory gets managed, but this is very academic.

    Most of the time domains have a dominant language, for example:
    • Python is super popular in AI circles and more or less anything trendy that isn't using JS.
    • C# is probably the dominant language in gamedev because of Unity. I've heard of efforts to add C# support to unreal.
    • MATLAB is used quite a lot for mathy stuff, of which image manipulation is one.
    • JS is obviously the major language for anything web related.
    • Java is pretty common for non-tech business internal dev, although some shops prefer C#.
    I think vanilla c is actually more in demand than c++ in practice, although this kind of low level coding is rare across the board.

    I could be off the mark on some of those, I've been out of normal dev circles for a while now and things change.
     
    Ryiah, Meltdown and PutridEx like this.
  6. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,120
    I might be stoned for this, but JS is now very much in the desktop and can do most things you'd want from an application. With some exceptions(low level stuff, performance sensitive stuff).
     
    Ryiah, angrypenguin and frosted like this.
  7. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    Yeah that doesn't surprise me. Again, I've been out of normal business dev for a clip, but JS was becoming more or less the dominant language (cuz everything is so internet centric). That it's common on desktop now makes sense.
     
  8. CodeSlug

    CodeSlug

    Joined:
    Feb 17, 2018
    Posts:
    132
    wow thank you very much for guiding me accordingly.
    I didn't like C++ either and didn't want to have to learn that.

    My degree doesn't even use C++ it just uses Web development languages it is mainly just C# and JS and Database Design and Management with 1 final year semester of Image Processing with MATLAB. Not sure the purpose of that image processing module is considering the degree is mainly Computing and Information Systems but they have been updating these IT degrees in recent times to be more relevant towards what employers want, this is their reasoning is what they have said in adding a complicated module like Image Processing to what is otherwise usually considered a IT Business Degree.

    To me this module is rather strange indeed the 2 major new modules they updated were "Cloud Computing" and "Image Processing"

    According to this link on the university website

    https://rl.talis.com/3/anglia/lists/AB2CB8DA-06E0-C793-5BAE-AC2EFFC5A26C.html?lang=en-US

    ^ they require me to learn programming with python and machine learning for the Cloud Computing Module.

    I think this is a safe bet to say that I should just focus on C#, JS, SQL, MATLAB and Python?

    Since this is all that is required for my Business IT degree?
     
  9. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    Seems like a good list.

    I tried to find some lists of most popular languages but they're all over the place and totally nonsense.



    This is probably pretty representative by how useful something is in the job market. I saw some other lists but they were usually nonsense.

    This chart is from linkedin:


    This one is probably nonsense with c in first place. I figure a lot of job openings say they like seeing c on a resume, but the job doesn't actually involve writing c.

    You can actually kinda compare those two charts - the first one is questions to stack overflow - so that revolves around how much people are using those languages the second is what keywords job posts have listed (but does not reflect what you will actually be doing most of the time). Like R is above JavaScript...you gotta be kidding me.
     
  10. CodeSlug

    CodeSlug

    Joined:
    Feb 17, 2018
    Posts:
    132
    Thank you for this wonderful insight, it is a good indication of what I need to do.

    I shall follow my Business IT course module and do as they say which is to learn SQL, Javascript, C#, Python Machine Learning and MATLAB.

    The only odd one out of the entire list is MATLAB but maybe they know what they are doing if it is employers are seeking things like understanding of Image Processing etc. To come to think of it, iris scanning and face recognition and these things are indeed becoming popular so I best learn it to the best of my ability
     
    frosted likes this.
  11. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
    You can probably work with AI and image processing just fine without getting into C++, or if you do it'll be very limited, like really simple OpenCV stuff (and some OpenCV stuff works with C# I know).

    Matlab seems weird to me outside of an academic context, or working with academics, but who knows.
     
  12. Deleted User

    Deleted User

    Guest

    Not accurate, there's no single dominant language in gamedev :)
    C# is popular for project scripting in engines friendly to small teams. Unity itself is immensely popular in 2D & mobile, but that's it. If someone doesn't pursue these areas, C# might be irrelevant.

    Efforts to add C# to Unreal are... how to say it gently... it's nice, but terrible so far. Anyway, it would be only some 2nd-class citizens, for people who are emotionally attached to C#.
    C++ is the standard way of programming in Unreal and it gonna stay this way. The same for any other major engine: Godot (C# is an option) and... Unity (written in C++, after all). These engines might expose other scripting languages (often used only by designers, not necessarily by people with "programmer" role). C++ itself doesn't go anywhere.

    No. Master any single language. Learn others on the go, if you need them. Programming languages are tools like any other.
    Most of the languages won't be a challenge to learn once you master C# :)
     
    angrypenguin likes this.
  13. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,134
    Ironically these are fields where C++ has limited popularity. For AI the most common language used is Python and in fact the Unity Machine Learning framework uses Python. For digital image processing C++ can be helpful if you want to write Photoshop plugins but otherwise I would use Python for that too since it's a field that combines AI.
     
    Last edited: Sep 19, 2021
    TonyLi, CodeSlug and Deleted User like this.
  14. SmShadows

    SmShadows

    Joined:
    Jul 14, 2016
    Posts:
    9
    You need to view languages has tools and C++ is a very complicated tool compared to C#.

    C++ is bloated with features and you can look at diffrent projects source code and you would almost think they are using different langage. The complexity makes it harder to learn and to master. Even editors and tools can't keep up with C++. Also compile time is horrible on big projects.

    People are still using it for legacy reasons, but it would be better to use a simpler langage that accomplish similar goals.

    C# was designed after C++ so the creators were able to learn from past mistakes. Even tho they don't accomplish the same goals, for what it can accomplish, C# is a far simpler and better tool to use.
     
  15. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    To be frank, the sheer volume of unity releases alone probably places C# as the dominant language for game dev across the board. This will, most likely, only increase going forward in the near future, since unity is the default engine in academic settings.

    "If you are updated about the gaming world, you might already know that Unity 3D has a 48% market share whereas Unreal Engine is standing at 13%." - https://www.valuecoders.com/blog/technology-and-apps/unreal-engine-vs-unity-3d-games-development/

    That could be bogus, but it sounds pretty plausible. If Unity is literally half the gaming market then that qualifies as dominant :p
     
  16. Deleted User

    Deleted User

    Guest

    Not exactly relevant to the programmer. If most of these games are quickly made mobile games, like 10 mobile games made while only 1 Unreal made in the same time... does it matter how many games are based on what? If one C# programmer would work on many more titles than a C++ programmer? Obviously, that is pure speculation.

    Although Unity is much better suited for smaller games/teams than Unreal, especially 2D. And many teams switch to Unreal while their games/teams grow. It might be safe to assume there are many more programmers working on an average Unreal game than Unity game.


    I mean, I'm interested in a discussion related to the original question.
    Only the number of jobs (and job openings) is relevant here. That's why sources like that LinkedIn chart above are relevant to people. Not an amount of games released on the market, which isn't even an indication of the revenue (and programmers participating in revenue share) made by these games.

    What's more. What truly counts on the job market is how many programmers are available for given language/technology, and how easy is to learn it. If there are many JavaScript programmers available, such a job would pay less.
    In Poland experienced C++ gamedev programmer earns much more than a web developer. But junior Java programmer would earn much more than me in gamedev for many years :D

    I don't think the amount of released games indicates anything. Games are too different.
     
    Last edited by a moderator: Sep 19, 2021
  17. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    So this is the OP's stated goal.

    simple 2d games is the third priority. And it's a hobby.
     
  18. CodeSlug

    CodeSlug

    Joined:
    Feb 17, 2018
    Posts:
    132
    Hi guys I had a look at the books required and the coursework for one of the modules I must take for school involves Network Programming using C, the name of the module is Ethical Hacking and requires knowledge of C programming to implement, I am guessing this is for creating scripts possibly?

    Is C the dominant language in Network Hacking?

    Also I hope C is a lot easier to learn than C++?

    I suppose it is best I start off with C and then move to Python? would this be a good plan? cause most of the course appears to involve Python as the main language.

    I decided to follow this guide I found, hope this will be enough for me.

    This playlist consists of 200 videos but they are short and straight to the point, I get the feeling that C is easier and takes less time to learn than C++

    This guy put so much work into giving away 200 free videos of such high quality

     
    Last edited: Sep 19, 2021
  19. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    The problem with the linkedin chart is that it was doing job posting keyword count. Many jobs may mention C but they won't actually be C jobs. That's why the stack overflow stat is likely more accurate - as this reflects what the body of the work itself is.

    In the US javascript developers make about $10,000 a year more than c++ guys (on average). Java developers also make slightly less than JS developers. C developers also less than JS. GameDev generally pays the worst of all the tech sectors, because people will take less money to work in a sector they are emotional about.

    Maybe it is very different in poland though!
     
    Deleted User likes this.
  20. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,134
    Only in the sense that there is far less to learn.

    C is a major language for writing network firmware and drivers but that's it.
     
  21. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    You could learn python and a couple of other languages in the same amount of time as it takes to be come pretty feisty in C++.

    These days it's best to pick the right programming language for the job. AI would like you to be proficient in python for example, as would a few DCC apps.
     
  22. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,134
    I'm going to be blunt here. Your posts read as someone who has been told they should learn C++ but aren't aware as to why they should learn it. If you just want to learn it for the fun of learning a new language then by all means go and do it, but if you feel you need a reason then in my opinion you should just skip the language altogether.

    While some in this community will likely disagree with me in my opinion unless you have a very sound reason or just want to do it for fun you should not bother with C++ at all. Once upon a time it was the language everyone pointed to and said you should learn. That ship sailed a long time ago.
     
    Last edited: Sep 20, 2021
    Martin_H and frosted like this.
  23. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    There's also just a mystique around lower level code. Generally people think of lower level coders as more "hard core" than higher level, so they have a bigger e-peen in some coder circles.

    Truth is, all code is 90% trash regardless of high or low level.
     
  24. CodeSlug

    CodeSlug

    Joined:
    Feb 17, 2018
    Posts:
    132
    Hi the reason I thought I had to learn C++ is because people told me that it is necessary to know what is "going on under the hood" otherwise you would be a bad developer and that unless you learned C++ first you would find it very difficult to learn other languages.

    My uncle who is a 80 year old computer science professor told me that the only way to learn programming was to learn C++ first and that if I did as he said, I would be able to pick up Java and C# and every other language with almost 0 effort. He said once you know C++ you basically know everything else.

    He said if I learned C# first it would be confusing and hard to learn something like Java etc

    This is why I thought maybe C++ is the god father of programming or something.

    However I think you are correct on this, I should just skip this C++ as I have absolutely no use at all for it nowhere where I live asks for C++ and I don't plan on doing anything that involves C++.

    Even my Uni course specifically asks for Python and Matlab with the exception for C to do the network programming module. I feel I my time would be better spent on C since it is probably a lot quicker to learn that and complete the necessary assignments. I think they only require a little bit more than basic understanding of C to complete the network assignments.

    The bulk of the work seems to be done in Python and MATLAB

    My big dream is AI / Machine Learning and well (2D Game Unity development as a hobby.)

    I decided to go through the 300 page book on C Programming 1979 by Dennis Ritchie, to me it is far far shorter and easier than the 1200 page book by Bjarne on C++
     
    Last edited: Sep 20, 2021
  25. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Sounds like bad advice, sorry.

    Codebases are so vast these days that they're basically several languages. And you can learn under the hood anywhere. Those are not lofty concepts.

    Learn python then. Unity uses python for AI. Stop thinking about C++.

    Did you even try to do AI in Unity? go find out. I'm incredibly unimpressed so far. You're sitting on one of the best engines for doing AI research in and profess your big dream is AI.

    Then:

    >ignores unity
    >ignores python

    Best fix that mate -> https://forum.unity.com/categories/ai-navigation.542/
     
    Martin_H likes this.
  26. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
    Considering that C# is practically Java this is completely insane

    The only real distinction I know of is that C# is pretty structured around OOP, while you may not always use that in other languages. But I'm pretty sure most of the common languages are the same.
     
  27. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,134
    Sorry, but your uncle being 80 years old should have clued you into the fact that this advice is fairly old. Once upon a time computers were simple enough that understanding how C++ worked largely taught you everything needed to understand how computers functioned. That's yet another ship that has long since sailed.

    A modern computer is practically on the level of a supercomputer from a couple decades ago not just from the aspect of performance but from the aspect of how everything works internally. A processor, for example, used to be just fixed function hardware with some registers. Today it's practically a computer in and of itself.

    Modern processors have their own instruction sets (microcode), their own memory (the caches), etc.

    That said he's not incorrect that knowing C++ greatly assists with learning C# and Java but that's not because it teaches you everything but because those languages belong to the same family of languages. For languages that belong to other families (eg functional languages) it's a different story. Learning C++ won't make Lisp easy.
     
    Last edited: Sep 20, 2021
    Deleted User likes this.
  28. CodeSlug

    CodeSlug

    Joined:
    Feb 17, 2018
    Posts:
    132


    WOW thanks I didn't even know this existed.

    I was on this forum a few years ago but dropped my 2D project because I decided to save up some money and go back to school to focus on a course. So I spent a lot of time doing things like web design and database design.

    Covid had hit and I lost my job so I couldn't finish my final year cause no funds I decided that it would be a great time to focus and get back into programming which is why I picked up C++ based on these bad advice I was given.

    Since I have all the time now I will follow your link and check our AI/ML in Unity I honestly never even knew it existed.
     
  29. CodeSlug

    CodeSlug

    Joined:
    Feb 17, 2018
    Posts:
    132
    Yes he is a strange fellow he is also a microsoft die hard person he even told me Linux and open source is a dead market and that I should focus on Microsoft platform. But me thinks now it is just his age, he taught C++ for 30 years so I suppose its easy for HIM.

    He was also a Physics professor and his hobby is quantum mechanics, but for whatever reason he is really out of touch with technology.

    He doesn't have a smartphone because he doesn't know how to use one.

    Most bizzare is he doesn't own a smartphone because he says he doesn't see what purpose it could serve and interestingly he has no clue how to use win rar I once tried to teach him how to unzip a file in win rar and it was like teaching rocket science to a chimp
     
    Deleted User likes this.
  30. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,134
    People and the computers from his generation are very different from ours. You had to be very passionate or you simply wouldn't stand a chance. His generation was known for not only being very good with computers but being able to design and build them from the ground up with whatever components they could find.

    I wouldn't necessarily write off his advice but I would take it with a grain of salt because these are people who were able to pick up programming with practically no learning resources available to them and some of them even wrote the learning resources that were available.
     
    Last edited: Sep 20, 2021
    Deleted User and CodeSlug like this.
  31. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    If you want to work with console game development you will have to fiddle with C++ at some point. You don't need to master it, but you'll be limited if you can't at the very least compile a native plugin or make sense of the occasional IL2CPP crash dump.
     
  32. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,134
    I'm currently finished my work on a project targeting the PlayStation 5 and Xbox One/S/X, and while I have used my knowledge of C++ to assist me with making sense of the APIs every time where it would have been necessary to progress I was able to find a solution by simply searching, asking on forums, or contacting support.

    We ordered two dev kits but ultimately our other programmer was busy with other tasks so it fell to me to do about 95% of the actual work porting the games. In all that time I never needed to look at IL2CPP crash dumps. Prolific usage of Debug.Log were the bulk of my debugging process with some C# stack tracing for the rest.
     
    Last edited: Sep 20, 2021
    Deleted User likes this.
  33. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,645
    Lol, easy...if you dont want to waste time learning C++, as opposed to C#, then use UE, or any other engine like FLAX, that supports both C# and C++... Stop wasting time and make a competent decision. Pick the engine that supports your coding skills, and supports your requirements...
     
  34. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,514
    I think the whole question about whether or not to learn a language specific language, or discussion of which language is "best" to learn, is fundamentally misguided without further context. It perpetuates this idea that a language is some major undertaking, or some part of your identity, or... well, something more than just a tool you use when the need arises.

    If you want to be a good programmer then you really ought to learn a bunch of languages. Each has strengths and weaknesses, and learning them will broaden your perspective to different approaches and thought processes.

    Personally, if you want to be a game developer then at some point C++ is a very good candidate to be among the languages you learn for a variety of reasons. One is that it'll help you demystify many a game engine that you'll use. Another is that it forces you to get hands-on with stuff that other languages won't even let you touch. And while some will argue that these things are academic or related to peoples' e-appendages, it's stuff that's assisted me on a regular basis even when not working in the language itself. Plus, if you want to get a job in a studio, there's a good chance that C++ will help with that, because it's still the most common language (as far as I'm aware) for engine development.
     
    Last edited: Sep 20, 2021
  35. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,134
    Care to expand on this? I can't think of anything C++ does that pertains to game engines that can't be learned through another programming language. If you want to demystify game engines you do it by building an actual game engine.
     
  36. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,514
    Aye, that's one good way. Another way that could be pursued as well or instead is checking out game engines that already exist, and the majority of the major ones are written in C++. Another thing that might help is reading books on the matter and, skimming my bookshelf now the relevant books I own happen to all use C++ as their chosen language. Small sample size, but memory of books I don't own suggest it's common.

    When you're building your engine for learning purposes there's a good chance you'll want to integrate some middleware or other 3rd party libraries. Last I checked most game-related libraries are written in C++, so it's helpful there too. On a similar note, if you want to contribute to existing open-source (or similar) engines then... there you are again. When I've attended game dev conferences and seen programming talks most of those have been C++ as well, with the obvious but notable exception of Unite. There's a huge amount of momentum still behind the language, so even if the prevailing winds do change direction for engine-level code then there's still a good chance that we'll be running into it for quite some time... assuming that we don't restrict ourselves to the scripting systems of other people's existing engines. Even sticking to working in Unity / C#, I've found my general understanding of how "old school" game programmers approach things in comparison to .NET C# programmers to be quite useful.

    Basically, if you're trying to learn game programming in an engine-agnostic manner then there's a good chance that you'll be running into C++ quite a bit. Including it in your repertoire is likely to be useful. Also learn other languages, they're useful too. :)
     
    Deleted User and Ryiah like this.
  37. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    Going back to the OP's stated goal, quoted above, as far as game making is concerned it sounds like they just need to know how to ride the motorbike, not build one.

    In perfect world where time is infinite I can see value of learning all things, but things like building a game engine to learn how they works I think is a serious time investment that might actually detract from a different goal of "making simple 2d games."

    To be honest I think you could probably builds dozens and dozens of games and have about 1% knowledge how the game engine even works under the hood... these things are pretty sophisticated and do most the hard work for you... case in point, myself. I got no clue what is really happening most of the time, but I can make simple games and solve most problems quickly by simple troubleshooting methods, even if I don't understand what I'm actually doing at deeper level.

    That's all just to make a counter point to general conversation: making games can be pretty simple, you don't have to have deep technical knowledge, you only need some rudimentary troubleshooting methods to follow.

    To the rest of the OP's question though about learning languages for other purposes I can't say anything, but if just making simple games as a hobby is the goal, I say waste no time learning prerequisites, just go until you hit a problem, then learn whatever necessary at that point to solve that specific problem. You'll get to your goal faster that way.

    The only prerequisite i'd point to is know the scientific method - it's surefire way to figure out what you don't know every time - and maybe study the military problem solving* model too. From there it's only matter of patience and creativity.
     
    Shreddedcoconut likes this.
  38. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,134
    Ah. You meant learning it to understand existing source code which in retrospect should have been obvious but I was stuck on the idea that it was being used to understand the hardware and whatnot. :p
     
    Shreddedcoconut likes this.