Incorporating our own C++

Hi guys,

Currently been toiling with the best approaches to get our C++ game code built into the Unreal Engine. Up to this point we were using a DLL and calling C++ functions through a C# script in the Unity engine, but with the recent release of UE4 with its subscription packages (along with general improvements over Unity) we have begun looking at the possibility of linking our own C++ code to run through this engine instead. Now for Unity, we stripped down the current code base to get basic physics information for objects positions and such, camera positions and general game/player data from our global game class structures.

Now I’m curious as to how difficult it would be and what approaches would be best to use this existing framework we have in C++ but incorporate it into the Unreal engine so that we are able to perform most of the rendering and such but keep the physics calculations and basically, the current game as it stands at the moment, just as a quick test so we have our own framework still in place to build upon.

Thanks

Not entirely sure what you guys are implementing in your Unity DLL, but maybe you could try converting it to an Engine plugin? Unfortunately I haven’t been able to find any solid documentation on such, but you can look in the Engine/Plugins folder for examples. The BlankPlugin under the Developer subdirectory should make for a good starting point.

You should check out Bob Gneu’s tutorial!

Linking Static Libraries
https://wiki.unrealengine.com/Linking_Static_Libraries_Using_The_Build_System

I was wondering if there was a way to begin going about this without having to link things like a DLL. Really, I want my C++ code to run normally as it does, by working out player/game information and then using the Engine as a way to render the game. The idea being that I use our own calculations but use Unreal’s classes for things like actors and such to move the game objects based on what we calculate.

Or would this require use to go through our own code and begin to incorporate the likes of UCLASS(), UFUNCTION() ect to our classes and incorporate them that way?

You can incorporate your DLL in the standard way. We are now all working with C++ directly and although it may not seem like it the build system works pretty well. You can load up a DLL at any time using the standard methods. If you are working with MSVS you can actually just follow the MSDN. I will be putting together a tutorial along the lines of what I wrote for static libraries, but I have a game and V8 to bind, which are taking priority atm.

You do not have to go through your code to add in those macros, and I’m pretty sure you cant do that to expose your objects. You will need to write the header / interfaces etc to gain access to them in the same way you would need to without UE4 sitting behind you.

V8? You working on JavaScript bindings?

EDIT: Dumb question. Just saw the link in your sig. This is quite interesting.

Yes indeed. I am actually sorting out the details on what will eventually be called a Bundle, replacing the Plugin with something a bit more useful for us all. You will soon be able to create your own plugins and import whatever libraries you wish. Soon life will be easier for us all.