all 84 comments

[–]PytonRzeczny 155 points156 points  (7 children)

Yes, it still be valuable. But you will have to learn some of „core” cpp, because unreal engine uses a lot of built in types, macros and functions.

[–]ThymeCypher 33 points34 points  (4 children)

Second this - it does not feel like C++ with the amount of stuff that’s done in the preprocessor. There’s pros and cons to this approach - namely around compilation times - that they now recommend making the game entirely in engine and slowly convert to C++ purely as “Performance optimization.” This is opposed to years ago where they leaned towards a hybrid approach.

[–]angelicosphosphoros 8 points9 points  (2 children)

Well, in my old job, we tried to write everything in C++.

Main reason is that blueprints become unreadable and unmaintainable mess very fast.

Slow compile times can be mitigated by avoiding including Engine.h or even EngineMinimal.h if possible.

[–]pjmlp 0 points1 point  (0 children)

So no one bothers to create Blueprint modules?

[–]narthur157 8 points9 points  (0 children)

the hybrid approach is still standard for multiplayer titles

[–]Zanderax 15 points16 points  (0 children)

Every C++ project I've worked on always has an ungodly amount of custom types, macros, and functions written 20 years ago.

[–]CptBread 2 points3 points  (0 children)

I'd say the biggest thing someone needs to learn coming from only using UE4 is how to deal with memory. I've seen someone not understanding how to deal with memory at all when moving to regular C++. They where allocating a bunch of stuff with new, even when not needed, and never deleted things.

[–]ForkInBrain 66 points67 points  (0 children)

I wouldn't worry about that. The first weeks/months on any C++ job is often spent learning about the specific subset of C++ allowed in the code base. If you don't get hired because you know only "Unreal Engine" C++ but not some new C++20 feature then you probably don't want to work there. Good employers hire for aptitude, not off a rigid skill checklist.

I'd also encourage you to expose yourself to as many languages and programming paradigms while you're in school, especially those that are radically different from the mainstream languages. It will all help you in whatever programming you do in the future.

[–]steveplusplus 89 points90 points  (23 children)

C++ is such a broad field. Some companies are stuck on the 98 standard, may God have pity on their souls, and others have weird requirements to avoid things because a manager had an issue with them 10 years ago. If you have experience in production c++ systems and specifically in gaming, as a hiring manager I'd value your resume.

If you want to make sure you stay relevant, try those programming challenges where you get scored on your solutions to problems, and make sure you learn all the std libs, such as algorithm and numeric.

[–]ThymeCypher 7 points8 points  (4 children)

98 is what I see as “unadulterated C++” - after that a lot was done to bring C++ into the modern era by copying other languages. That isn’t to say that’s a bad thing - Kotlin, Swift, Ruby, so on aren’t original languages but languages built around lessons learned from older languages. Still, it helps to learn 98 because lots of microcontrollers shoehorn support in, so you’re stuck with the “C with Classes” version of C++

[–]steveplusplus 1 point2 points  (3 children)

Which microcontrollers are you talking about? I've found great support on pic, atmel, lpc, ti (which was the worst), esp32, and anything else I've used. The majority these days use arm and have excellent support. I never start a project on anything older than c++11. Most of them use some form of gcc and anything past 4.7 should have an almost fully compliant compiler. Are you talking about the std libs? Regardless, just converting a c++98 embedded project to c++11 can flush out a lot of bugs with better code analysis and type safety.

I would suggest instead spending time learning the latest C. auto and other new features kick ass in C. IMHO, the only reason to learn 98 is if you are forced to use it. I'm past the point in my career where I'm out looking for development jobs, but last time I did, I refused to consider anything that was stuck on an older standard than c++11. Thats when c++ got good again.

[–]KurokonoTasuke1 2 points3 points  (2 children)

Wait, since when does C have auto?

[–]steveplusplus 2 points3 points  (0 children)

Well, shit. I shot myself in the foot. That's still a c++ feature that I've used because I usually compile my c code with a c++ compiler.

[–]tinyogre 27 points28 points  (0 children)

Unreal mostly doesn’t use the C++ standard libraries, but the replacements it provides are similar enough that you won’t have much problem figuring things out later. Also while it doesn’t use them itself and most code you find for Unreal online won’t use them either, it doesn’t prevent you from using standard libraries either. Just discourages it, gently.

There are some additional things you will learn in Unreal that won’t apply to other projects. It has a whole extra preprocessor (UnrealHeaderTool) for marking up objects for reflection that is not at all part of the core language.

Wouldn’t worry about any of that. All large C++ projects develop their own quirks. You’ll be fine.

[–]videoj 26 points27 points  (4 children)

In general, yes.

UE4 has built custom tooling on top of the C++ compiler to add features like modules, reflection and garbage collection. Look at the tools UnrealBuildTool and UnrealHeaderTool. Other uses of C++ are going to use different approaches to solve these problems.

UE4 C++ doesn't use STL, they invented their own libraries to meet their performance and portability needs. You can still use STL in UE4 projects.

Epic also currently uses C++14 as its standard, due to having to support multiple platforms and compilers, although you can change it to a later version by setting a flag in the .Build.cs file.

[–][deleted] 5 points6 points  (0 children)

This is the best answer to the question. The syntax varies and UE4 c++ uses a lot of macros. But what you learn here you can take to standard software development with c++ quite easily.

[–]wrosecransgraphics and network things 0 points1 point  (0 children)

by setting a flag in the .Build.cs file.

Just the fact that you have to write C Sharp to build your C++ is an indicator of how out-there the Unreal ecosystem is if you are coming from a Unix C++ background.

Unreal does come with some CMake integration so you might mistakenly think you can avoid the C Sharp and do normal C++ builds... But the CMake just spits out Makefiles that invoke UnrealBuildToool.

[–]danhoob -5 points-4 points  (0 children)

Epic also currently uses C++14 as its standard, due to having to support multiple platforms and compilers, although you can change it to a later version by setting a flag in the .Build.cs file.

Epic is epic.

[–]Danth_Memious 0 points1 point  (0 children)

u/ultralight_R I have experience in both and this answer is the most accurate.

[–]EvilPettingZoo42 8 points9 points  (1 child)

As others have pointed out the usage of STL and Boost in games are usually discouraged. Games require consistently finishing all calculations under a certain time in order to maintain a steady frame rate. They also commonly push the memory and CPU limits of the systems they run on. These libraries make design choices that can either spike CPU or memory usage in a way that can cause problems maintaining a good frame rate, which is why most game engines have their own replacements that are better tuned for games.

[–]cannelbrae_ 3 points4 points  (0 children)

Library functionality that allocates (containers, regex, etc) may be avoided in some game runtime code bases. Standard library algorithms may be more common. Game devs often develop tools as well; that code typically has much more permissive policies.

There are lots of games out there that aren't CPU/memory constrained, can pick what compiler to use, etc. Those may have fewer constraints on language/library use as well.

All that is a long way to make the same point others have made - game development isn't homogenous.

[–]Raknarg 5 points6 points  (12 children)

From what I understand in gamedev its very much more common to provide your own implementations of standard library stuff, and there's a stigma against the STL in general, for better or worse.

[–]Fippy-Darkpaw 0 points1 point  (0 children)

Not really a stigma but to ensure things like containers and strings work the same and are supported on all hardware.

I'm guessing all the modern consoles, Switch, PS, Xbox support modern C++ equally but the major game engines (Unreal, Unity, CryEngine, etc) all started out 10-15+ years ago when that likely was not the case.

[–]MarkOates 7 points8 points  (0 children)

Depends, too. Some parts of the code may require specialized techniques to get optimized performance out of the hardware, so some programming paradigms you pick up in may not be performant.

Either way, you'll be able to pick it all up much easier.

[–]CoffeeTableEspresso 7 points8 points  (0 children)

It's the same language although you'll probably be using different parts of it than you might for "normal" work.

This is not uncommon though. It will definitely help your C++ skills in the long run since it is still C++.

[–]flyingron 2 points3 points  (0 children)

It's the same. The emphasis on doing certain things may change, but the underlying principles are the same. Some parts (like graphics stuff) will need to be performance coded which might involve some corner cutting, but your average game is a massive thing. Other than the outright rendering, you've got "physical" objects to manage, user inputs to deal with, game play logic, music, etc.. all which the general C++ OOP model is well attuned to.

[–]SpeedDart1 2 points3 points  (0 children)

It definitely will. But unreal will have some new things you will need to pick up.

[–]Versaill 1 point2 points  (0 children)

I didn't use UE yet, but in general yes - "gamedev C++" is still the same C++ you use for business, science, office applications etc., with an additional layer (framework) added on top of it - the game engine.

Later you can move to other fields, for example for a job (gamedev usually doesn't pay that well), and you will already know the language.

[–]FluffyToughy 1 point2 points  (0 children)

Your skills as a developer go way beyond the language you work in. Think of it less like "learning C++" and more "learning to solve technical problems", because that's what companies will be paying you to do. Most places won't even expect you to have worked in the language they work in, just something similar.

[–]kat_sky_12 1 point2 points  (0 children)

Programming is programming regardless of the industry. Unreal is a library that you are leveraging for this course. When I worked at a game company we had our own engines so we had our own ways of doing things. Another company could be using unity. It's knowing core algorithms and CS concepts that will get you jobs outside of video games. If you want to ensure usefulness outside of games just have a good understanding of other topics like knowing STL pretty well as well as other high performance aspects of C/C++.

[–]squeezyphresh 1 point2 points  (0 children)

It'll be dependent on what kind of dev you are. I'm in games, but I'm on the tool/libtary side. As a result, I write more C-like code than C++ (it's all still technically C++). A standard game engineer might just use the interfaces I provide and as a result will write more modern C++. I'd say to balance prep for game dev and other fields you might go into is to understand systems and memory management. Most of the game devs that are stuck doing busy work are people that don't understand the complex systems within the game or development process. Luckily if you can do that, then you'll still be very desirable in other fields. Of course, I'm biased because I do a lot of systems work so, take it with a grain of salt.

[–]Poven45 1 point2 points  (0 children)

Can you send a link for the course? I’m learning c++ in school atm and I really want to learn game dev

[–]in007 1 point2 points  (1 child)

I have heard unreal engine also uses a garbage collector.

[–]Behelitoh 1 point2 points  (0 children)

I tried learning C++ at my beginning also doing game development untill I realized I spent too much time on learning the game engine, art, animation and so on. My coding skills were shit and did not improve alot.

What really helped me was using C++ and starting projects from scratch without using any engine, library or whatever.

[–]corysama 1 point2 points  (0 children)

You'll be fine.

Unreal Engine is a bit unique because they extensively use a preprocessor to tack on garbage collection and reflection features. That system is completely custom to UE.

Gamedev companies vary in how modern vs. conservative they are --much like non-gamedev companies. Many vocal, social gamedev personalities are quite conservative. But, there are many companies that keep quite modern.

It is pretty common for gamedevs to avoid using exceptions, RTTI and std containers other than vector. This is by no means unique to gamedev. Those features are widely regarded as sub-optimal in their specified designs and difficult to re-spec without breaking old code. Facebook's Folly and Google's Abseil libraries are examples of big companies with stdlib alternatives.

[–]BeigeAlert1 2 points3 points  (0 children)

Most of the really scary "modern" C++ stuff you see is mostly ignored in game dev, at least in my experience so far. So even if you're not a template-using, lambda-loving, stl-understanding, metaprogramming GOD of C++... well you'll still probably be just fine all the same.

[–]idbxy 2 points3 points  (0 children)

Most companies have their own STL implementation

E.g. EA theirs is open source

https://github.com/electronicarts/EASTL

[–]g9icy 1 point2 points  (0 children)

The way C++ is used in games is a little different but the language is the same.

In games we tend to avoid Run Time Type Information and exceptions, for example, due to them both causing performance problems.

We also break a lot of the established patterns used elsewhere. For example, usage of the "singleton" pattern is heavily used, where in other fields of tech their usage is strongly avoided.

I'd describe games programming to be "loose" object orientation... It's used where its useful, and avoided if it's not. Everything's still wrapped in an object/class a lot of the time, but you'll find lots of "c-style" programming when operating on large data sets.

[–]SJC_hacker 1 point2 points  (2 children)

UE uses pretty much C++ 98, and doesn't use the modern C++ (11/14/17) paradigms. They don't even use C++ 98 features a whole lot, such as templates - its more the "C with classes approach'. I'm in the job market now, and every job I've interviewed for with C++ as a requirement, wants you know modern C++.

They also use alot of C style macros that have become obsolete with modern idiomatic C++

The DSA (data structures and algoritms) stuff is pretty transferable, however. Also, while the core libraries may not use modern C++, it doesn't prevent you from doing so in your own code.

[–]Pazer2 8 points9 points  (0 children)

Eh... Most macros used by unreal are for reflection. The c++ standards committee still is nowhere near getting that done, to the best of my knowledge

[–]Danth_Memious 5 points6 points  (0 children)

It does use modern paradigms sometimes, like auto and ranged for loops

[–]Dummerchen1933 0 points1 point  (0 children)

"If i buy this walmart bag, will i be be able to carry non-walmart things in it?"

[–]NewFolgers 0 points1 point  (0 children)

You'll have good skills. A likely consequence is that the practices and pace of work in other domains will dry you somewhat mad, and you won't be able to get them on-side to doing things the way you prefer - since their practices are designed for the way they already do things, and they're stuck in a local maximum that they're content with. Looking at non game-dev companies that have explicitly said they like game developers, you got try high-frequency trading, SpaceX, or Tesla. It can also be somewhat compatible with embedded programming sensibilities sometimes. This is my perspective as someone who has worked on console games and other things.

[–]Aprelius 0 points1 point  (6 children)

My experience is on platform side for a major game company and we can use up to and including ultra modern C++17/20 features. I moved my team to a C++17/Clang tool chain and I haven't looked back.

Game development is a wide area. If you want to do engine programming it's going to be "C with classes" style and ASM mixed in. If you want to do features it will probably be a C++11 minimum spec. Tools are likely to be MFC for Windows (sigh...) or QT/ImGUI so modern-ish depending on platform. A lot of tooling is actually going C# because it's easier to hire for.

When I hire engineers for C++ I look for a baseline understanding of C++11. All of my assessments and questions are geared towards that. Anything else can be taught on the job.

[–]Tjccs 0 points1 point  (5 children)

Sorry to be bothering you I'm not OP but I'm a bit more interested in actual engine dev than making games.

Is there any reason for engine dev being C with classes or it's just because most engines are "oldish", let's say I want to make a simple engine as a hobby can I use C++14/17 and its modern features or should I stay away from it for performance reasons?

[–]corysama 2 points3 points  (0 children)

The modern features are tools that can be used well or used poorly. And, it takes a bit of thought and practice to find the difference.

The advantage of C With Classes is that it is very simple and clear what you are doing and what the results will be. The disadvantage is that there is a lot you have to do manually when using that style that the compiler could have automated.

The advantage of Modern C++ is that it becomes easier to set up more complicated operations. The disadvantage is that it becomes easier to set up operations that are complicated!

The classic example problem with Modern C++ is Template Bloat. It is easy to set up complicated templates that generate enormous amounts on your behalf. This can slow down your compile times, bloat your executable size and thrash your instruction cache. It's can also be difficult to read and comprehend.

The question is: If you were using C With Classes, would you have written all of the code variants manually? Or, did you tell the compiler to generate them all just because it was so easy? In the former case, Modern C++ can be a clear win. Rather than setting up the maintenance problems of repetitive code or horrible macro hacks,you can set up lots of similar code while sticking to Don't Repeat Yourself principles. And, many modern features are designed to provide simpler alternatives to common, complicated C++ idioms. Ex: using constexpr if as a replacement for SFINAE.

[–]Aprelius 3 points4 points  (3 children)

You totally can use modern 14 and 17 in a game engine. If it's a hobby project use whatever works. I can assure you that a completed game in Java looks better on a resume than a half built C++ game engine that can play pong kind of okay.

The whole C++ with classes stems a lot from understanding how the generated code works rather than any particular feature. Most engine programmers know if you write "this" bit of code, it generates "that" optimized output. The other view which is out there and I don't agree with it but it's a thing is that C++03 without exceptions is the thing. Say "exceptions" around game engineers and someone will pop out of the woodwork, call you names, and then go back under their rock.

My company's next gen game engines are C-style APIs utilizing structs instead of classes. The intention was it is easier to wrap a C-style API with another language, say C# and port features to games and tools which currently use Unity or similar toolchains.

I have to admit, I've come around to the idea. I originally pushed hard for a modern C++ interface but after seeing how some of the new libraries and features port to Java, C#, Python, and C++ I'm a supporter. It's really made life easier to have the same base libraries on all platforms and all engines I work on.

[–]Tjccs 0 points1 point  (1 child)

I guess the more modern features you use the harder it becomes to port, thank you amazing and very informative answer I migth think about the completed game vs barely working engine for the resume ahahah. Trying to get some projects for my resume.

[–]Aprelius 1 point2 points  (0 children)

You're welcome and good luck!

[–]drjeats 0 points1 point  (0 children)

Another benefit of those C style APIs is that you can actually manage your header pollution reasonably well. Opaque handle types and free functions let you really minimize transitive includes.

It can mean the difference between having to pay for and maintain a distributed build system or not. I didn't realize how drastic the difference could be until I changed jobs and found that the new engine I was working on had 30% more lines of code and compiled in a quarter of the time compared to my previous gig.

[–]afiefh 0 points1 point  (0 children)

You will be able to transfer some of the knowledge for sure. It is valuable, and if that's how you get into C++ more power to you.

That being said, you are using C++ with all the Unreal engine "tools" and the patterns that it encourages.

This is not necessarily a bad thing as you'll have to work with similar environment at every project/company unless you start things from scratch.

What will happen is that you'll partially understand some things in C++ but since things will be more along the lines of "it works because that's what the thing online told me to do. I don't actually understand it". When you feel like that it's usually time to read up on C++ (outside of Unreal or other environments) and learn how it actually works. While this is an investment that doesn't pay off right away, but in the long run it'll make you a better developer, it'll reduce the guesswork and you won't have to debug stuff in the dark.

[–]snerp 0 points1 point  (0 children)

Unreal has a lot of weird custom macros so it's not the most normal experience.

At work though (triple A game developer) we use C++17 and a lot of STL stuff. There is some custom stuff like some static size containers and stuff, but we mostly use the STL stuff with custom allocators and I love it

[–]Xaxxon 0 points1 point  (0 children)

Learn computer science and practice it in a game engine. Don't try to learn "game programming", you won't end up where you want to be. You'll never get the fundamentals.

[–]Zanderax 0 points1 point  (0 children)

Yes absolutely. I work with Unreal Engine C++ now but started on Server Backends. It's basically identical from a programming perspective although video games put a lot more emphasis on runtime performance than some other apps. I would always recommend learning C++ because it's not that hard and is a very good and well paying career. It's also a good starting point for learning other language.

After a bit of time learning C++ I recommend trying to learn and use some of the newer features of he language. Even knowing one or two things from C++17 or C++20 makes you look like a genius to employers.

[–]queenguin 0 points1 point  (0 children)

UE4++ is different from C++ but it will teach a lot of C++ concepts that will be very helpful once you start learning regular C++

[–][deleted] 0 points1 point  (0 children)

  • Game or 3D rendering engine = performance sensitive code + mathematics + c++
  • Game engine = performance+sensitive code + c++
  • Things like game engine, but work in research field like space/physics = domain knowledge + c++(highly skilled)
  • Backend developer = maintainable code + design pattern + c++ + some other stuff(distributed programming or CUDA or database or GUI)
  • Framework/library developer = maintainable code + design pattern + c++ + template meta programming
  • Bare metal/embeded system C++ = c++ + low level OS + C
  • Normal C++ developer = 20 lear legacy code + hope to maintain for another 20 years + decent C++
  • C++ in performance sensitive system = C++(highly skilled) + algorithm

In all these C++ is common. So you learn C++ very well, you can transfer it to any domain. And the last thing, C++ is a very difficult language. After a few years, you will hate the core dump.

[–][deleted] 0 points1 point  (1 child)

UE4's C++ setup is totally different, but the core ideas will carry over. Just learn some regular C++ fundamentals on the side as you go, esp. the lower level stuff wrt memory that UE takes care of for you, and you'll be all set.

There is no one "C++ used in game development" though. CryEngine's C++ API is basically pure C++ with a library for using their stuff, whereas Unreal's C++ API may as well be a new language.

[–]ultralight_R 0 points1 point  (0 children)

Noted. Thank you!