Why C++ for Unreal 4?

[=Serapth;19250]
As someone who teaches people how to program, specifically games, I have struggled with this for a while. I have been asked dozens of times if Unity was a good way to learn to program. Should I learn to program then learn Unity, or should I learn to program while learning Unity? The same applies to Unreal Engine, and after all this time I dont have a good answer.
[/]

Specifically to this point my answer would have to be “both”. As you say programming or learning a subject in a vacuum is not easy. Once you have some of the basics down though opening up UE4 or Unity and starting to do small things with immediate feedback is a pretty powerful.

Also Blueprints are a pretty neat way to learn programming basics, but without the pitfalls that frustrate so many beginner: archaic compiler errors from missing semi colons, mistyped identifiers and other details that can be overwhelming at first.

[]
As someone who teaches people how to program, specifically games, I have struggled with this for a while. I have been asked dozens of times if Unity was a good way to learn to program. Should I learn to program then learn Unity, or should I learn to program while learning Unity? The same applies to Unreal Engine, and after all this time I dont have a good answer.
[/]

Well if learn programming overall, blueprint is better for that :slight_smile:

[=;19205]
This tends to happen when files are spread out across a hard drive, and take much longer to load initially than subsequently when the files are cached. For optimal performance, compile and run from an SSD such as this awesome one: Are you a human?
[/]

Oh snap that is exactly what I need :wink:

Should just close this thread.
It has run it’s course.

[=Serapth;19250]
I can see merits both ways. One of the things that make learning easier is being hands on. If I could go back in time and learn 12th year math knowing it was directly applicable to game programming, I would have groked Matrix math, translations, etc… a heck of a lot easier. Learning something as a completely abstract concept is never easy.
[/]

This is awesome, I wasnt even in high school when I started to need vector calculus and trigonometry in my gameplay programming, I do partially consider it a failure of the school system for being so backwards. I think blueprints could really help as a teaching tool for younger students wanting to learn the mathematical concepts, C++ would work too and it could certainly lead into that but Ive said enough on difficulties of syntax. Lets just say for instance that English is a complex language yet we all are using it fairly proficiently in this thread but the meanings behind the words can be shown visually so children can comprehend concepts beyond their ability to communicate them, there is a saying about you havent truly learnt something until you can teach someone else but we learn mostly through doing I believe so I agree that abstract concepts sometimes need that tangibility to spark intrigue.

I dont think C++ is THAT complicated, after all i learn the basics in a week without prior knowledge. Of course you can wreck havoc and accessing nullpointers cause a crash( mayor annoyance coming from UDK, where you could do whatever and it will never crash) if you think C++ is that strange, keep it simple, try to avoid pointer math, templates, and things like that, wich are complicated. In gameplay programming like UE4, you only need pointers to get the objects, but not pointer aritmetic, and you can avoid templates just fine. In fact, i had no problems coming from unrealscript to UE4 c++, as UE4 workflow makes both really similar.

[=Vipar;19368]
Should just close this thread. It has run it’s course.
[/]

We plan to moderate pretty lightly here. I don’t expect we’ll close threads unless they turn into flame wars or 4chan.

[=vblanco;19516]
I dont think C++ is THAT complicated, after all i learn the basics in a week without prior knowledge. In fact, i had no problems coming from unrealscript to UE4 c++, as UE4 workflow makes both really similar.
[/]

I agree with!

UE4 C++ is much more about the awesome code base that and Epic are giving you, rather than technicalities of C++.

If you are entirely new to the Unreal Engine, c++ will look daunting because the UE4 code base is vast and powerful!

Approach UE4 C++ as the incredible gift of a fully featured 3D game engine and editor API from and Epic,

and you will see that the majority of what you need to learn is how this API works, not how c++ works :slight_smile:

I have posted many tutorials in my signature to help you learn the UE4 API via my own code examples with explanations.

[=Sharpfish;15345]
the top of the tree (no, not assembly or machine code lol).
[/]

I thought that asm is rather near bottom. And its rare skill nowadays.

[=vblanco;19516]
I dont think C++ is THAT complicated, after all i learn the basics in a week without prior knowledge.
[/]

It is not complicated at all, what it makes hard are all those functions, classes api’s that one need to know about, or know that something he/she needs exists somewhere.
I am quite happy that unreal 4 has blueprints, its easy way to experiment and see what does what without pain of recompiling source.

[=Nawrot;19791]

It is not complicated at all, what it makes hard are all those functions, classes api’s that one need to know about, or know that something he/she needs exists somewhere.
I am quite happy that unreal 4 has blueprints, its easy way to experiment and see what does what without pain of recompiling source.
[/]

Gratz. You pretty much described every possible programming language in existence. Maybe with exception of assembler. (;.

No unrealscript anymore

Hi guys, does it mean there will be no more unreal script anymore??

Hi Nawrot, I prefer C++ to any language in the world. but does it mean UDK will not support unreal script anymore??

All these comments (well, MOST of these comments) contain SOO much knowledge. Each language has its pros and cons, and to me, C++ seems to be much easier, but again, that is JUST me. I learned in C#, and so that made C++ much easier to comprehend and deal with. I would recommend anyone who wants to learn to code to learn the basics of both C# and C++ and just go from there. You will find out which one is easier for you, and either way, you can accomplish anything you set your mind to.

Again, thanks for all these comments. They are not only helping me learn so much more about coding, but they keep me entertained too :slight_smile:

[=Riddle;19874]
Hi Nawrot, I prefer C++ to any language in the world. but does it mean UDK will not support unreal script anymore??
[/]

UnrealScript does not exist in UE4 (it’s still there in UDK aka UE3). Our officially supported languages for UE4 are C++ and Blueprints. Some people in the community are working on JavaScript V8 and Mono integrations, but those aren’t officially supported.

Cheers,

[=Devlin Kain;19884]
All these comments (well, MOST of these comments) contain SOO much knowledge. Each language has its pros and cons, and to me, C++ seems to be much easier, but again, that is JUST me. I learned in C#, and so that made C++ much easier to comprehend and deal with. I would recommend anyone who wants to learn to code to learn the basics of both C# and C++ and just go from there. You will find out which one is easier for you, and either way, you can accomplish anything you set your mind to.

Again, thanks for all these comments. They are not only helping me learn so much more about coding, but they keep me entertained too :slight_smile:
[/]

Actually it’s good to know both languages well, as one has very good performance, and the other one is very fast to code with.

[=;19750]
We plan to moderate pretty lightly here. I don’t expect we’ll close threads unless they turn into flame wars or 4chan.
[/]

Which is fine, but when a thread keeps going around in circles and we keep repeating ourselves it would seem that a thread has run it’s course and is better preserved by just being locked.

Fortnight source - a snowball’s chance in hell?

[= Zeigler;17702]
MonsOlympus has some good questions from the last page, so I thought I’d describe how Fortnite is mixing C++ and Blueprints. Here’s an example class hierarchy for one of our enemies:

If anyone has specific questions about to set up a hierarchy, ask away and I’ll reply. As an example, Mons I’m not entirely sure what you meant by “I might encounter the need to have C++ Blueprint dependencies like Archetypes and Id prefer not have those hard links between external and internal classes”. What specific pattern are you trying to avoid?
[/]

Hey , , fellow UE4 developers & enthusiasts,

I know this is a stretch, but I have to ask: If Fortnite is to be a free-to-play game (not sure where I heard that, was it twitch.tv?) has Epic considered releasing the game source to the developer community? I’m studying the engine source & samples as time permits (translation: not enough) and it certainly would be great to study a hard-core, real-world example implementation by the guys who wrote the engine. And perhaps in the future open the game up to developer contributions? Naaw, that’s going just too far!

Yeah, I know the chances of this are lower than a cross-map headshot over a 300 baud modem, but I had to ask…

I usually stay out of the religious programming-language wars, but I guess I just cant resist adding my perspective to the pile:

Back when I was actually paid to develop games (in the Unreal 1 days) one of my primary tasks was to merge our game’s codebase with Epic’s engine update code-drops and resolve the issues as they arose. Initially it was pretty difficult since 3-way diff & merge tools were pretty primitive (egads, did we actually use MS SourceSafe back then?) and our group of green developers were pretty liberal about breaking all the rules. But pretty quickly we learned thru painful experience to absolutely minimize our C++ side engine mods, basically just insert a few hooks where we needed them, and keep as much as we could in UnrealScript. It was a pretty educational experience watching the engine evolve from release to release, although the process never became what I’d call routine.

UE1 was the first really large source code base I worked on, and it all was a good exercise in understanding those linkage vs. cohesion issues my CSC professors were always talking about. The code eventually evolved into a nice, clean separation of engine from game code, defined by a formal API. I’d be the last on the list to lament UnrealScript’s demise, even though it was pretty good. But what concerns me now about a 100% C++ engine is that developers are going to start to subclass from random classes, make strange coding mistakes, and generally make a mess of things just like we did back in the day. But they will, it will work, and they’ll ship their game that way. Until unintentionally breaking changes are released by Epic. But now the separation between game and engine are blurred (for very good reasons, I agree). This will force Epic at some point to either freeze their code-base at some level due to compatibility-breaking changes (the removal of UnrealScript is a good example) or go into backwards-compatibility regression testing hell (aka become Microsoft).

If that wasn’t clear (it wasn’t) in other words, this API provided a nice division that’s been lost which back in the days was:

  1. Write your code in UnrealScript wherever possible
  2. If you need your own C/C++ functionality, try to implement it in a separate DLL
  3. If you need to mod the engine, be willing to be responsible for maintaining that mod and merging it into code-drops indefinitely.

These rules sure saved our bacon when I was told to merge the latest (and really big) code drop, a week before we went gold!! I’m sure that Epic will do everything they reasonably can to not dump breaking interface/behavior changes on us, but now that the line is much more fuzzy (complex) I’m not sure what the new rules are.

All this being said, take the above with a grain of salt - as I think I mentioned I haven’t done any serious UE development in over a decade and am now just getting to know the new engine (and it’s getting pretty late), so I could very likely be wrong about the current state of affairs. Heck, I’m still trying to get my head around Blueprints!

[=->;21335]
If Fortnite is to be a free-to-play game (not sure where I heard that, was it twitch.tv?) has Epic considered releasing the game source to the developer community?
[/]

That’s a really interesting/crazy idea! We’ll think further about whether any future Fortnite mod plans could eventually include source code as a long-term component.

[=->;21361]
Back when I was actually paid to develop games (in the Unreal 1 days) one of my primary tasks was to merge our game’s codebase with Epic’s engine update code-drops and resolve the issues as they arose… I’m not sure what the new rules are.
[/]

Generally, code residing in separate modules will be more resilient to future changes than direct modifications of Unreal Engine code, and gameplay code will be more resilient than other systems.

Compared to the Unreal Engine 1-3 days, now provides an efficient mechanism for code changes to be submitted to Epic requesting incorporation in the mainline code base. This may change the dynamics of development. If, in the course of building a mostly-modular game, a programmer makes some well thought-out changes to existing code, we’ll be happy to consider integrating them through a pull request.

[=;15581]
C# on the other hands has memory leaks and you simply have no control over them. C++ gives you power. With that power comes responsibility.
And you know it is not that it is easier to write non - leaking programs in C#/Java - simple example, file management:
In C++ if you use memory management technique called CADRe or RAII - (Constructor Acquires Destructor Releases ) then you put opening file code in constructor, releasing that file to memory in destructor and your done. No more worrying. In C#/Java you have to actually manually close every file you’ve opened. So how is this for easy / hard.
And guys, don’t fool yourself that working with C#/Java is easier than with C++.
It is like with toy tools and real tools really. It is much easier to build castle from than real castle but after the work mounts up, you realize that only real castle is actually livable. The one is unusable.
C# destroyed Visual . Once my beloved IDE, now I simply cannot look at it.
[/]

No offense buddy but you don’t have much of a clue what you’re talking about and you shouldn’t try to give people false information if you don’t have the knowledge or experience to back it up. C# doesn’t inherently have memory leaks. Memory leaks can be found definitely within a couple of classes within the .NET Framework but they are pretty rare. If you get memory leaks in your code, it’s because you are not disposing of the native unmanaged memory properly and is usually caused from programmers not keeping track of the memory.

Also, the misconception that in C# you have no control of your memory is complete BS. You can do a lot of self memory management in C# that negates the GC, and not too mention you can go unsafe and use C++ pointer references and even call into low-level kernel calls so it’s more than doable for people who want more control of their memory within C#.

In C++, you still also have to manage file IO the same exact way. Just because you are using mechanisms that allows you to easily open a file in your constructor while it manages the memory and close it out in your destructor doesn’t mean the same concepts don’t apply for opening the file and self-managing it from a basic standpoint. The only difference here is you having it auto manage the memory for you instead of you doing the manual memory management yourself. Look at any beginner C++ File IO tutorial out there and you’ll understand what I am talking about.

Now in C#, you could even do the following…

using (var MyFile = File.OpenRead(…))
{
// Do some code like read or write to your file here
}

By doing it this way, you are managing the memory of the file automatically by using a “using” statement that disposes of the file after it leaves scope. So its even easier to do in C# and less lines of code than C++. And two more things about File IO is that if you chose to negate the “using” statement, all you need to do is call… MyFile.Close(); That’s it, not too hard for anyone at all :wink: But also the second thing is not in every case are you going to want to have the file open in the constructor and close it during the dispose call. Unless you absolutely need to keep the file handle open for the lifetime of the class and there is a purpose to keeping it around, then it’s bad practice to do that.

I’ve been developing for over 25 years and in over 15 different languages and to say C# is a toy language and not easier than C++ is I can only say one helluva pretty ignorant statement and quite laughable. Now don’t get me wrong, out of every language I’ve ever used, C++ to this day is still the best when it comes to achieving performance if you want that raw low-level access. However, C# is completely a much easier and more elegant programming language than C++ ever was and is much easier to pick up quicker as a starting point then throwing someone into C++ initially as a beginner. And C# is used professionally for a lot more than tools these days. Even in the company I left recently, I would do a lot of our software in C# for them and even a lot of HLSL, OpenCV and advanced CV algorithms while in C#. I’d sometimes do these instead in C++ if I needed that extra ability to optimize the performance but it definitely wasn’t the case all the time and it sure as hell didn’t make our software any less unprofessional.

[=;15581]
It is like with toy tools and real tools really. It is much easier to build castle from than real castle but after the work mounts up, you realize that only real castle is actually livable. The one is unusable.
C# destroyed Visual . Once my beloved IDE, now I simply cannot look at it.
[/]

(…Blank Stare…) You’re kidding me right?! I don’t think you even understand what you just said. Now all joking aside, if you are referring to how the dev environment is setup, you can change it so that C# is not your default dev environment in VS and C++ is. If that’s not what you meant, then you aren’t making any sense as C#'s integration into VS doesn’t have any affect on the IDE in a negative way or in any if you are coding in C++. You do realize there is option when you install to “Not install Visual C#”… when you install Visual ?

I would say to anyone out there thinking about becoming a serious programmer and about using UE4 to create your next big game, don’t worry if you choose to start with something like C#. It’s much easier to pick up than C++ and will help you get the basic fundamentals of programming down. Get a couple example apps running and when you feel ready, transition over and start learning C++. Buy books and use resources like Google and as much as you can as there is a lot of great tutorials out there on C++. Chances are, if you are dealing with a problem in code, there is a good chance that someone has and not only documented it, but teamed up with a forum community to solve the issue.

Also, Blueprints get compiled down so they are just as performant as C++ and will probably be even easier for anyone new to get started with. Just beware, that you can still create un-optimized code based on how you wire everything together so continue to learning the basics of programming and how to optimize your code and what that means to your application. Create little example apps so you are understanding basic concepts and practices then move on when you are ready to rock.

I get that C++ is a much more difficult but once you master it, you’ll be able to do practically anything but as a starting point, stick with the Blueprints and good luck :wink: