Download

Why C++ for Unreal 4?

The choice of language has nothing to do with the programmers mindset. A proper choice of language is the one which fulfills all of your projects needs, which has nothing to do with the programmer at all.

Also, you claiming C# isn’t compatible with your brain is just a blatant excuse for laziness. Sorry, but it is. You have a human brain. It can understand far more than you think it can. Stop limiting yourself by be so negative…

This is a subjective statement. Both languages have plenty of tools for dealing with both size and complexity. In fact in my experience, out of the box, C# has more tools for this. Also, C++ is a terrible language for implementing very very large projects.

Choosing one language for everything is just a terrible and stupid idea. Choose what works best, not for you, not for the language, but for your project’s needs.

Again, C# isn’t a language you all can just compare to C++ directly really… They are completely different beasts. C# is and was never meant to compete in who is better with C++. You guys are discussing which is better, Language A meant for tasks G, and language B meant for tasks J. If you honestly are choosing between C++ and C# with your project, I REALLY think you need to reassess what you’re trying to do with the project.

True. I think the whole C# vs. C++ debate only exists because these are the two choices today in the two most popular game engines, Unity and Unreal. Normally the question of which one to use doesn’t even come up. Modern enterprise software with databases and lots of web aspects is developed with either C# or VB.NET (and the .NET framework in general) or Java. Those technologies exist specifically to be more productive in this type of scenario. Those are also the cases where language performance is way less dramatic as the bottleneck is almost always on database or network.

That’s nonsense.
You acquire language knowledge and then get hired as developer working with that language specifically.

Sure any decent programmer can tinker in 3 to 5 other languages, but people tend to specialize in one or two of them.
So, if you hire a Python developer and then make him write C# programs, your project utilizes human resources inefficiently.

I actually worked with C# for decent amount of time and know my stuff.
Claiming that all human brains are the same is lack of understanding of human nature.
Different people think differently.

I want full control over every single aspect of the program and full predictability. C++ provides that. Most of the other languages - including C# - don’t.
That’s what I meant when spoke about mindsets.

That’s your subjective opinion.
You’re saying that because it is incompatible with your mindset and you don’t know how to utilize C++ for large projects.

Didn’t I already post that “The “right tool for the job” principle still applies” in this thread?
I guess some people have trouble paying attention.


I think it would probably the best to nuke or close this thread. It is just plain old language war, with very small amount of useful info.

NegInfinity
Me

That’s nonsense.
You acquire language knowledge and then get hired as developer working with that language specifically.

Sure any decent programmer can tinker in 3 to 5 other languages, but people tend to specialize in one or two of them.
So, if you hire a Python developer and then make him write C# programs, your project utilizes human resources inefficiently.

I’m sorry but i think your education was misguided, you should have learned how to solve problems, not how to write in a single language. the language is irrelevant. you should be able to solve pretty much any problem regardless of language, unless the language doesn’t support a feature.

I actually worked with C# for decent amount of time and know my stuff.
Claiming that all human brains are the same is lack of understanding of human nature.
Different people think differently.

Of course people think differently, that doesn’t change a humans ability to understand something. Try thinking about it differently.

That’s your subjective opinion.
You’re saying that because it is incompatible with your mindset and you don’t know how to utilize C++ for large projects.

No, what i said is c++ is terrible for very very large projects… its much better to utilize multiple languages in a large project. C++ alone IS a terrible solution for a gigantic project. Just look at the size of unreal engine 4, which isn’t even that big of a project mind you. It has C++, Objective C, C, C#, Python, JSON, HTML and others. Unreal Engine 4 is only about 55.6% C++

Didn’t I already post that “The “right tool for the job” principle still applies” in this thread?
I guess some people have trouble paying attention.

You did, but you didn’t say that it’s dumb to choose a single language for everything… It wasn’t directed *towards you *specifically. I mean, I did try to separate that by two whole lines.

I think it would probably the best to nuke or close this thread. It is just plain old language war, with very small amount of useful info.

I disagree, there has been good civil conversation.* Granted this thread would be more suited in general discussion.*

Processing 2.0 for life, let’s use that for all game engines from now one please.

Dear Community,

For anyone wanting to learn UE4 C++ I have posted an entry-level wiki guide here!

I discuss the essential basics you need to know to get used to both C++ and UE4 C++

Rama’s Entry-Level Guide to UE4 C++

C++ is just like any other language, you just have to start coding in it to get used to it, its like riding a bike. You wan’t learn to ride a bike until you just… start doing it!

My guide covers the most essential basics that will allow you to begin having fun coding in UE4 C++ very quickly!!

Please do not worry about being perfect, just start, and then your perfection will grow over time as you code in UE4 C++ more and more!

Have fun today!

:slight_smile:

Rama

It’s a matter of performance (C++) versus productivity (C#). People is reluctant to use C++ because it has a lower level of abstraction compared to other languages and this is typically at the expense of productivity. In other words, the game run faster with C++ but you spend lots of time to finish your code.

C++ is multi-paradigm language, and not enforce programmer to use only one.
You can write data handling in DOD, interfaces in OOP and yet another stuff with simple C-like standalone functions.
Don’t want inheritance? No problem.
Don’t want virtuals? Your choice.
Define your class and treat her like you want, not like paradigm want.

I think this is main reason why I like C++

Err. You got it wrong. People are reluctant to use C++ because it is complex. It is loaded with huge number of features, can be high level, low level, or almost anything you’d want it to be, but it doesn’t hold your hand so when you shoot your own foot, language assumes it is obviously because you wanted that to happen. The goal of the language is to bring programmer maximum amount of power and make available any technique programmer would want to use.

The reason is complexity. As for level of abstraction, C++ is as high level as C# if not higher level.

Oh you. ╭(◔ ◡ ◔)/

dude, what have you been smoking? i gotta correct you here when you say: ‘No modern language compares favorably to C++, in any respect really.’

a notable early attempt was D, which compares favorably. but what compares even more favorably is Rust and how it improves on C++ by correcting the major flaws of C++, basically a badly mutated functional superset of C. Rust finally comes in to clean the house of all that garbage.

don’t believe me, read this: https://www.rust-lang.org and this: What do C/C++ systems programmers think of Rust? - Quora

and listen to what Rich Hickey (the creator of Clojure) has to say about C++: no time to find the youtube vid for you but here is a page where some of it is briefly summarized and why OOP sucks: The Unofficial Guide to Rich Hickey's Brain. rich is a guy who spent years using C/C++, Java, etc… so not some idiot off the street who doesn’t know what he’s talking about.

and when you say: ‘beauty - yes! it is beautiful language which so much possibilities that no other (current) language can compare or even come close to.’

again i need to stop you right there and draw your attention back in time to John McCarthy and his creation of Lisp in the late 1950s (among many other things that fundamentally influenced the development of computer science and languages to this day): you speak of beauty–compare the elegance of Lisp and its modern-day incarnation as Clojure (http://clojure.org) to what IMHO is the sheer ugliness of C/C++ code.

but beauty is in the eye of the beholder, of course. :wink: nonetheless, i write this in the hope that anyone reading this might see the time has come to move on to better and more elegant tools: Rust and Clojure.

we would have been living in a much better compute world IMHO had coded been developed in Rust and Clojure instead of C/C++ and Java/C#.

obviously, i don’t want to start requoting 1,000s of pages you can easily find on the web and start a flame war about languages, but need to mention that there are plenty of other worthy efforts in addition to the 2 i mention: ML, OCaml, Haskell, Scala, ADA, Smalltalk, etc…

as an aside, it sure would be nice to be able to use Python and/or Clojurescript in addition to Lua as a scripting language for UE. we live in a polyglot world–let’s not restrict UE when so much more is achievable.

before we lose our senses, i urge the community here to read this:

'Today’s OOP languages - Ruby, Java, Python, etc. - are fundamentally flawed. They introduce accidental complexity by building on an inaccurate model of reality. Where they have explicit definitions for the following concepts, the definitions are wrong:

Value
State
Identity
Time
Behavior’

source: The Unofficial Guide to Rich Hickey's Brain

Just wanted to throw my hat into this conversation from a particular viewpoint: I’m a long time Unity user who’s about to start exploring Unreal. I’m quite comfortable in C# and while I know some basics of C and C++ (I’ve taken a total of two university courses that cover these languages) I have a long way to go.

So-
Despite some hyperbolic opinions and occasionally over the top arguments, this thread has proven to be quite useful and I’ve enjoyed reading it. I learned quite a few things about C++ and C# that I was not previously aware of. People arguing over things is generally a good way to learn about those things if it is a civil argument, both sides want to prove their side is correct. This leads to them explaining what’s good about their side and bad about the other. In a more succinct sense, this thread has gathered a lot of useful points about C++ and C# for me to go over.

So thanks for arguing this out and discussing it. I’m gonna go read some links and start learning about smart pointers and unique pointers and the various tutorials that have been posted.

I am a professional C# developer and a long, long, long time hard core C++ guy. The last metrics I have read is that C# is comparable to Java (not javascript) in terms of speed and performance, on average bytecode languages tend to run about 10x slower than C++. This is sort of the price you pay for using a managed language. However that does not mean that Everything C# does is that slow, remember the key word is “average”. Sometimes that metric may be closer to 1:5 or 1:2 and even 1:1, and also remember we are dealing with a handful of milliseconds so an operation that takes 5 milliseconds in C++ will take 5, or 10 to 50 milliseconds in C#. However even my Javascript now a days runs ridiculously fast, executing several operations at the rate of 1 millisecond and it’s not even a bytecode compiled language, it’s an interpreted language. So is C# viable as a game engine core, yes if your game is computationally light or medium (which is a bit subjective because what is Heavy today will be light in the future). Is C# viable as a scripting language when your engine is built on C++, absolutely. Is C# great for engine tools heck yeah. The same goes for a lot of other languages such as Javascript which has been becoming an increasingly popular choice.

With all this noted I would also like to point out that Unreal Blueprints are Bytecode and have an execution time comparable to C# and Java. There have been quite a few games developed using just blueprints. Of course they have the a C++ core to back them up, but still it is something to note. And as a second note the Blueprints in the future maybe compiled to C++ code (if I heard that correctly).

Well, this came back from the dead…

For me, Blueprints’ greatest offense isn’t even the performance; it’s how long and tedious it is to work with them compared to a scripting language, how limited in functionality they are, and how impractical they are to try to maintain and understand quickly. Also, one of the biggest reasons why I want a scripting language is to make editor tools, and it is often impossible to do that in blueprints

I wish Epic just made a scripting language instead. One that is officially-supported, so that people wouldn’t be afraid that the support for it could drop at any time.

Ideally, I would still write most of my game systems in c++, but sometimes you just wanna make a quick script for editor tools or things that aren’t very performance-critical. Scripts would be incredibly useful for that.

No, BP is the best thing!!! Once you get into it, it’s easier to pick up than scripting (especially for artists / designers).

Btw, this is the best C++ vs C# thread ever The Mono Project likes scripts. Does Epic Games? - Feedback for Unreal Engine team - Unreal Engine Forums !!!

No doubt BP seems like the best thing ever for artists, but for a programmer, blueprints are an immense downgrade compared to a proper scripting language.

There are plenty of things you cannot do in blueprints (or cannot do quickly and efficiently)

I doubt that - look at Epic’s programmers. They use C++ in conjunction with BP to achieve their goal. If BP was that bad, Epic wouldn’t even bother with it. However, BP is not a downgrade. Just different concept (visual vs text). You can do everything straight in C++ anyway.

Epic uses BP because it’s good way for programmers to make a bridge to artists and designers. It’s also their main “marketing strategy” to appeal to the mostly-unexperienced masses (and I don’t mean that in a derogative way). But it’s not that great for programmers themselves, compared to scripting.

c++ works, but it’s not always ideal. When you just want to make an editor tool (which is impossible in BP), or a quick script, you don’t want to have to die of old age three times while waiting for intellisense to kick in, and for misidentified errors to disappear