Sign in to follow this  

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

Recommended Posts

Posted (edited)

My friend and I are currently learning the language C because we were told it's a great base language to learn. but we getting to the end of learning basic C and we are getting close to learning video game languages, but we don't really now what language to choose. I already started learning c++ but I did my research and found the community is mostly split between C++ and C# and I wanted GameDev.net's opinion on the subject and I had a few extra questions as well..

Which language is best with 3D game development?

Which language is best with 2D game development?

Which language is easiest to learn?

which language is the most complicated?

 

thanks,

 

-Matthew H.

Edited by Angryjellyblob1

Share this post


Link to post
Share on other sites

Most people don't use either, they use a game engine like unreal or unity and then do everything with the IDE and scripting. The scripts might be in C++ or C# but they could be in other languages as well, and arguably using a language for scripting is usually a much more simplistic usage of it than say, coding something from scratch in C++ using the STL and other third party libraries. There's a lot more involved using it stand alone vs for scripting.

 

Also there isn't really a "split" if you're talking about the basic language for most game engines out there, it's C++, not C#.

 

I usually advocate deciding based on what you want to do:

Do you just want to make and release games? Use a game engine.

Do you want to learn to program? Pick a language that suits your goals then.

Do you want to work in AAA development? C++ then.

 

We get a lot of people around here that want to make games and they assume the first thing they have to do is start coding, that's not necessarily true these days. That fact is specifically born out of the point that programmers are there to make things happen, they're there to make the game come together so as time has gone on we have developed more tools to let the non-technical people on the team(artists, audio folks, designers) modify game content without needing a programmer to help them do it. That also has the bonus of meaning you can more or less put together games now with very little complex programming if you so choose.

Share this post


Link to post
Share on other sites

Video Game languages are a fallacy; programming languages were not designed for video games in particular w.r.t to mainstream programming languages.

 

If you've never, ever, written a game in your life and you are just starting out on your programming journey, I wouldn't even touch a triple A engine right now.

 

Every computer comes built with the ability to understand HTML and JavaScript, why not take advantage of that and play with some demos that are out there right now.

 

Github has many open source Super Mario games, why not just download the zip of that repository and tweak with the values, learn how the game works, how it performs some its calculations, uses a game loop, etc.

Share this post


Link to post
Share on other sites

If your goal is to write a game...and not a game engine... do like Kylotan said and get Unity.  In that case C# is your language.  If you write the engine (ill advised) I use C++ personally since it can be ported to all desktop and mobile systems for free.  But it is hard.  If you have never made a game before I would start with game maker & GML.  Matter of preference

Share this post


Link to post
Share on other sites

Is there a split? Choose what is more appropriate, and if it's your personal decision, also choose what's more comfortable and productive. You can't really go wrong with language. 

Share this post


Link to post
Share on other sites
Posted (edited)

My friend and I are currently learning the language C

If you want to learn a C based language or move onto an evolution of C. Then your only choices are C++ or Objective-C.

 

C# is *not* a C based language. It goes by that name purely for marketing by Microsoft a long while back. It is simply Microsoft's spin on Java (not Javascript).

 

That said. If you don't need to keep with a C based language and are happy to look at others, then C# could be a valid choice because it is at least "C styled" (in the same way as Java). Though I often hear that beginners find Python easier when starting out. Especially if they already have some knowledge of C since many of the functions are called similar (because it wraps libc closely).

Edited by Karsten_

Share this post


Link to post
Share on other sites
Posted (edited)

You've ask an incredibly decisive question, most people will give you there opinion. I will say from the start that i lean towards C++, but a also know c#. here is the breakdown- 

There are three levels of programming languages LOW, High, and Scripting.

C++ is a Low level( some will argue that its is a mid)

C# is High level ( can also be use as a scripting language)

 

low level languages are far more powerful because they give you full control over your process with little to no supervision. you will have to manage your memory, create trash collection, even define your own data types ( a string is NOT a primitive in C++). C++ is the de-facto language of professional game developers. with c++ you can write every thing from scratch or use a pre-built engine. the choice is yours.Some find this power intimidating and call c++ "hard". that not really true, but it will have the steepest learning curve. As you are coming from  C this may not matter to you. Like i said i lean towards C++, if you master this one, learning the other languages will be a snap.

 

High Level Languages run with-in an "interpreter", that is another program, usually called run-time environments. C# uses the .Net(dot net) framework. in order for your program to run on your target system, it must support .net(Iphone, for example don't). High level languages are still pretty powerful, and include a lot of features in the language, that you would have to implement yourself in low-level languages like memory management. this usually results in faster prototyping, as many details about the operating system are abstracted. ( for example, doing things like opening a file in the file-system, are much easier, C# doesn't care what platform you are on)  if this sounds appealing also check out Python, or Java.

 

Scripting Languages, You may have noticed some people tell you to download programs like unity or gamemaker studios. those programs use scripting languages. these are languages that give instructions to another program rather than to the computer itself. some of these programs will use established languages like unity and c#, while others will even create there own language like gamemaker studios and GML.( unity use C# syntax, but for this definition it is using it more as a scripting language than a programming language). Scripting language are usually very specialized. prototyping( getting a rough draft of your game) can be done virtually instantly, with little or no setup. I personally feel this puts you in a box, but its nice if you are trying to get out the gate. also check out JavaScript( not to be confused with java) and WebGL  

 

Conclusion: 

the answer to your question depends on your intentions. if you are learning programming for the sake of learning programming or because you are legit trying to get in the game creation industry; C++ hands down. if you like programming and want to have alot of ground covered for you, go with a High Level language, (keep in mind that c# is Microsoft proprietary, Java is equivalent and runs everywhere.). IF you've got a killer idea for a game and just want to jump right in without much concern for how it all works, learn Unity, GameMaker, or something of that nature.  

// have fun

var goal;

goal = input();
if(goal == 'learn programming'){

alert("Learn C++");
}else if(goal == "make a game fast"){

alert("learn UNITY"):
}else{
alert("check out Python or Java");
}


 

My friend and I are currently learning the language C

If you want to learn a C based language or move onto an evolution of C. Then your only choices are C++ or Objective-C.

 

C# is *not* a C based language. It goes by that name purely for marketing by Microsoft a long while back. It is simply Microsoft's spin on Java (not Javascript).

 

That said. If you don't need to keep with a C based language and are happy to look at others, then C# could be a valid choice because it is at least "C styled" (in the same way as Java). Though I often hear that beginners find Python easier when starting out. Especially if they already have some knowledge of C since many of the functions are called similar (because it wraps libc closely).

 

You are Partially correct. C# is Microsoft's version of Java, but Java itself is a C derivative. Java and C# are like half-brothers :P

Edited by Yeah_Phantom

Share this post


Link to post
Share on other sites

You've ask an incredibly decisive question, most people will give you there opinion. I will say from the start that i lean towards C++, but a also know c#. here is the breakdown- 

[...]

Sorry for the long wait for my reply I had a lot of stuff on my hands the past week or so and I think I neglected to mention my friend and I wanted to be indie game developers , but I'm here now so we can talk. So you said that if my goal was to learn programming than to learn c++ and If my goal was to make a game fast than I should learn Unity, How difficult is it to learn / utilize c++ in game programming? and would it be beneficial to me? A person that has little prior knowledge to coding other than C and who only has his friend to work with? I ask this because I know most AAA games use c++ and take years to make with possibly hundreds of people working on them. if my friend and I learn c++ what are the chances we can make an exceptional game in 2 years?

Share this post


Link to post
Share on other sites

Question: C++ or C#?

Answer: Yes.

 

If you're wondering where to start then it depends on where you're going. If you want to make something bizarre and performance intensive then go with C++. If you want to make something quickly that doesn't go too far off the beaten path in terms of computation then go with C#. In either case it's more about what middleware you want to use. If you like UE4 then learn C++ first. If you like Unity then learn C# first. If you like brain injuries then learn Java first.

 

Agreeing with Kylotan's earlier post, if you're asking this question then Unity may be a good place to start. It has a shallow learning curve but is still a professional-level tool.

Share this post


Link to post
Share on other sites

Question: C++ or C#?

Answer: Yes.

 

If you're wondering where to start then it depends on where you're going. If you want to make something bizarre and performance intensive then go with C++. If you want to make something quickly that doesn't go too far off the beaten path in terms of computation then go with C#. In either case it's more about what middleware you want to use. If you like UE4 then learn C++ first. If you like Unity then learn C# first. If you like brain injuries then learn Java first.

 

Agreeing with Kylotan's earlier post, if you're asking this question then Unity may be a good place to start. It has a shallow learning curve but is still a professional-level tool.

That does make sense, But I just realized I neglected to point out that I'm 14 and chances are I wont make any ground breaking game any time soon, so would it be worth it to dedicate the next 4 years' free time to learning C++ so that when I do start doing stuff I have C++ on my belt? or Should I just start making games with unity  so that I can learn how game creation works?

Share this post


Link to post
Share on other sites

 

Question: C++ or C#?

Answer: Yes.

 

If you're wondering where to start then it depends on where you're going. If you want to make something bizarre and performance intensive then go with C++. If you want to make something quickly that doesn't go too far off the beaten path in terms of computation then go with C#. In either case it's more about what middleware you want to use. If you like UE4 then learn C++ first. If you like Unity then learn C# first. If you like brain injuries then learn Java first.

 

Agreeing with Kylotan's earlier post, if you're asking this question then Unity may be a good place to start. It has a shallow learning curve but is still a professional-level tool.

That does make sense, But I just realized I neglected to point out that I'm 14 and chances are I wont make any ground breaking game any time soon, so would it be worth it to dedicate the next 4 years' free time to learning C++ so that when I do start doing stuff I have C++ on my belt? or Should I just start making games with unity  so that I can learn how game creation works?

 

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

Edited by BogdanFedko

Share this post


Link to post
Share on other sites

That does make sense, But I just realized I neglected to point out that I'm 14 and chances are I wont make any ground breaking game any time soon, so would it be worth it to dedicate the next 4 years' free time to learning C++ so that when I do start doing stuff I have C++ on my belt? or Should I just start making games with unity  so that I can learn how game creation works?

Computer languages are not like natural languages where it takes years to learn each one. For starters, there is hardly any vocabulary. So it doesn't take long to get the basics down. And once you know C++, it would take you days or weeks, not months or years, to be able to start being useful in C#. The same goes for the other way around, or with Java.

 

So, you don't need (or want) to plan 4 years ahead. Do what you want to do now. You can always change later.

Share this post


Link to post
Share on other sites

That does make sense, But I just realized I neglected to point out that I'm 14 and chances are I wont make any ground breaking game any time soon, so would it be worth it to dedicate the next 4 years' free time to learning C++ so that when I do start doing stuff I have C++ on my belt? or Should I just start making games with unity  so that I can learn how game creation works?
 

 

Both paths are ok.

My suggestion is to use any engine and try to make a Tetris, or maybe something even simpler like a Tic tac toe. You will have to do all the gameplay programming by yourself but the engine will manage a lot of stuff under its hood. In the process you will have to learn a programming language and also realize what things an engine usually handle and what things are left for that specific game you're trying to make.

 

Anyway, have fun doing whatever you choose :)

Share this post


Link to post
Share on other sites

That does make sense, But I just realized I neglected to point out that I'm 14 and chances are I wont make any ground breaking game any time soon, so would it be worth it to dedicate the next 4 years' free time to learning C++ so that when I do start doing stuff I have C++ on my belt? or Should I just start making games with unity  so that I can learn how game creation works?


Computer languages are not like natural languages where it takes years to learn each one. For starters, there is hardly any vocabulary. So it doesn't take long to get the basics down. And once you know C++, it would take you days or weeks, not months or years, to be able to start being useful in C#. The same goes for the other way around, or with Java.
 
So, you don't need (or want) to plan 4 years ahead. Do what you want to do now. You can always change later.

I was trying to figure out how to say this.
Think about this. Most pro programmers have mastered multiple languages. From my own experience, learning c++ made c# easiery to understand. C# is strictly an object oriented language and it forces that onto you without really explaing why. C++ can be oo or functional, in my opinion learnibg both styles will help you understand oo better

Share this post


Link to post
Share on other sites

If i told you C++ was the best, do you think that would improve your chances of making an amazing game?  Its not a proper question to ask, which language is better, because you are going to get the same answer as "which operating system is better", or "which fruit is better".  It doesn't matter, it really doesn't, I know you think it does but that's just because you need to gain experience as a developer to know not to ask such a question.

 

This is not meant to sound mean, its just to point out that you should not be focusing on things of this nature, because it doesn't matter.  Minecraft was made in Java, it could have been made in C++, it could also have been made in HTML, so it doesn't matter. 

 

What does better even mean, better at rendering, better at expressing instructions, better compilers; you should get to the root of the question if that's where you want to go.

 

If you actually want to make a video game, why don't you program in both?  If its because you are afraid that you will head down a path that will doom your game before it has even started, then you have doomed your game by thinking about absurd questions like this.

 

Make your game in both languages, and see where it takes you, if that's what your focus is, or if your focus is on making video games instead, then focus on that and use a tool to solve a specific problem, after you have identified it as actually being a problem.

 

Programming languages are not the problem, the problem domain is the problem, focus on solving that, because there is nothing wrong with C# or C++ or Java or Phython et al, even though you have groups of people that prefer one over the other, you have groups of people that rather eat an apple instead of a steak, and it doesn't matter because apples are awesome and so is steak, so eat both and be happy.

 

</rant>

Thanks for the reply! But I must say I don't entirely agree with what you're saying, like for what I've learned in the past few days from this thread is that c++ is a superior language in game development. Most, if not all AAA games are programmed mostly in c++ but one caveat is that its super difficult and that all triple A games take years of development with scores of people, but c# would probably be better for me because on how its much easier for a beginner like me to work with because it can be used a powerful scripting language and its much more simple compared to C++. You don't need to worry about whats going on with your memory with C# and so on. 
Bottom line is that from what I learned from this thread is that

 if I want to learn how to make big games, learn C++
and if I want to make a game fast learn C# and use Unity.

Edited by Angryjellyblob1

Share this post


Link to post
Share on other sites

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

Taking a shot in the dark I'd say the reasons are probably:

 

-More people have tried Unity than Unreal.

-Just spitballing but it seems like Unity has a more wide acceptance by small time developers than Unreal does, we often see UE4 used for more professional quality games whereas Unity is often more indie. I would assume that means it probably has more community content available to help novices understand it. The Unity store is pretty well known for making it easy to grab assets to stick in your game too, and a lot of content on there is aimed at small time developers.

 

That said I don't think anyone is really ruling out UE, you could use it too.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

instead of Unity I'd go with

 

Otter2D

https://www.youtube.com/watch?v=jk19Oze1IYw

   

or

   

Duality  

https://www.youtube.com/watch?v=JE9o1pL_KZ8

 

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 

Edited by !@#

Share this post


Link to post
Share on other sites

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.

Edited by BBeck

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

 

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this