RakNet for UE4

Hello unreal community:
I modified RakNet for UE4 plugin a few days ago.
Hope you find it useful. :smiley:

2016.11.2 update
I create new branch for UE4.13 that contains empty project.
https://github.com/yujen/RN4UE4/tree/UE4.13

Plugin source code (UE4.12)
https://github.com/yujen/RN4UE4/tree/UE4.12

  • Pull the source code into /[YOUR_PROJECT]/Plugins/
  • In [YOUR_PROJECT].Build.cs add ā€œRakNetā€ to PublicDependencyModuleNames
  • In [YOUR_PROJECT].Build.cs add ā€œRakNet/Publicā€ to PublicIncludePaths
  • Rebuild the project

Blueprint Sample (UE4.12), I only add Ping sample that copied from RakNet project currently.
https://github.com/yujen/RN4UE4_Sample

I only test this plugin on my PC and Mac, if anyone find errors,
please let me know or make Pull Request. :smiley:

Thank You, i will have a look at it, as i understand you only added the ping class in c++ to be exposed in blueprints, is that correct ?

Wish someone would just port this fully over as raknet has so many awesome features that extend UE4 network.

Thank you very much!, this plugin helped me a lot! I still remember the entire day I took to compile RakNet for UE4, thanks to you, just a Copy and Paste does the trick!

P.S.: I am having a problem in StringCompressor, I know you didnt code RakNet, however, this problem is related to UE4, probably a missing DLL.

  • This is just one of 70 errors(same error) in 2 .h files: DS_Map.h and DS_OrderedList.h - I never had this problem with normal compiled RakNet imported directly in Engine/Source/ThirdParty folder.

Alanzote:

Itā€™s seems UE4 will define RAKNET_API as __declspec(dllimport), but we canā€™t import defined functions,
DataStructures::Map and DataStructures::OrderedList define functions in their headers.

I have modified Export.h for workaround:
#define RAK_DLL_EXPORT RAKNET_API
to
#define RAK_DLL_EXPORT __declspec(dllexport)

Thanks for your pull request :smiley:

Oh wow I totally missed this.

Just curious what are your plans for this plugin?

Great work!

This is great! Was looking for a quick way to get RakNet into C++ in a UE4 project. Would be good to go through and suppress or fix all of the warnings, though - they really clog up the build log! Iā€™ll have a look at that when I get the chance.

if I correctly understood, if I activate this plug-in in any project, it will allow me to connect through Steam or other platform even if the client and the server are in different networks with NAT?
do i need some additional configuration?

Sorry for my late response.
If you use IPv6 configuration, NAT punchthrough problem is no longer exist.
http://www.jenkinssoftware.com/raknet/manual/startup.html

If you want to use steam as a lobby server, UE4 has Steam online subsystem which is ready to use.

Downloaded the master repo today and attempted to build it under UE4.17 and didnā€™t seem to have any luck. Are you planning on updating this Yujen?

Currently Iā€™m using the steps outlined at Is it possible to compile RakNet using UE4? - C++ - Epic Developer Community Forums and that seems to work, however Iā€™d like to have RakNet as part of my project code, not part of the engine install.

4.19 can not workingā€¦ā€¦

Iā€™ve got no problem for building from Master branch for UE 4.19.2 Release.

Just saying.

I am trying to compile the plugin with 4.19 and I get the following error :

InterlockedIncrement identifier not found.

This is in LocklessTypes.cpp.

I noticed that the Windows includes were commented out in WindowsIncludes.h and this was causing InterlockedIncrement to go undefined. When I removed the comments I got the above error eventhough it was now defined. However This seems to be a 64 bit version and Raknet expects it to be 32 bit. Any idea whats wrong here ?

Thanks
Sanjit