Jump to content

  • Log In with Google      Sign In   
  • Create Account


What programming language should i go with? (C++,C# or java?)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
12 replies to this topic

#1 MzDay   Members   -  Reputation: 246

Like
0Likes
Like

Posted 01 May 2013 - 06:36 AM

Title^.

 

I basically have the same knowledge on all of the above and i wanted to know what should i learn and keep going with?

 

my goal is to create games and someday build (maybe) an engine for myself.

 

i think i want to use OpenGL for that and i figured that if all of these languages have opengl library (now all of them the same i know)

i should go with one of them.

 

what is the best choice to go with?

C++ is pretty hard to learn but i can handle it. (pretty fast too from what i understand)

C# is really easy and i can easily learn that language but it's not as quick as C++ and i dont know if the openTK (or what's it called) is the same as opengl openal.. (same function's)

Java same as C# but i dont really like that language i dont know way lol

 

 

thanks! smile.png


EDIT: update on comment 10 :) thanks.


Edited by MzDay, 03 May 2013 - 10:31 AM.


Sponsor:

#2 David.M   Members   -  Reputation: 731

Like
1Likes
Like

Posted 01 May 2013 - 07:02 AM

This would fit better in the For Beginners section. To answer your question, use whichever language you want. This article  talks about C++, Java, C#, and Python. If you don't like using Java then you really won't want to learn game programming in Java because you'll get bored and discouraged. Pick whichever language you want and start game programming in it. As a beginner there is no "best choice" really.



#3 tharealjohn   Members   -  Reputation: 451

Like
2Likes
Like

Posted 01 May 2013 - 07:33 AM

I had the same question a few years ago. I chose C#. 

 

C# has allowed me to leverage that knowledge to expand my portfolio into many areas of .NET development, and most recently cross platform mobile development with the Xamarin tools. Sometimes I wish I would have stuck with C++ because I see a lot of big things being done in C++, and most game related jobs I see are asking for C++ skills. On the flip side, Unity uses C#, which is great for me and its a viable option for game development so do I really need C++? 

 

If you want to roll your own engine, than you would probably want to learn C++. I don't think any decision will hurt you, but it may lead you somewhere else. 

 

To summarize, I chose C# because it has application in many areas that I was interested in: ASP.NET Web, .NET desktop applications (WPF, etc) and Unity3d. It also has let me be able to use the Xamarin tools for mobile development and not have to learn a whole new syntax of Objective-C or Java. Also, I found C# to be easier to pick up and get things done without having to worry too much about all sorts of nightmares that C++ can introduce that are challenging for a beginner in programming, heck they are challenging for veterans too! Good luck on your journey!


Edited by tharealjohn, 01 May 2013 - 07:35 AM.

jmillerdev.com

Follow me @jmillerdev


#4 niexuchina   Members   -  Reputation: 163

Like
2Likes
Like

Posted 01 May 2013 - 08:17 AM

Most of game code should be writen with script language, like java, lua, python, c# for unity3d. It's no need to work with native code if you are using a good engine, like unity3d.

The only reasons to adopt c++, I think, are to replace some slow code, to call native api, and to reuse old but useful code base.

#5 SeraphLance   Members   -  Reputation: 1332

Like
2Likes
Like

Posted 01 May 2013 - 09:25 AM

The question of "what language" has no real best answer, and it's largely due to the number of parameters involved and what you most care about.  This is why wikipedia uses tables for all its comparison stuff.  Tom Sloper talks a bit about decision tables (or something like that) in his site to illustrate the same concept.  Some basic characteristics:

 

C++ has the best library support for gamedev tasks, bar none.  If there's something you need, there's probably at least 20 libraries for it in C++, and most of them are actually worth a damn.

 

C# and Java are both MUCH easier to use (not just learn) than C++, and you WILL be more productive on a language level.  You may take some level of productivity hit trying to work around the GC, but that depends a lot on use case.

 

Java is more mature and widely supported than C# over different platforms.  Mono is around most relevant platforms now anyway, but it's less ubiquitous than a JVM runtime.  C++ is technically more supported than both, but that runs aground with the whole productivity issue.

 

Then there's a giant infinite continuum of interop choices between two or more languages, and they carry their own benefits and drawbacks.

 

Ask yourself a few things:


1.  How (logically) complex is my game?  A game with a lot of complex logic (think RPGs and Simulations) at multiple layers of play often benefits from a higher level scripting language.  Whether that's interop with a lower-level engine (with the scripting being "game logic") or just straight making a game in python for example depends on other factors.  Unity uses C# for scripting along with other stuff precisely because it's more "scripty" than C++.

 

2.  How (computationally) complex is my game?  Python does not perform well.  Neither does any other scripting language.  When you put your languages choices into this question, the same thing applies:  Java and C# are generally slower than C++ when both are written properly (and more importantly, idiomatically).  I've seen benchmarks where Java is as fast or slightly faster than C/C++, but it is MUCH harder, and the productivity dimension totally flips on its head.  If you need fancy physics or otherwise complex algorithms (and an indie CAN make a game that is computationally demanding), you may want to squeeze every bit of performance you can get.  You probably won't, but it's worth thinking about.

 

3.  How long do I want to spend making it?  If you're making it for fun and have no problem working on it for a very long time, it matters far less what language you work with, since once you're decently skilled at a language it's just a matter of trudging through the details, which basically amounts to an investment->reward problem.  If you don't want to spend the next five years developing a small game or actually need to make money, productivity becomes very important.

 

4.  How much do I *really* know about my language of choice?  You may think you know C++ well, but I highly doubt you actually know it as well as Java/C#.  This isn't an attack or anything, that's just the way C++ is.  Evaluate what you actually know as well as you can, and decide if learning a language some more is something you want to or are willing to do.

 

5.  How much of my game do I actually want to make?  Everyone is encouraged to not "reinvent the wheel", and while I think that's a good thing for learning purposes, it's not so much for actual development.  C++ as stated above has the best library support around, but it's not as if there isn't *something* analogous in C#/Java.  Whenever I work on something, I always pick the libraries I want to use first, then the language that supports them most readily.  Language interop can be painful, and it's not something I like doing readily.

 

 

...And there's your wall of text response.  Word economy was never my strong suit.  In the end, it's really just a long-winded way of saying "it depends".


Edited by SeraphLance, 01 May 2013 - 09:26 AM.


#6 Chad Smith   Members   -  Reputation: 1116

Like
1Likes
Like

Posted 01 May 2013 - 12:51 PM

Title^.

 

I basically have the same knowledge on all of the above and i wanted to know what should i learn and keep going with?

 

my goal is to create games and someday build (maybe) an engine for myself.

 

i think i want to use OpenGL for that and i figured that if all of these languages have opengl library (now all of them the same i know)

i should go with one of them.

 

what is the best choice to go with?

C++ is pretty hard to learn but i can handle it. (pretty fast too from what i understand)

C# is really easy and i can easily learn that language but it's not as quick as C++ and i dont know if the openTK (or what's it called) is the same as opengl openal.. (same function's)

Java same as C# but i dont really like that language i dont know way lol

 

 

thanks! smile.png

First of I just want to say, C# is plenty fast.  If you're just beginning you won't notice the "speed differences."  Don't even think about it.

 

Honestly choose what ever language you want really.  There is no correct or wrong language choice.

 

I myself though would go ahead and choose C# right now.  You will be more productive.  The best language for a job is the language that makes you more productive.  Plus I feel by the time you you to where  you can make your own engine your knowledge of programming should be pretty good which by then you would be able to pick up C++ with ease.  Just beginning you won't be doing anything where you will notice speed differences between C++ and C#.  Just because you do choose C++ doesn't mean you'll immediately get code that runs faster.  Matter of fact it may be easier to write code that is slower in C++ than it's C# counterpart.  Just because C++ allows you to do it doesn't mean it is the best or fastest way to do it.

 

Also just want to say their have been some reports that some algorithm implemented in C# have ran just as fast as the same algorithm implemented in C++.



#7 VladR   Members   -  Reputation: 722

Like
3Likes
Like

Posted 01 May 2013 - 01:20 PM

For game coding purposes, at this day and age,  do not even think about going the C++ route and go for C# right away.

 

 

The productivity gains I got when I switched to C# from C++ are enormous. In fact, they should be illegal, if anything.

 

And I'm writing it as a competent C++ 3D coder who gets paid because he is versatile in C++ and 3D.

I did my first few games and 3D engines in C++. It was a lot of pain. When I made the switch to C#/XNA 3 yrs ago at home, I could not believe how productive it is, either.

 

I am working on a new game at home and I spent about 3 hrs on adding a new gameplay feature in last 2 evenings. I can guarantee you could not, repeat, could not, write it:  1. so soon, and 2. so short , and 3. so stable in C++ in such a short timeframe. In C#, it's just boom.boom.boom and the sh*t just works right out of the box. You don't have to understand the compiler complexity 7 layers deep - as in C++  and certainly do not have to make compromises in design just due to the "greater good" as is often the case in C++. Yes, I know that C++11 made a lot of things better, but it's not and will not be a C#.  It's close - but for me it came two years too late.

The fact that you don't compile the code (as in C++) every single time means tremendous time savings. Your brain does not switch out of the context, as in C++ and by the time it si compiled you long forgot what the hell were you trying to accomplish in the first place.

 

Your brain IS THE CONTEXT 100% of the time. It is a different paradigm.

 

 

Your free time is very limited. It's not some huge company that has money to throw around. Spend it wisely - i.e. writing code that works right the first time and not on debugging...

 

The argument that C# is slow for 3d games is nonsene. My engine runs on cell phones, tablets, 10-year old XBOX and certainly a 10-yr old PC.

Those few C# performance quirks, on those particular platforms, are easy to fix.

 

Besides, it's not like it is impossible to write a slow code in C++ either ...


VladR    My 3rd person action RPG on GreenLight:    http://steamcommunity.com/sharedfiles/filedetails/?id=92951596

 


#8 0r0d   Members   -  Reputation: 817

Like
1Likes
Like

Posted 01 May 2013 - 06:49 PM

I basically have the same knowledge on all of the above and i wanted to know what should i learn and keep going with?

 

my goal is to create games and someday build (maybe) an engine for myself.

 

i think i want to use OpenGL for that and i figured that if all of these languages have opengl library (now all of them the same i know)

i should go with one of them.

 

what is the best choice to go with?

C++ is pretty hard to learn but i can handle it. (pretty fast too from what i understand)

C# is really easy and i can easily learn that language but it's not as quick as C++ and i dont know if the openTK (or what's it called) is the same as opengl openal.. (same function's)

Java same as C# but i dont really like that language i dont know way lol

 

 

thanks! smile.png

I'll disagree that C++ is "pretty hard" to learn.  I started programming with C++ and didnt think it was especially hard.  Also, C++ forces you to deal with things that are essential to how a program (and hence an engine) works like memory management, and doesnt hide it away from you.  But, once you know what you're doing with memory management, using smart pointers is extremely easy and will eliminate the headaches that a lot of people complain about with C++.

 

So, your goal is to write your own engine, and possibly work in the broader game development industry?  If this is correct and you want to learn the ins and outs of a game engine and maybe work for a professional game studio, then my suggestion is C++.  Considering that you already have the same level of C++ as you do with the other options, I dont see much of a downside with this.  C++ has more code/libs/support out there for you to leverage.  C++ is used in most professional dev studios.  C++ is used to write most professional game engines, and to program most platforms and consoles.



#9 TheChubu   Crossbones+   -  Reputation: 4187

Like
1Likes
Like

Posted 02 May 2013 - 01:12 AM

I'll quote myself from another post :D :

 

 


 

Java

Pros:

  • Easy to distribute
  • "Enterprise" language that could translate to career skills

Cons:

  • I've never programmed in java before
  • I'm not sure how the performance is for games (minecraft horror stories)
  • I would have to learn Eclipse, which from what I hear is almost mandatory for java

There are two main options for an IDE, Eclipse or Netbeans. I hear Netbeans is easier, but I like Eclipse so I haven't tried Netbeans.

 

Java has some important Pros you havent mentioned:

 

  • It's a generally easy language to pick up because its pretty simple. You don't have lots of syntax sugar, nor many crazy tricks with pointers/counters/etc that you might encounter inside code in the wild.

 

  • It has a massive standard library with all sort of things. For example, ImageIO.read() and you got your png/bmp/jpg loaded (no matter if its greyscale, rgb, alpha or no alpha, etc). IO is really easy, threading is really easy, etc.

 

  • On performance critical stuff (ie, parts of Math library), there is a native implementation instead of a Java one.

 

  • JDK sources available. Want to check out how something is implemented? Want to use a particular class of some library? Check the sources, import what you need.

 

  • It has a common naming scheme convention (classes start with uppercase, variables with lower case, and so on, that means mostly no "__varXYZ" stuff).

 

  • It's very well documented. Not only that but documentation seamlessly integrates with your IDE. Hover the mouse over something you don't understand and bam! Official documentation as fast as your internet connection can deliver. No checking forum posts that half know what stuff actually does. Once you get the hang of the syntax, you can explore, learn and use (most of) the libraries easily with the documentation at hand.

 

  • As long as you're not using native stuff, porting is really easy. As easy as launching the thing on a different OS. And you get the same result too. If you're using native libraries, then you're limited to what platforms those libraries support.

 

I think Minecraft's problems aren't an issue with Java but just poor design choices  Uses very old fixed function OpenGL, it looks horrible to extends since every mob has a dedicated class that knows how to render it specifically (so you have CreeperRender class, PigRender class and so on), it didn't cull cubes for a very long time (and "advanced OpenGL" option that did cull them was buggy as hell) and so on. Thats just my opinion though.

 

 

And a few Cons I would consider:

 

  • Its very easy to do "stupid" things. If you want your code to perform well, you can't ignore memory even if you're in a managed environment. "newing" stuff is a very easy thing to do and a very fast way to get you into making overweight applications.

 

  • Again, no syntax sugar. This might be a bad thing for you if you're used to operator overloading for example.

 

  • "protected" is... Not what you'd think it is. Useless if you're developing on a single package.

 

  • Some consider "static final void method()" madness biggrin.png

 

  • "Every file is a single class" (except for nested ones) is annoying sometimes.

 

  • Buffer madness. Using some native stuff (ie, OpenGL through LWJGL) requires passing things around in Buffer classes, which means duplicate data and additional operations (in some sense, you end up using arrays in a even lower level than arrays in compiled languages, by setting up position pointers by hand, endianess, etc).

 

And things I'm forgetting probably biggrin.png

 


"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

 

My journals: dustArtemis ECS framework and Making a Terrain Generator


#10 MzDay   Members   -  Reputation: 246

Like
0Likes
Like

Posted 02 May 2013 - 03:08 AM

Thanks for the answers!
i think i'll stick to c# and in the future if needed move to c++.
i have a question,
is opentk for c# is the same as opengl? (and is it updated and keep updating)?)

thanks again!

#11 MzDay   Members   -  Reputation: 246

Like
0Likes
Like

Posted 03 May 2013 - 10:30 AM

up :)



#12 MzDay   Members   -  Reputation: 246

Like
0Likes
Like

Posted 06 May 2013 - 10:55 AM

up.

can someone answer my question please?



#13 frazchaudhry   Members   -  Reputation: 1142

Like
0Likes
Like

Posted 07 May 2013 - 11:40 AM

well you could have googled for your answers. I didn't know them but got the answer in a couple of minutes by googling.

 1. 

is opentk for c# is the same as opengl?

Yes

2.

(and is it updated and keep updating)?

I don't know but you can read this thread http://www.opentk.com/node/3217 .


Edited by frazchaudhry, 07 May 2013 - 11:43 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS