c++ or c# for 2d and 3d game creation?

Started by
36 comments, last by Kylotan 7 years, 3 months ago

How come nobody is suggesting C++ and UE4? Is Unity really that much easier?

Unity is much easier than Unreal.

C# is much easier than C++.

In the absence of any other criteria, Unity should be the first choice.

Advertisement

instead of Unity I'd go with

Otter2D

or

Duality

both use C#

both are for 2D games

both are great for beginners learning to program games

make pong
make asteroids,
make a platformer
make a side scroller
make a tower defense

you'll learn tons of stuff

you can make 2D games with Unity, but Unity just has too much stuff
Unity was built for 3D games first and the 2D stuff was added later

so in my opinion its better to start off with something designed for 2D from the start
then once you get a hang of it move on to Unity and 3D

as for C++, I think C# is probably easier for a beginner to learn

and I only know of two C++ engines (frameworks) --- but I'm sure there are many more

Unreal

SFML

SFML isn't bad --- Otter2D is built on top of it

https://www.youtube.com/playlist?list=PLB_ibvUSN7mzUffhiay5g5GUHyJRO4DYr

but for learning to program, I'd still start with C#

Stardew Valley was made in C#

and it might have been the biggest Indie hit of 2016


Unity - is not that good to start with. It is good when you know c# well. Take C# and monogame, it is less complicated than ?++, you can start making things faster. You can always start to learn C++, better not to rush


That brings up some interesting points.

There's so many good ways to get started and probably the most important is to "get" started rather than which way you get started. There's a lot of good advice in this thread.

Probably it would be good to try several different things to understand their advantages for yourself. But don't jump around so much that you never learn anything. Especially at age 14 maybe try each one for a year and that doesn't mean you have to stop doing the previous one just because you're trying a new one.

Unity probably is a good place to start off at first. There is a lot to like about it. Unreal is one of the few things in this discussion that I haven't done and I assume it's about as good as Unity.

But the post I quoted brings a couple things to mind. It seems to me that Unity is not a very good place to learn C# (and I would like to hear other peoples' opinions on this and what they think a remedy is for it). C# and Java in Unity are really not the actual languages but rather scripting languages built specifically for Unity. Not only is it not actually C#.Net there are a lot of objects and what-not that are very specific to Unity that you have to learn that you will see nowhere else.

I tried Unity out for about 6 months and liked it for what it is. I decided that what I would rather do is go back to C++ with DirectX and OpenGL, but this isn't my first rodeo. I missed learning about the low level engine stuff. I had done XNA (now MonoGame) for quite a few years before this. I've been programming far longer than that.

C# is so close to C++ that I never had to learn C#. (Java too really.) I had some previous experience with VB.Net and C++ and the first time I saw C# I thought, "I already know this!" and just started coding in it without ever really learning it. There's some specifics that are very different. I learned as I went along and got better with it and learned more over the years.

So, when I got to Unity I had been coding C# for several years including doing XNA/MonoGame 3D game programming. So, having that previous experience, it's a bit difficult for me to imagine what it would be like coming into Unity with no programming background. But I kept thinking how glad I was to already know C# because Unity didn't seem like a very good place to be learning C# to me. It seems to me that you're often writing short scripts that don't really teach you the language, or worse - you are copying scripts off the Internet that someone else who didn't know what they were doing wrote. Or you're buying your code from the Unity store. I just remember that it seemed to me that one should probably learn C# pretty well before getting into Unity scripting.

I don't know that that's an absolute requirement, but I was very glad to have had years of previous experience writing C# in XNA/MonoGame. There are a lot of excellent game programming books for beginners or near beginners written for XNA although the best ones are for XNA 3.0 which is not 100% compatible with MonoGame or even XNA 4. XNA/MonoGame was what I needed to get into DirectX and maybe OpenGL. It gave me the foundation to get there as I ended up mostly teaching myself DX and OGL. 3D in DX and OGL is basically the same as in XNA. All the main concepts of using vertex buffers and such are the same.

I see a lot of Indie game developers having great success putting games together doing nothing but Unity. It's certainly the popular way to go and I think it's probably the right way to go for a lot of people although I think everyone has to decide their own path.

One thing I might add to this discussion is that most of the really indepth books on game programming are written for C++ with OGL or DX. Then again, books on collision detection, shadows, shader coding (rather than using a GUI to put together shaders), and so forth are probably more about writing "engine" code than the type of stuff you would typically do in Unity. That is the stuff I enjoy learning about and why I chose C++ over Unity or Unreal or any other game engine. It may take me 10 years to get where I want to get with this path, but after trying a bunch of things I know its the right path for me.

Also, just because I'm doing C++ with OGL these days doesn't mean I can't or won't do Unity or Unreal or something else. I did quite a bit of proto-typing for my C++ stuff in XNA because I was familiar enough with it I could build things quickly with it and test them out. My big C++ projects include tools written in C#. And I plan on trying to learn some Unreal this next year. So it's not necessarily all or nothing.

Anyway, I think one of the most important things is to learn to program fairly well in at least one language. I was taught very formal programming in Pascal in college that taught me to really think about the structure of the code. I had been programming since I was 12 and had picked up a lot of bad habits that that helped alleviate. C# is a great way to learn to get better at Object Oriented Programming in C++. XNA/MonoGame is a pretty good way to practice C# while you're learning it and is very similar to just writing C#.Net applications for business or other purposes. I was really glad I had that previous experience when scripting in Unity.

And if you do choose to dive straight into Unity, learn about "GameObjects" in Unity. Everything revolves around that and someone may neglect to tell you that. So, it's really important that you learn to build your own GameObjects.

If you decide to jump into C++ game programming and go off the deep end like me check out LearnOpenGL.com.

And if you decide to try MonoGame check out RB Whitaker's site where he has tutorials in C#, MonoGame and XNA. His "Player's Guide" is also my favorite book on C#. I haven't read many books on C#, but I thought it was a good book for beginners but especially for those who are more intermediate to advanced.

Oh, and I might add that I think the main thing you need is a mentor. Ideally you would find someone who knows how to make games who can give you some direction and advice as you go. That's probably more helpful than anything else. You may be able to take some classes to get that. I unfortunately never had that. I had to learn everything completely on my own and I "wandered in the wilderness" for the better part of a decade. I suppose I draw on some of that wilderness experience from time to time, but for the most part I just wandered around in confusion for a good 5 years or so not understanding what direction I should be going in or what the difference between the directions was. That may have something to do with my holistic approach to game programming because I dabbled in a bit of everything along the way not knowing what was going to get me closer to my goals and what would not. I learned 3D Studio Max, I learned animation in Poser, I came within inches of my goal by reading a book on C++ and DirectX but then the book ended and I didn't understand how to take that one last step. It's hilarious really. If that book had of had a couple more chapters I probably would have learned a lot of this stuff about 5 years earlier. But it stopped just short of teaching me what I needed to know and so that knowledge was largely wasted and lost over time. Anyway, my point is that if you can find a class or something to give you direction as to what you need to learn in what order it would probably help more than anything. And of course forums like this can give you some guidance as well.

It seems to me that Unity is not a very good place to learn C# (and I would like to hear other peoples' opinions on this and what they think a remedy is for it). C# and Java in Unity are really not the actual languages but rather scripting languages built specifically for Unity.

That's not really true. The Javascript variant in Unity is "Unityscript", i.e. Javascript syntax but with some changes - but C# is C#. Besides which, the aim isn't "to learn C#", the aim is "game creation", and if you only ever learn a subset of a language in order to make a game, so be it - that's perfectly fine. I think trying to learn a language outside of the context of any sort of project is often a frustratingly abstract experience, which is presumably why natural language lessons are often focused on specific scenarios, e.g. greetings, buying from a shop or restaurant, talking about work, etc.

It seems to me that Unity is not a very good place to learn C# (and I would like to hear other peoples' opinions on this and what they think a remedy is for it). C# and Java in Unity are really not the actual languages but rather scripting languages built specifically for Unity.

That's not really true. The Javascript variant in Unity is "Unityscript", i.e. Javascript syntax but with some changes - but C# is C#. Besides which, the aim isn't "to learn C#", the aim is "game creation", and if you only ever learn a subset of a language in order to make a game, so be it - that's perfectly fine. I think trying to learn a language outside of the context of any sort of project is often a frustratingly abstract experience, which is presumably why natural language lessons are often focused on specific scenarios, e.g. greetings, buying from a shop or restaurant, talking about work, etc.

Not sure I'd agree that it's a good place to learn a language. If you fire up an ide and compiler and write something in regular old C# you'll be using a lot of different features than you would be in scripting, as well as things like standard library functions. That stuff can either be constrained or flat out disabled if the language is being used for scripting, it also has a completely different workflow.

I could use minecraft as an example, a lot of people got into the decompiled version of the code and tried to modify it, often to completely awful results. They weren't scripting, they were flat out using the full language, but because they were modifying small bits of code in a bubble, not having to write a lot of the code from scratch or even understand what it is doing, the results were often a complete misunderstanding of what they were writing.

It's the same problem I see with scripting, they can teach you how to write a few words to change some variables but it won't give a deep understanding of the language that one would earn from using it on its own. You could say that "technically" they're using C#, but in the spirit of learning, they have no real reason to really learn what it is doing.

How come nobody is suggesting C++ and UE4? Is Unity really that much easier?

Its an annoying one but (due to Microsoft's marketing) most people tend to advise people to learn C# as their first language which pretty much shoves them straight into Unity and they never get to experience anything else.

I would say that Unity (The company) has spent many many more $$ on marketing their product too than all other middleware companies combined.

And again, Microsoft has in the past spent much much more $$ on marketing their product (C# & .NET) than C++ has ever had (which unlike .NET or Java obviously doesn't actually belong to any single company so has noone to market it).

So long story short. Unity and C# is a branding exercise towards "prosumers".

http://tinyurl.com/shewonyay - Thanks so much for those who voted on my GF's Competition Cosplay Entry for Cosplayzine. She won! I owe you all beers :)

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.
Ayup.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Not sure I'd agree that it's a good place to learn a language.


I never said that it was.

How come nobody is suggesting C++ and UE4? Is Unity really that much easier?

Its an annoying one but (due to Microsoft's marketing) most people tend to advise people to learn C# as their first language which pretty much shoves them straight into Unity and they never get to experience anything else.

I would say that Unity (The company) has spent many many more $ on marketing their product too than all other middleware companies combined.

And again, Microsoft has in the past spent much much more $ on marketing their product (C# & .NET) than C++ has ever had (which unlike .NET or Java obviously doesn't actually belong to any single company so has noone to market it).

So long story short. Unity and C# is a branding exercise towards "prosumers".


Bullshit. C++ is just a lot more complex than C#. Marketing has nothing to do with it.

C++ gives you:

  • 5 different types of cast.
  • 4 different types of object constructor (default, parameterised, copy, move) and a 5th way of invoking them (copy constructor via assignment )
  • 2 different types of built-in object reference, plus 3 types of standard library reference (plus one more that is deprecated). Also: pointers to references, references to pointers...
  • a string type that needs C-style functions, pointer-style semantics, and isn't usable for anything except American English (char*)
  • a string type that can only handle UTF-8 if you don't use most of its functionality (std::string)
  • a system clock that doesn't understand UTC (std::chrono)
  • the preprocessor system and the need to understand it for #includes, and how that ties into "compilation units" etc
  • the erase-remove idiom, and other oddities of the 'algorithm-first' approach to containers
  • the "most vexing parse"
  • no garbage collection, but maybe some ref-counting if you used the right reference type

Bullshit. C++ is just a lot more complex than C#. Marketing has nothing to do with it.

C++ gives you:

  • 5 different types of cast.
  • 4 different types of object constructor (default, parameterised, copy, move) and a 5th way of invoking them (copy constructor via assignment )
  • 2 different types of built-in object reference, plus 3 types of standard library reference (plus one more that is deprecated). Also: pointers to references, references to pointers...
  • a string type that needs C-style functions, pointer-style semantics, and isn't usable for anything except American English (char*)
  • a string type that can only handle UTF-8 if you don't use most of its functionality (std::string)
  • a system clock that doesn't understand UTC (std::chrono)
  • the preprocessor system and the need to understand it for #includes, and how that ties into "compilation units" etc
  • the erase-remove idiom, and other oddities of the 'algorithm-first' approach to containers
  • the "most vexing parse"
  • no garbage collection, but maybe some ref-counting if you used the right reference type

Honestly, none of those points really effect someone starting out programming. Just because a language has complex elements, it doesn't mean someone has to use them. Beginners starting out certainly wont use them.

As for no garbage collection, most c++ libraries that people use provide their own solutions based on reference counting anyway. Again, the developer at this stage does not need to care (UE4 even provides Garbage Collection in the c++ code).

General programming concepts provide 99% of the difficulty, not the silly little language. The reason why C# is even suggested over VB.NET nowadays is because Microsoft's marketing over all these years has told you to. Afterall, it is their flagship programming language, not C++, VB.NET or Swift.

http://tinyurl.com/shewonyay - Thanks so much for those who voted on my GF's Competition Cosplay Entry for Cosplayzine. She won! I owe you all beers :)

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.

This topic is closed to new replies.

Advertisement