Jump to content

  • Log In with Google      Sign In   
  • Create Account


JamesTheNumberless

Member Since 27 May 2009
Offline Last Active Sep 22 2012 07:23 AM

#4980906 C# and C++

Posted by JamesTheNumberless on 17 September 2012 - 09:29 AM

I can't tell if this is a troll or someone who just woke up and decided to make a game. C# is a less complex language, however I wouldn't consider it harder. And there are more than 3 threads about this same thing on the first page of the beginners section.


nooooooooo, C# is a more complex language - it has much more in it than C++ and is growing all the time (even if half of what they add these days is confusing people about the best way to use it) :) But programs written in C++ are more complex out of the necessity of dealing with a lot of machine level concepts that are dealt with for you by the C# runtime. C# has features that are far beyond anything C++ by itself can comprehend such as support for dynamic typing, memory management and a completely different system of linking & compiling that's much faster, cleaner and more advanced. There's nothing stopping you from making all these things in C++, and there are low level things you can make C++ do that are unavailable in C# (without unsafe code or interop) but those are available by virtue of the language being simple, not complex :)


#4980903 C# and C++

Posted by JamesTheNumberless on 17 September 2012 - 09:21 AM

I say just go ahead and learn C#. It's an essential skill for modern Windows programming to know C# (or at least some .NET language) and how to use the .NET Framework. C# will be much less painful to learn and you will be a deadly programmer when you learn it. Moving on to learning C and C++ will be FAR easier, as you will already understand programming and the languages are very similar in style, syntax and structure. But, in the end, you will need to know both to be a really effective game programmer and be eligible for a wide variety of jobs in the games industry... I just think learning C# first will be much easier.

Don't fall into the trap of thinking language A is "better" than language B. Most such claims are complete nonsense, unless we're saying BASIC and VB.NET sucks (just kidding! lol). Programming languages also do not (I repeat, do NOT) have any attribute, element or property called "power". All Turing-complete languages are "powerful". Theoretically, any Turing-complete language can calculate the entire span of existence of the known universe. C# is not "less powerful" than C or C++, nor is the reverse true. Likewise, assembly language is not more "powerful" than C... Languages also do not have any sort of fixed performance. The performance/speed of code varies from machine to machine, API to API, programmer to programmer, etc... Some languages can be theoretically faster than others due to physical limitations or advantages (e.g., JIT compiling or interpretation), but no programming language has a "top speed". Well-written C# code can easily outrun badly-written native code, and vice-versa. Managed languages, despite being theoretically slower due to JIT compiling, can sometimes be superior in performance to native code considering the gains in memory efficiency, reduced bugs, cleaner and better-written code, etc. While I can usually squeeze a couple more milliseconds out of C than I can with C#, sometimes complex algorithms can be faster in C#. It really all depends... just, like I said, never subscribe to any belief that any language is necessarily "better", "faster" or "more powerful" that any other (provided we're talking about practical, Turing-complete languages...not brainfuck or anything impractical).

If you start with C#, then you'll have the opportunity to learn the essence of Windows application programming (via Winforms) and the essence of DirectX (via XNA Framework). Both of these are easy-to-use APIs that are quick and easy to get started with but provide very deep, far-reaching and low-level capabilities. There's no reason you can't write a big, bad multi-million dollar Windows application with C#, just like you can with C or C++! There are plenty of them out there! When you feel you have "outgrown" the XNA Framework, which is like to happen when you want to write next-gen games for Windows, XBox or other platforms, then move on to learning SlimDX (the C# wrapper for DirectX and all its related APIs) and OpenGL.


This should be required reading for everyone before posting on a [name of managed language x] vs C++ thread :)


#4980895 C++ Alternative to Unity?

Posted by JamesTheNumberless on 17 September 2012 - 09:05 AM


C#, used by Unity, is a fully fledged OO language that has far more features than C++ and is therefore more complicated

Number of features of a language != how complicated said language is...


Yes it does ;)

C++ is simple and powerful, and difficult to use properly when dealing with high levels of abstraction. C#/Java and the runtimes they are coupled to lend themselves better to software engineering because they are more advanced OOP languages that have concepts built in that the C++ programmer has to take time developing themselves. More complicated programs, less complicated language.


#4980500 C++ Alternative to Unity?

Posted by JamesTheNumberless on 15 September 2012 - 05:05 PM

In case it wasn't clear from my last post.

There is an engine similar to Unity 3D that supports C++

It's called Unity 3D

You can write C++, compile it to C++/CLI DLLs, and reference those in your game object scripts.

So if you have, for instance, all your AI routines written in C++. You can keep them in C++, and only need write enough C# to make calls to the appropriate functions. Manipulating objects in the scene graph will still be done with C# but that's ok because in any C++ engine you'd write 90% of such code in a scripting language anyway, You have the added advantage that (like Java) C# is a proper language that's very close in syntax to C++ and not restricted, or weird, in the ways that scripting languages often are.


#4980498 C++ Alternative to Unity?

Posted by JamesTheNumberless on 15 September 2012 - 04:49 PM

Scripts are simplified versions of programming languages, so that designers and other non-programmers—or programmers with extremely little skill—can work with them.


lol

Not quite!

C#, used by Unity, is a fully fledged OO language that has far more features than C++ and is therefore more complicated. It isn't more complicated to understand, because it's better engineered.

You can code in anything that compiles to CLI, including C++, and use that code in your Unity games, providing you don't mind using Visual Studio. Compile your code into C++/CLI. The DLLs can be dragged and dropped into your unity project as assets and then referenced by C# classes attached to your game objects. You will only have problems if you want your CLI code to interop with native windows code, and then only with portability to other platforms that Unity can target.


PARTNERS