Using existing code in UE4

To start off, let me give you some perspective on my situation, so you can better understand my rather insignificant and trivial struggles. If you would like to skip these next two paragraphs to get to the actual question I have, feel free.

My programming experience is limited to a few community college classes, two classes in java, one class in C++. Unfortunately for me, the C++ class was rather poorly instructed, and I didn’t learn anything that I couldn’t have figured out by myself, with my prior knowledge from learning java.

My instructor teaching java was literally the best teacher I have ever had, anywhere, for any subject. He started out by explaining a lot of very primitive and basic things about how computers actually worked, things like the differences between the stack and the heap, how errors get tossed around and what order they get tossed around, and why errors show up in certain places when the actual error was somewhere else. He explained what the compiler actually did (in a nutshell) and showed us how to use the compiler using the command line, where the compiler was actually located on our machines, and a bunch of other awesome things that I’ve never had any other resource teach me. At the same time he kept the interest of almost the entire class the whole way through the introductory class, and helped us develop small command-line programs, and introduced us to some existing code (i think it was the ACM framework) to show us how to use code written by someone else.

I’ve done some work on my own in programming as well, but nothing beyond some simple command-line games with ASCII text representations, like that one linux game with the guy running from the robots. I also am an enthusiastic 3d modeler (I’ve been doing it since I was 13 with good’ol Rhino) and have a small amount of experience with texturing, and a decent amount of experience using gimp (and photoshop when I was in school).

Anyway, I feel like I have a really solid grasp on the fundamentals of programming, and I decided that I want to actually start making the game that I want to make.

Now one thing that you should understand about my thinking when it comes to programming, which was mentioned a lot of times by my teacher, is to try not to “re-invent the wheel.” I am aware that there are PLENTY of very talented people working on building great game engines for people like me to use for my purposes, so I have 0 hesitation in deciding to use an already built game engine.

After a lot of comparisons in many different areas, I decided on using UE4 as my engine of choice, and was excited to get back into programming for a purpose other than demonstration of knowledge. After messing around in UE4 with the blueprint system, I fell in love with the engine, and I’ve been constantly making and refining plans for how my game logic and save system will work.

The largest influence to my game is going to be the procedurally generated nature of it. Because of this, I’ve done a lot of reasearch on different ways of doing procgen for games, and settled on using a noise function. In my implementation, I will be using the noise to generate values on a grid, which will then be used to place types of terrain, buildings, etc. I will be using the noise function in a lot of different ways, with a lot of different modifications on the parameters and the output to get the noise shaped how I want.

I settled on Kevin Perlin’s simplex noise, becuase I really like how easy and fast it is, and the ‘coherency’ of it. The fact that it is also a gradiented noise, and just in general how it works (feed it x and y values, in my case ‘coordinates,’ and get a number between -1 and 1). Also the fact that it is ‘tileable,’ or rather, you can keep generating noise for whatever values you want, makes it perfect for the open-world type procedural game that I intend to make.

To my excitement I was able to use the noise function (which was released to public domain, the C++ varient i’m using is under GPL v3) in a simple console application to apply values between 1 and 10 to an array and display it on the console, while randomizing the z value for different ‘slices’ of noise, demonstrating to myself that I knew how to make use of it’s funcionality.

Here is my dilemma:

I want to use the actual noise class (not the seperate one I wrote for the console) in my UE4 project and expose the noise function I want as a blueprint node, so I can feed values and get my float while blueprinting. I’ve done a lot of reading on how to do the ‘exposing’ part, but my largest problem, i think, is that the simplex noise class makes use of math.h. I’m not sure exactly where it uses this, but that brings me to my larger problem: I know very VERY little about how more complicated C++ programs are built.

Most of the programming I’ve done in the past was on a single file, because it was simple, and most of the time didn’t make use of any codebase other than standard libraries and such, where you just needed one line to include it.

What I need is some sort of resource that explains in detail, how these large programs are set up. I don’t need to know how UE4 does all of the things it does, but I do need to know how C++ works with all the header files, static libraries, source files, etc.

I feel like I can’t find enough resources online, (other than books) and it’s hard for me to google search things on these specific topics, because most of the keywords turn up all of these copy-pasted garbage tutorials on how to write “hello world”. I know how to write a header file for my ****** little console programs, and why/how the header files are used. What i don’t know is things like, do they have to be in the same folder? How do I make use of it in another program I’m building? How do I let my program know where to look for the header file? When would you use a static library and how? What kind of problems might I run into when building an application with these things?

I’m trying to find a good resource that teaches these types of things, because the only thing I’ve been able to do these past few days, is to do a very specific google search for every problem that I run into when trying to incorporate this noise function into my UE4 project.


How can I incorporate a function (which #includes math.h) into UE4 from an existing .cpp and .h file for use as a blueprint node? If there are multiple ways, what would be the way you would do it?

What is your reccomended resource for learning C++ things like static/dynamic libraries, different ways to make use of existing codebases, and just the general structure of a larger C++ program?

I know that if I learned more about these things, a lot of the problems that I run into when trying to do something like this, I could figure out for myself. It would just be really nice if there was a resource that teaches this sort of structure of a C++ program, so when i run into future problems i’ll at least have a vague/high level understanding of what I need to do.

To anybody that reads this whole thing, thank you very much for your time. I hope I didn’t annoy anybody.