🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

did i make a mistake starting with C#?

Started by
18 comments, last by hplus0603 3 years, 9 months ago

@undefined thank you so much for this answer!! This has put a lot of sensein my head right now, and im gonna do just that. I'll continue with c# while also going through some c++ learning. I want to have a better understanding of memory management and the lower lecels you mentioned m thanks!!

None

Advertisement

@Shaarigan amazing answer dude, thank you for your time. i'll defiantly work by that, start making unity games with C# while also learning C++ for more complex projects down the line. thanks again for this explanation!

None

SassyPantsy said:
start making unity games with C# while also learning C++ for more complex projects down the line.

Why do you not study Unreal Engine? Concentration on one thing is a good idea. You can spend all time on C++ (not half of time). I think if you study C++ you will want to start to make games using C++. You will spend time on Unreal. Start to study Unreal Engine and C++ and forget about C# and Unity.

While I do agree mostly with C# being easier than C++ due simpler memory-managment, I also want to make a point at how sometimes C# is so stupidly more complicated to use than C++ that it actually hurts for it to be called a “high level” language. A few examples:

//C++ 
Vector2 v;
Vector2 v2(10, 10);

//C#
var v = new Vector2();
var v2 = new Vector2(10, 10);

Like, wouldn't you expect the “high level” language to have the version the uses less code? And I'm being even generous with using “var” which some people might not even do. Or how about this:

// C# Properties - awesome, sometimes (Unity-example)
meshRenderer.material.color.a = 10; // nope, that won't work.

// thats how you got to do it:
var modifiedColor = meshRenderer.material.color;
modifiedColor.a = 10;
meshRenderer.material.color = modifiedColor;

Now, again please don't get me wrong, C# has some really awesome things that I wish C++ had, but at the end of the day I'm always kind of baffled when I go from the so-called “low level” language writing really compact, easy to understand code and then I get to work and have to do stupid shit like what I posted.

SassyPantsy said:
however i just found out that all of my favorite games were made using C++

This doesn't matter. Any game that a C++ programmer can make using C++, a C# programmer can make using C#. So, if that was the only reason why you worry about your choice, you can stop worrying ?

To be honest with you. If you are just starting out learning how to code the language doesn't matter. Simply because you don't know what you don't know.

That said, you're not even close to being in a position yet to appreciate the benefits of one language versus another or even know why you need a particular feature or nuance that would make a difference in your work flow. Sure you may have an idea, but experience teaches you better.

Therefore, if you've already started down the path of C# then stick it out. As your overall goal initially should be that of becoming a “Good Programmer”. With the right resources C# will give you exposure to everything you need initially to be a “Good Programmer”.

Focus on learning how to write good code. Look up the S.O.L.I.D Principles and study them, keep them in mind while you're learning. Hone your understanding of everything OOP. Truly understand those concepts while applying all of it's parts in your journey. Once you have a good understanding of the language start solving small problems with the language, e,g., while working on your game build utilities for your game, build small utilities for yourself or others.

Once you're comfortable with the language. Continue with C# and start to focus on Data Structures and Algorithms. Again, the goal is to become a “Good Programmer”. Although I'd argue that you're still years off from that. It is an ocean of stuff to lean and the languages are nothing more than oars you paddle with in comparison. If you're not already a member, I would suggest joining something like Codewars and do a couple of those everyday. Nice and focused problems that you need to solve allowing you to hone your skills with whatever language you're using.

Reaching this point with C# you should be able to easily create some pretty useful programs that solve a need to a certain degree. You should also feel comfortable in any space where C# is the main language, i.e., Unity, GoDot, etc. As you're basically left with learning the API's and understanding the architectural structure of the environment you're attempting to work in.

More importantly, at this stage. You'll also come to realize that asking a question like “Should I start with X language vs another” doesn't matter. As you now have the skill set to easily pick up whatever language when needed in a matter of days (requirement of professional programmers), not weeks or months because you've already put in that work with C#. It is at this stage on the road to becoming a “Good Programmer” that as you start to pick up languages like C, C++, JavaScript, Rust, Python, Go, etc. That you discover why they exist, what frameworks rely on them, and why all of that is useful. Again, languages are nothing but oars in a ocean of technology that takes a while to traverse.

So stick with C# for now. It doesn't have to be your main or your favorite language. It's just the first stone laid in the path on your way. Walk it and keep growing. Trust me, you'll know when you're ready to move on and when you should.

As for me, I've been coding for about twenty years. I've been where you are so I get it. I'm a software engineer for a large tech firm. Main language is C#/JavaScript and we use the Angular Framework in certain parts of the software. I've coded in so many languages over my career it's insane. From COBOL to Perl, from Vb 6 to C++.

I'm telling you all of this because you'll eventually come to realize that when it's all said and done the language doesn't matter. Knowing how to code, how to solve problems, how to design solutions, how to adapt and quickly pick up new technology, how to keep up with and understand the ever changing landscape of software development is the real goal.

Take care and good luck.

----------

Ay ay captain. Thanks a lot for this reply. I understand and agree, and ive sat down in front of my goals and realized that i want to make and publish a title in a year, and therefore the language is only (as you said) and oar to paddle with for this moment.

None

FWIW I attempted to learn c++ on my own, but didn't get very far because there's a whole lot of features in c++ and it can be really easy for a new learner to shoot themselves in the foot (eg memory stomping, it can be really easy to accidently overwrite something else's memory with an out of bounds array access – and debugging those can be a pain).

I ended up learning java (like C#) in university. After learning java, I revisited c++ and things made a lot more sense. So I studied C++ after java (while still in university) and now I have a job using c++.

I feel like learning a higher level compiled language before c++ actually helped me with learning c++. I got used to having garbage collection with java/c# then had to learn to use RAII (ctor/dtor) for c++. It was good to contrast the two IMO.

Plus I think a lot of game companies may write tools in c#.

While UE4's tools are probably c++, I know UE4's module system is actually C# files, not cpp. But the game code is written in c++/blueprint(visual scripting). However even in the UE4 c++ code there are “events” and “delegates” which I *think are based on C# concepts.

So, I'd stick with learning C# first. then visit cpp after you've learned it and made a small scoped project or two using C#. After that learn to do everything you know how to do in c# in cpp. That will strengthen your knowledge in both languages.

My tutorials on youtube: https://www.youtube.com/channel/UC9CQOdT1A9JlAks0-PF5vvw
Latest Tutorials:
A simple and intuitive ray triangle intersection algorithm https://youtu.be/XgUhgSlQvic

Möller Trumbore ray triangle intersection explained visually https://youtu.be/fK1RPmF_zjQ

Setting up OpenAL c++ visual studio https://youtu.be/WvND0djMcfE

Every game that shipped in Unity in the past few years, is a C# game.

Every game that shipped on the Xbox 360 with XNA Live Arcade, was a C# game.

It's totally possible to ship fun games in C#.

The path to learning game programming can be broken into these four steps:

  1. Learn to program.
  2. Learn to program well.
  3. Learn to program the machine well.
  4. Learn to think well about programming.

You're at step 1. C# is fine. For step 2, C# is also fine. For step 3, certain parts of the machine can be pushed by C# just fine – configuring textures/shaders, for example. Other parts, will start benefiting from the lower level control of C++ or Rust. For step 4, you will find that higher-level approaches, like Haskell, have more to offer. Once you're past step 4, you will be able to pick the right tool for each job! The journey there is long and exciting, and exactly which path you take, doesn't matter as much, as keeping walking the path!

enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement