Skip to main content
GameDev.net gamedev.net
🔒 Locked

C++ or C#

Started by velentry Jul 2, 2008 at 4:09 AM 113 replies 28.9k views
Original Post
velentry
velentry
Hi its me Vel, I am looking to make a simple RPG with transitions between battle and the usual so i can learn a programming language the only problem is before i spend some money buying books (the best way i learn :P) i was hoping someone could recommend a programming language that would be best. The main area i would like to concentrate on would be RPG's which is probably just about the same as everyone else but i am also quite tempted with the idea of a Platform game so i would need a language that would be versatile for both.....or wouldn't it matter. Sorry if the above seems a thick question :P Vel
Bear777
Bear777
I've used both languages for years now (well, a whole lot more of C++ than C#), and my opinion is that C++ is better in every way. C# is just too much of a mess, since it's .NET (Yes, I think .NET is a mess) and not well supported by graphics libraries.

So in my opinion, you should buy some good C++ books (I can't recommend titles because I have none).

Michel
MARS_999
MARS_999
C++ or Java. Java has some 3D/2D libs with it, where C++ doesn't. C++ you can code OpenGL or DX. Java works with OpenGL also.

Depends on what you want to do. If you want to run on all platforms I would use either

Java/OpenGL
or
C++/OpenGL


Book for C++
http://www.amazon.com/Ivor-Hortons-Beginning-ANSI-Complete/dp/1590592271/ref=sr_1_5?ie=UTF8&s=books&qid=1214992603&sr=8-5

Ivor Horton's Beginning ANSI C++: The Complete Language, Third Edition (Expert's Voice) (Paperback)
remigius
remigius

Quote:
i was hoping someone could recommend a programming language that would be best.


There is no such thing as The Best Programming Language. Period.

Sorry if this sounds cross, but we get these threads several times a day. In fact, here are the most recent 916 predecessors. To answer your last question, the language doesn't matter one bit when considering RPG vs Platform gameplay. You can happily code either game type in whatever language you wish.

Michel recommends C++ and I'd recommend C#, which does happen to have decent support for graphics libs with initiatives such as XNA, SlimDX and Tao. It just comes down to personal preference and experience.
TerrorFLOP
TerrorFLOP
These "What language is best?" threads always have the potential to escalate into something much more (i.e. a flame war) so OP, I'd do some research on BOTH languages first for yourself.

Personally, I'm a C++ fan. I've used this language for a few years now and that obviously means that any advice I give you would be biased.

However, I hear C# does have some merits, to which I'm warming up to. Namely in creating game tools (which you'll probably need for any major projects you intend to create anyway!).

So perhaps learning BOTH could be a wise choice. I've seen C# code and a lot of its syntax is based on C++ so the transition between the two languages isn't that great (although deep down they are quite different in many aspects).

But if time is of the essence, and you only want to get down and dirty learning ONE language, then I'd choose C++.

C++ is by far the dominate language in the video games industry and there always seems to be a shortage of proficient C++ programmers. So long term you just can't go wrong if you master C++.

My 2 cents.
AvengingRage
AvengingRage
Thanks TerrorFLOP, for addressing some of the issues I was wondering about. I have learned C++ and been using it to code a couple of simple games for my own enjoyment and progress, but recently I've read some thing suggesting C# might not be a bad addition to make. I was wondering just how different the two languages are and how much use C# sees in commercial game development.
So again, thanks for keeping me from creating another of these threads!
Trapper Zoid
Trapper Zoid
It depends on how much programming experience you have and in what languages. If you're completely new to programming you'll need to be working on understanding the basics before you get to doing anything as complicated as a graphical game. You'll undoubtedly learn more languages as you go, so if you're just starting out it's best to pick a language that's suitable to learn in rather than what you think you'll be using for the rest of career.

If you're completely new to programming and open to other languages I'd recommend Python. It's a nice language to start with, and is capable of making simpler 2D games on its own.

I don't know C#, but I do know a fair bit of C++, and I can't really recommend it as a starter language. It's got a fair learning curve before you can understand how to do anything, and you need to do a lot of housekeeping within your programs that other languages will do for you. C++ is also nigh-impossible to master; once you get to the really advanced stuff it gets real convoluted. The more I learn the more complex it seems. Personally I'm now moving more towards working with Python and C instead of C++.

VizOne
VizOne
I'd personally vote for C#. While it is relatively easy to understand for beginners, it still has a powerful syntax (especially C# 3.0) and several facilities to use native code if necessary (DllImport, referencing mixed mode C++/CLI assemblies, tblimp).

If you don't absolutely need the platform indedepency of Java, I'd definitively prefer C# over Java. Having worked with both I can say the C#/.NET is more polished than Java. When C#/.NET came out, many people said C# would steal from Java. Now it's the other way round: look at the specs for the upcoming Java 7 and you'll find a lot of features C# already has built in (and you will miss a lot of feature if you're used to C#).

Above all, the Java virtual machine is completely based on (non-generic) classes, interfaces and the primitive types (int, float etc.) From the Java VM point of view, generics don't exist, enums don't exist etc. Those features are syntactic sugar only which depend on the support by the Java compiler.

The .NET CLR on the other hand has classes, interfaces, enums, structs, delegates and generics as first class members. This provides a lot more potential for writing efficient (less boxing etc.) code which is desirable for games.

Having said that, the basics of Java and C# are comparable, so especially at the beginning you may get happy with any of the two. What's for sure is that a managed environment like C# or Java will be a easier to deal with if you're new to programming.

Finally, understanding programming concepts that are independent of the language (think of OOP concepts etc) will be more important than the choice of the language after a while.

So: Just pick one language and play with it!

Regards,
Andre
velentry
velentry
First off ill apologize to TERRORFLOP i had no intention of wanting to create this into some sort of flame post so sorry if it came across that way.

Anyways i can see picking a language is like an artist picking a pencil everyone has there own preferences of which to use yet they all kinda of get the same results if you know what your doing.

But by the sounds of everything I'm guessing C# or Java simply because i am very new to programming i won't hide from that fact, and i do know that when going on games on the internet that all seem to use Java or used to i haven't tried in a while XD. Also though once i do get the hang of C# or Java ill probably give C++ a try as well since then i will understand scripting much more and it will help me a lot since I'm aiming myself towards a career in game or CG film developing.

Thanks for all the help I'm going to be getting my hands dirty in some code, my programming virginity will be gone forever :P

Anyways once again thanks for all the help
Vel
Structural
Structural
Quote:
Original post by velentry
Hi its me Vel,

I am looking to make a simple RPG with transitions between battle and the usual so i can learn a programming language the only problem is before i spend some money buying books (the best way i learn :P) i was hoping someone could recommend a programming language that would be best.

The main area i would like to concentrate on would be RPG's which is probably just about the same as everyone else but i am also quite tempted with the idea of a Platform game so i would need a language that would be versatile for both.....or wouldn't it matter.

Sorry if the above seems a thick question :P
Vel


I'm using C++ at work, and C# for my home project.

If C++ and C# are your only choices, and you're rather new to programming, then C#, without a doubt.
C++ has too much of a learning curve for beginners to get results quickly. For example the whole manual memory management, pointers and lack of basic functionality (like the .NET framework provides) make it a poor choice to be a language to begin with.
C# does those things for you.

The argument of libraries being mostly in C/C++ is not much of an argument either. There are plenty of libs for C# that are aimed at game development that can do things like networking, graphics and physics for you. You just have to look more around a bit.
STOP THE PLANET!! I WANT TO GET OFF!!
V-man
V-man
I would go with C++, the language without any limits. I've been using it for years. There are always going to be new languages like D, C++0x, C++1x, C-- so C# is more likely to get the boot and be replaced with the next new thing.
C++ will always be around since it is ancient and been used all over the place.
Promit
Promit
Quote:
Original post by V-man
I would go with C++, the language without any limits.
Okay, implement closures. Or look up the members of an arbitrary class loaded at runtime from a DLL. Or get a listing of all the available classes in a namespace.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
asp_
asp_
Quote:

Okay, implement closures.

I suppose this can be done in some manner. Boost::Spirit has a closure class and I've seen a few other examples of closures in C++. Not sure how pure they are as I've never needed them outside of spirit.

Quote:

Or look up the members of an arbitrary class loaded at runtime from a DLL.

It's really outside of the scope of the language to be honest as it would violate the low overhead requirement. Reflection isn't exactly free. You can make your own reflection library for C++ if you want to. It's far from impossible.
velentry
velentry
So overall you would say that C++ is the best language to use simply because of its diversity and use everywhere. I'm exactly where i started but i'm going to work in Python for a little bit just to get used to writing in another language then progress from their.

I'm guessing this but i presume they all follow the same sort of rules to an extent obviously you can do more in some then others but at the end of the day the basics are basics and no matter which language you learn it in its still going to be the same or is that completely wrong :P

Thanks for all the feedback

Vel
asp_
asp_
C++ is never a good starting language IMO.. If Python meets your requirements I would use that, if not I would see if C# meets your requirements, failing that I'd go with C++. Even python and C# would require a significant investment before you see any actual results. Try to find a framework if you can, that way you would get results immediately, i.e game development experience but not much software engineering experience.
phazmatis
phazmatis
Your end goal in programming is to learn C++. It is the most widely used, and it is the most powerful high-level language. However, I also suggest starting with something easier. Because C# is very, very similar to C++, I would start with that. (I learned C++ over time, and picked up C# in a day.)
oler1s
oler1s
Quote:
So overall you would say that C++ is the best language to use simply because of its diversity and use everywhere.
No, we would not say that. As stated before, there is no best language. Furthermore, C++ is not as diverse as you might believe, and it definitely isn't used everywhere.

Quote:
I'm guessing this but i presume they all follow the same sort of rules to an extent obviously you can do more in some then others but at the end of the day the basics are basics and no matter which language you learn it in its still going to be the same
Computer science is language independent. The ability to think like one does not depend on the language you use.

But you get the wrong idea about how they are the same. It's difficult to explain, so a good illustration might be learning a bit of C++, then Haskell or Lisp. Should be enlightening...
Promit
Promit
Quote:
Original post by phazmatis
Your end goal in programming is to learn C++.
Really? My end goal in programming is to produce good software efficiently, and except for a few niches like games, C++ is a truly terrible choice for that.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
asp_
asp_
Quote:

and except for a few niches like games

C# is more niched than C++ which in turn is more niched than C. Most of the software written in the world isn't written as traditional desktop applications or dynamic websites. While C# has a smaller niche it's far better within those niches. The fact that the .net platform is less generic is probably what makes it better in the first place. It can drop a lot of the lowest common denominator factors which burdens C and to an extent C++. The .net platform doesn't even run on a majority of platforms, probably less than 5% are .net capable.

Also I think this strays a bit from the subject since it IS games the author is asking about :)
MARS_999
MARS_999
C++ with STL and BOOST FTW! Really, just choose a language and use it. NO ONE here is correct in their OPINION on what language to use, that is why it's called an OPINION.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.