Download

Good place to learn C++ programming in UE4?

I’m having a difficult time finding tutorials that team to program in UE4 in an intuitive away. Unreal’s own C++ tutorials (video) either have the person copying the code and not explaining it, or have code which does not work in the newest version of UE4. So those aren’t working out. Other than that, I can’t seem to find any tutorial which actually explains the code, most of them just copy and paste the code then assume you know what it means. I have knowledge in C++, so it’s not that I haven’t used it before. I have been through all the C++ tutorials and I think I know mostly what there is to know for programming in C++. But I still get where to start when programming in UE4. I need a set of tutorials which can start from the basics.

Are there any out there?

Quite literally: https://forums.unrealengine.com/showthread.php?299-Wiki-Code-Tutorials

Also it depends on what you mean by the basics. Rama, myself and a few others have contributed to the wiki ranging from beginner to intermediate type of tutorials. I’m almost positive that 90% of the tutorials that are up there still work. I think the ones that are still using the PCIP initialize call won’t work unless you replace it with the ObjectInitializer. method call. Other then that you might want to give the wiki another try. Trust me when I say it’s extremely valuable information!

:slight_smile:

Also, i’m not sure what you mean by the basics? AI? HUD Programming? Health and other variables? Network replication? Movement? It just depends on what you’re looking to do. Over the past year or so the AnswerHub has had almost every kind of question asked on it so it’s also a good idea to check that place out as well. I try to answer alot of folk’s questions there as soon as I can and if you need further help then just PM or continue to ask publicly since i’m sure someone will be able to help out. Never be afraid to ask; the folks in this community are really awesome people.

Good luck!

I have seen the Wiki and I am very thankful for your work. It would be nice if it could also be sorted in a way so that it goes from Beginner to Intermediate to Advance. It would be helpful for people like me starting from the very beginning with some C++ knowledge.

[QUOTE=Master Kyp;Quite literally: https://forums.unrealengine.com/showthread.php?299-Wiki-Code-Tutorials
Also, i’m not sure what you mean by the basics? AI? HUD Programming? Health and other variables? Network replication? Movement? It just depends on what you’re looking to do.
Good luck![/QUOTE]

I think what he means by “basics” is that a lot of C++ programmers started learning C++ like this:

Tutorial 1/Chapter 1 of a book: Explaining the “Hello World” Program and getting used to writing:

#include <iostream>

using namespace std;

int main()
{

//some code here

return 0;
}

Tutorial 2/Chaper 2: Talked about commenting or white spaces or what so ever.

And after that it kinda moved on to variables, if statements, loops, arrays, functions, operator overloading, pointers, refferences, structs, OOP, classes, inheritance, polymorphism, templating, containers… So you kinda had knowledge building upon knowledge. So you practically had a level of beginner - intermediate building up while you were learning c++. When it comes to ue4 c++ where do you start? Using the FPS-Shooter c++ tutorial? Memorize it? I still can’t pull that off by myself without looking into the wiki. And everytime I code something in ue4 I always have this feeling that I haven’t learned much because I have to reread so much in the docs and wiki.

Ah. I see now. I was curious why Simpler was going back to the absolute basics of C and C++ since I assumed from your first post that you already knew what was going on.

Well, maybe I can offer a few links for you that can help you out. Maybe they might work? I don’t know you tell me.

I hear this set of tutorials is rather popular: https://www.youtube.com/watch?v=tvC1WCdV1XU&list=PLAE85DE8440AA6B83

Rama also wrote a nice “pick-up” to C++ regarding UE4, it actually has some great information even if you are a veteran programmer: https://wiki.unrealengine.com/Entry_Level_Guide_to_UE4_C%2B%2B

Of course this website is basically every C++ programmers haven: C++ Language - C++ Tutorials

Anyways… my advice to you is this. Although all of these tutorials are going to instruct you a certain way I want you to try to look at these as guidelines and not absolutes. The idea behind programming is once you learn the languages syntax then you can experiment with how to achieve your goal.

For example: 2+2 = 4. Is this the only way to achieve the number four? Clearly not. Also never feel bad about going back to references in tutorials or the API. It’s something we all have to do. Memorizing everything would take forever and is to much information. Pick and choose what information you want when you need to use it. Eventually it’ll just become second nature.

Good luck!

@ Master Kyp

I think you misunderstood me. I didn’t want to say that he was asking for c++ tutorials. I think he was trying to ask for ue4 c++ tutorials in the form of how he learned c++ in general. Like this:

UE4 C++ Tutorial 1: Build Code with Visual Studio/xCode
UE4 C++ Tutorial 2: Write your first actor
UE4 C++ Tutorial 3: Give your actor some functionality
UE4 C++ Tutorial 4: Add character movement
UE4 C++ Tutorial 5: Learning some Macros (UFunction, UProperty, …)

And so on. Moving from easy to more complex UE4 c++ tutorials.

Simpler got it right, I already know the basics and intermediate C++. And actually, I have been through all the links you just linked me before asking here. Like I said in my original post, I know what there is to know about C++ in terms of software. I want to know C++ with respect to UnrealEngine. And I’m glad you linked me to those C++ video tutorials, I could use those as a example. You see how he starts from the basics and gets harder each time, it would be nice to have a set of tutorials much like those. Start from the basics and go to intermediate. Simpler also give an example of what I’m looking for and I think it’s spot on. This won’t only be useful to me, but a lot of other people.

@SentinelSigma

There actually is someone who started this kind of tutorial series. There’s one video on how to set up Visual Studio 2013 Community and install the Ue4 Plugin. Here’s the link to the thread:

But unfortunately due to a huge tragedy (You can read it in the thread) which impacted his life this project is on halt for the moment.

So you’ll have to use these references:

Epic said that they know they’re kinda lacking on C++ references/tutorials and that they’ll be uploading some more content for C++ learning. Watch 31:57-35:15:

https://www.youtube.com/watch?v=4qERa9-5w0Q

Thanks, I saw his the thread and I watched a bit of the video. Looks like it would have been a good set of tutorials, really unfortunate that a tragedy has affected his life. I was actually looking forward to the tutorials

@ SentinelSigma

I found a book called “Learning C++ by Creating Games with UE4”. I can’t tell you if it’s good or not for the UE4 framework part. I’m on page 290/524. It starts with the very basics of C++. Writing console apps and introducing you to C++ (variables, functions, flow control, OOP, …). And at about page 290 it moves on to UE4 c++. That’s where I’m now. I just skimmed through the generic C++ chapters and reviewed some stuff like dynamic allocated memory and I finally learned structs (I skipped them when I was learning C++). I probably won’t have time to go over the UE4 framework topics until Saturday and I don’t know how long it’ll take me to go through the remaining 200 pages because I won’t skim through them as fast as I went with the generic C++ parts. So if you want to place your bet on this book without me reviewing it go ahead here’s the link:

It’s also available on amazon.

Actually I dived further into the book and started the UE4 Framework chapters. I’m now on page 320 and I only noticed two issues:

  1. When you create your class the book uses the “GENERATED_UCLASS_BODY()” Macro in your .h files. The GENERATED_UCLASS_BODY() Macro is deprecated and has been replaced with “GENERATED_BODY()” (Whenever you create your classes through the UE4 Wizard the GENERATED_BODY() Macro gets added automatically, so it’s not a big deal).

  2. When you set up your LookUp function the book does not mention that you need to set “Use Pawn Control Rotation” to true in your Character Blueprint for your camera component. If you don’t set it to true then you’ll not be able to look up/down with your mouse.

Other than that it’s beginner friendly and a good introduction to the UE4 Framework so far.

Thanks for the book, it has been extremely useful thus far. It was pretty much what I was looking for.

Well, in the “Triggering an event when it is near an NPC” section in the book, everything becomes confusing. Book just tells you to type some code without any real explanation for the syntax or why we’re using such code.

This pretty much ends up happening in all UE4 tutorials, after a certain point, there is no explanation for the code and thus the reader gets lost.

What code got you confused? Maybe reading in the docs about some framework specific code will help you understand it better. I noticed one more change:

The constructor has changed from

Constructor::Constructor(const class FPostConstructInitializeProperties& PCIP) : Super(PCIP)

to

Constructor::Constructor(const class FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)

I was confused at first but I read up on the docs. I just didn’t understand where all the code was coming from, like the Prox_Implementation arguments, I didn’t get where it was coming from. I went to the docs and found the overlapevent reference for components and found that it was just a function you use (and name yourself). I also got didn’t understand the AddDynamic part but saw in the docs that it’s necessary to be used, which also helped.

Other then that, I’m still confused with this piece of code:


ProxSphere = ObjectInitializer.CreateDefaultSubobject<USphereComponent>(this, TEXT("Proximity Sphere"));
ProxSphere->AttachTo(RootComponent);
ProxSphere->SetSphereRadius(32.f);

I get that when we create a Blueprint version of the class, it inherits everything from the C++ version, so it automatically creates the RootComponent with the properties we set. But what if I wanted to create a component inside of a blueprint, and then reference it inside of C++? It would be easier to create a SphereComponent manually inside of the editor and set it’s properties, then just reference it inside of C++. This is assuming we are still using the same Blueprint Class which inherited from the C++ class.

I think the author just wanted to do everything within C++ as a good practice.

Yes but how would you go in reverse? What if I created a blueprint and wanted a C++ class to inherit from it, how would I achieve that?

I’ve never done this or tried doing. But I just googled an found this on answerhub:

https://answers.unrealengine.com/questions/83955/inherit-blueprint-character-in-c-class.html

If you read through it you’ll find someone saying:

“I dont know what you did, but you cant create C++ class based of blueprint class as its not exist during c++ compilation. So your C++ class needs to be base for blueprint class.”

The post is from August 14. I don’t know if this has changed an we’re now able to inherit from blueprint classes.

Thanks for the help.

THe rama website, which I found accidentally bing’ing, didn’t work right when I clicked on the middle one near bottom of page, anyone else having issues there ?

I’ll try the other links noted here for know, as I lost my other links, sometimes browsers really don’t keep their tabs when reopened :wink:

cheers
nl