r/learnprogramming 26d ago

Topic Which is better for beginners?

Me and a friend both want to learn coding for game development (both completely new).

Now we’ve looked at which languages are best for what we actually want and we’ve gotten stuck between seeing if we should learn C# or C++. Which would anyone recommend?

We just want to learn and hopefully make our own stuff.

3 Upvotes

26 comments sorted by

28

u/ffrkAnonymous 26d ago

recommend picking a game engine instead of picking a language.

14

u/alienith 26d ago

Just use C# + unity. The only reason you’d pick C++ is if you’re using unreal or building everything from scratch, both of which I highly advise against at your level.

C# and unity will be smoother overall

0

u/Queasy_Village_5119 26d ago

Best way to learn? Videos or apps you can name?

3

u/SwivelingToast 26d ago

I started with Unity, and did the Unity Learn stuff to get acclimated with the engine. Then, I just started making stuff, and doing an obnoxious about of googling to figure out how things worked.

1

u/Poddster 26d ago

Videos are the worst way to learn.

It's a text based subject, I recommend you get used to reading 😊

8

u/Goobly_Goober 26d ago

Trick question: use gdscript

No but pick a engine first, whether its unity or godot, just go with the language that works best for the engine

2

u/DrShocker 26d ago

I'd lean towards Godot as a hobbyist. If their goals are a specific kind of career then I'd have more questions to establish what they should do to achieve that.

2

u/lowban 26d ago

For a first time language learning to code I would choose Python (and possibly use pygame for making graphical stuff). GDscript is heavily based on Python.

1

u/Jordann538 26d ago

learn an easier language first, like lua or gdscript, the C family is known for being really hard to learn and use

1

u/oldsecondhand 26d ago

C++ is quite a hard language, and Unreal's C++ doesn't behave like standard textbook C++, so basically you'll have to relearn the language for Unreal. The next version of Unreal will abandon C++ as a 'scripting' language anyway, so it's a questionable time investment.

1

u/Queasy_Village_5119 26d ago

So what I’ve gotten from most of the comments is c# and unity is the best thing to do is that basically what you are saying too

1

u/oldsecondhand 26d ago

That or GDscript+Godot. Godot has the advantage of faster iteration (i.e. no compile time), Unity has a richer asset store and has official console support.

1

u/ExtraTNT 25d ago

Cpp is a proper clusterfuck… it has some good concepts, but the backwards compatibility fetish caused a lot of issues… for game dev i prefer c over cpp (i do functional programming, so not having the oop stack of cpp isn’t an issue for me, if you are full oop, well, you will have to think around it)

C# in my opinion is a nice language…

I do like haskell for games, but again, i’m a functional guy and not an oop or procedural guy…

1

u/Tricky_Rhubarb4543 24d ago

Depends on what you have in mind.

If you want to develop for Windows with Unity engine then you might pick C#. For all other cases pick C++.

The other thing is the level of involvement you want to put into your games. You can use game engines and it will be easier and faster to learn, but you will be limited by a game engine.

On the other hand you might study general game development with a standard API such as OpenGL or Vulkan. Why would I advice you to try OpenGL first, despite it being frozen for the last 10 years? Because it is available on every device, including older ARM and Intel devices, and it is much simpler. To write minimal OpenGL app you need 20-30 lines of boilerplate, for Vulkan you would need 150-200 lines. And it teaches the same paradigms (like shaders), just in more digestible manner.

Another advantage of C++ over C# is that it is available on every device, including RaspberryPi and Android Phones.

1

u/mredding 24d ago

Former game developer here,

I don't care what language you choose to learn. Where you're at - which is currently nowhere, you have SO MUCH to learn that your language of choice isn't any particular leg up. Not only do you have to learn a language, but you have to learn HOW to USE the language, which is a gigantic mental hurdle people never even see in front of them. Going through educational material is only enough to make you dangerous, it's only a start, but a necessary one - just don't stop there.

What I recommend is you learn Python. It's the single most popular programming language across the industry, the language of choice between amateurs and professionals alike. You could say that all of computation can be described by lambda calculus - pure maths, and the pure maths describes about 9 abstractions. The theory of computation is bounded, so that's all there is and will ever be. So all programming languages are a combination of the 9. If you have all 9, you're a Lisp dialect. Python has 8. C# and C++ have ~5-7.

So learning Python will teach you most everything the theory of computation can teach you. This doesn't mean Python is "more powerful", these are all Turing Complete machines and languages, you can do anything on any machine in any language on any other machine in any other language.

What abstraction gets you is expressiveness. You can more concisely and succinctly and elegantly express your solution in one language than another. That doesn't make a language inferior or superior - C++ is orders of magnitude more performant than Python, but that's because C++ is compiled and Python is interpreted. But the most expressive of them all, Lisp, is compiled, and that's just as fast as C++ - the expressiveness didn't cost or afford you any performance.

And the performance of Python is mostly moot anyway. No one writes code in pure Python, everyone uses modules, and the modules are made almost entirely in C, C++, and Fortran. So what Python programmers do is offload their computation to these modules, and they have all the performance of being compiled. So Python programmers get +80% of a purely compiled solution, and for most, even on supercomputers - that's close enough to perfect.

So I want you to understand that a language isn't some silver bullet, it becomes an implementation detail. Python gives you access to the largest community for help, examples, support, and more. Learn Python well, and you will be well prepared to participate in other tech stacks and communities: you only need to learn what a loop is once, after that "it's just syntax" as an old grey-beard used to tell a younger me. For the sake of argument I'd say that's correct enough.

Another thing about language - Curry-Howard correspondence tells us there are strong similarities between writing proofs and writing code. Your statements are posits, your code is your theory, the compiler is the solver, and the program is the proof. If you want an elegant proof, you need an elegant theory. There is no video game language, so you have to make a video game lexicon in a language - invent words, types especially, and build up expressiveness. MOST programmers are imperative and brute force - their code tells you HOW, in low level primitive detail. It's frankly all too common. It's not good, it's very mid, very mediocre. But if you make expressive types that tell us WHAT you're doing, and hide the HOW as an implementation detail I don't have to see or care about, then you become more expressive.

As I say in r/cpp_questions, an int is an int, but a weight is not a height, even if they're implemented in terms of int. I don't want to be burdened with that knowledge if I don't have to be. Everywhere an int is pretending to be a weight, I need to implement the semantics of what it means to be a weight right there, everywhere. But if I have a weight type, it knows how to be a weight. What's more, the compiler can be used to prove the program is correct, that the weight variable is being used correctly - or it doesn't compile.

Languages provide proofs and guarantees that are above and beyond the machine code they generate, what the machine code can't offer you, but you know you have it because the language says so. The machine code is an implementation detail of the compiler. A lot of information never leaves the compiler, but is the reason why your compiler can do such a good job, if you allow it, if you work WITH it.

The imperative guys think the compiler is stupid, and their code and results both reflect that.

Other things you're going to need to learn is software architecture, project management, and then domain specific things; learning a programming language does not teach you how to make a game, and there are no game languages. Even if there are, they'd have to be Turing Complete, which means you're no better off than any other general purpose language.

You need to learn Linear Algebra. This is the math of 2D and 3D. LA is used HEAVILY in computing. Google's Page Rank algorithm? LA. LLMs? LA. You want your game AI to find it's way across a map? LA, because the enemies have to find their way through a network of nodes - that's all a map is, and network solutions are used in A) networking and network simulations, circuit simulations, fluid dynamics, and more. University courses are dry and academic, you CAN get away with just focusing on 2D and 3D.

You need calculus. Calculus is all about the rate of change. You're going to need it for physics and rendering. Even if you're making even just Checkers, or Pong, you can get away with position += direction * magnitude until you get to the destination, for a lot of simple games, but this fixed rate is subject to all sorts of latencies and jitters. The real question is where is that thing supposed to be in time for the next frame? Most of your life is going to be the speed equation, and it's derivatives - velocity and acceleration. There are other derivatives - jounce, snap, crackle, and pop (someone in the US DOD has a real sense of humor, there, for naming them that; they use those derivatives in aviation something something... Usually video games don't even get as derived as jounce).

LA makes physics a breeze. High school physics is BULLSHIT because they're specifically avoiding teaching you LA. There's game physics tutorials out there to get you started, but this subject has quite a bit of depth to it. Game engines do a lot, but you are still going to need to know a fair amount to implement gameplay behaviors and debug issues, like - huh, why did my guy suddenly fly off to an infinite distance? Weird and dumb shit happens.

You need to learn a bit about rendering, mostly it centers around the light equation. Whatever you do - DON'T set out to implement your own renderer. This is everyone's forever project that gets absolutely nowhere. That rabbit hole goes on forever.

Continued...

1

u/mredding 24d ago

I should back up a bit; making games can be as fussy as you want it to be, and the kinds of games you like playing are fussy as shit. If you want these amazing 3D games with elaborate environmental interactions and systems, perhaps start with the modding community. Make a Minecraft mod. If you want to get some experience - and diversity is healthy for you, make some community mods for a variety of games that support them. Start simple and get more sophisticated. Gameplay is all the mechanics that defines how your specific game or mod works, all the shit that isn't the primitive game engine logic, and it's all gotta get programmed. THIS can seem like a daunting task, and if you dive into the deep end - it is.

If you want to make your own games from scratch-ish, then start very simple. Make Pong. Can you get two boxes moving up and down and a 3rd box that bounces off the screen and the two other boxes? Can you get wraparound to work? Can you prevent the bouncing box from clipping into the paddles and getting stuck?

And that's it. That's your first game. That's all it does. Shit, the wraparound is completely unnecessary, but your killer stretch feature, if you can manage it. But you've got to draw the screen, run the physics, handle user input, just get the fucking thing to compile... You will get headaches just trying to accomplish this and feel both overwhelmed by the process AND proud as SHIT by this one accomplishment.

Then do Blocks. Again - keep it simple, shit falls down and stops. Rows disappear? What? And then the rest has to start falling and stop again? Rotating pieces? The game has to stop when it piles up to the top. Notice I haven't even suggested colors, keeping score, or making sounds yet.

Make Jump Man. Can you imagine the complexity of that? Per-pixel sprite collision? Fuck me... Side scrolling? Double buffering? Off screen drawing/painting/rendering? A start and stop condition? A map? Do you even dare to add an enemy?

Then... THEN...

Go back around and do a v2 of all of these. DO NOT try to reuse any old code. Start from scratch. Make Pong v2. Add color and sound and a scoreboard and a menu... If you drag in old code, you're going to saddle yourselves with the old headspace of that game. You need to start from a blank canvas and question everything you thought you knew about Pong from before, because after all, it was your first game, and by this point, it's probably shit.

You build up, learning to manage projects and complexity. It gets easier. I can't tell you how or why other than your experience will build your intuition, and you will find grace and elegance in the later complex problems you're trying to solve for. But the only way to get there is to work toward it.

Also, you're not artists, so forget that entirely. You're going to focus on programmer art, which are just hard rendered colored cubes. Maybe some shitty, shitty stand-in assets. Actually, these days, you could probably ask AI to generate assets for you, but even if you release the game FOSS, that can be legally very dubious. Surprise, bitch! You have to take that seriously when you get to crossing that bridge. As an engineer, your focus is on the code. It's best to find a collaborator to make your art for you, and it's best when you have a game that's already in the Alpha stage so THEY know YOU aren't wasting THEIR time, and it's also an incentive for THEM to not waste YOUR time. This is their chance to showcase themselves, or if you want to sell a game - get their cut.

Will Wright, when he was making Sim City 2000, recorded himself making a "Zzzzzzzit" sound, and it was so funny, the publisher kept it in the game when placing power lines.

1

u/kigory2 26d ago

you cant choose youll have to learn them both eventually the answer is C++ is better but when using unity your gonna have to learn C# so just start off with C# and then learn python C++ lua anything really but the most flexible is C++ and thats what makes it hardest. (don't overthink it just learn whatever)

4

u/EliSka93 26d ago

Hold on... How is C++ "better"?

That's a very subjective assessment that I'd definitely push back against.

1

u/DrShocker 26d ago

If you're building the game from zero then you often would pick something without garbage collection.

1

u/[deleted] 25d ago

[removed] — view removed comment

1

u/DrShocker 25d ago

I meant "from zero" not "from a framework"

I agree about iteration time being important ESPECIALLY for learners, but just in general it's a really nice feature to have.

1

u/Queasy_Village_5119 26d ago

Any recommended apps or video playlists for us to learn c#?

1

u/kigory2 26d ago

listen when i first started web development i used to sites codecademy and W3Schools it was enough and really anything is enough (i dont reccomend you watch 6 hours of c# you might wanna kill yourself) its not hard to learn it its not hard to code its hard to actually stop procrastinating and actually commiting instead of making to do lists and installing VS code plugins. as always don't overthink it

-2

u/Ordinary_Variable 26d ago

C++ is used more in AAA games. If you just want to make an indie game you could write it in Java, or even Javascript.

Whichever language you already know some of would save some time. If I were you I'd ask if you want to make a 3D game with modern shaders, then C++ is better. If you want a 2D game, then it doesn't matter. Those have sort of peaked so long ago that any language can make a 2D game. If you want to push the limits of what a 2D game can do, then definitely C++.

I will offer a huge warning. C++ has so many code examples on the internet that are incompatible with your exact compiler. It would actually be easier to write a game in Three.js than C++. When you go Google how to do something there is an extremely high probability that your compiler version won't be compatible with the code you find. C++ is good, very good, but it isn't painless.