SLikeSoft / SLikeNet

SLikeNetâ„¢ is an Open Source/Free Software cross-platform network engine written in C++ and specifially designed for games (and applications which have comparable requirements on a network engine like games) building upon the discontinued RakNet network engine which had more than 13 years of active development.
https://www.slikenet.com/
Other
389 stars 62 forks source link

UE4 compatibility #43

Open jvukovich opened 5 years ago

jvukovich commented 5 years ago

Hey man (Ascentroid here)!

My game uses UE4 with RakNet integrated. Almost done upgrading from the larku RakNet fork to SLikeNet. I ran into a snag.

UE4 uses the same SHA1 functions by Dominik Reichl: http://api.unrealengine.com/INT/API/Runtime/Core/Misc/SHA1_WORKSPACE_BLOCK/

SLikeNet: source/include/slikenet/DR_SHA1.h

When compiling, it throws an error saying SHA1_WORKSPACE_BLOCK is already defined.

I fixed it by commenting out the SLikeNet definition (the signatures are the same). It worked just fine.

I wanted to report it in case there is anything that could be done to resolve the conflict without me having to edit the source.

Thanks!

Luke1410 commented 5 years ago

Hi,

sorry for the late reply. We've been working heavily on a game release last friday which includes SLikeNet.

could you look up the corresponding UE4 header for me? The header is using a ifdef-include guard:

ifndef SHA1_H_A545E61D43E9404E8D736869AB3CBFE7

Is the UE4 version using a different one?

Regards, Stefan

jvukovich commented 5 years ago

No problem man! I can get by with commenting it out for now. :)

Here is the UE4 header: SecureHash.txt

Taken from UE4 4.19.2 -- Engine/Source/Runtime/Core/Public/Misc/SecureHash.h

Doesn't look like they have a def in place. I think they plopped it into their own stuff and stripped out those things.

Luke1410 commented 5 years ago

Thanks for the header. I see. It indeed looks like they stripped out part of the code they deemed necessary for UE4 without providing means to circumvent this for other libraries also using the original headers.

Given this is from the UE4, I think we'd deal with the situation on our end. I don't have much experience with UE4 yet myself. Do you know wether UE4 provides a macro/define to identify that UE4 is used? We'd then adjust our integration of the SHA-1 algorithm to work around the identifier issue.

jvukovich commented 5 years ago

Cool, thanks man!

I tried to find an overall UE4 define for the engine, but no luck.

The best I could find was in Engine/Source/Runtime/Engine/Public/EngineDefines.h EngineDefines.txt

Perhaps WORLD_MAX? Not very specific to UE4 terminology, though. :(

Luke1410 commented 5 years ago

nah, that doesn't sound like a reasonable one for the purpose --- guess I'll have to peek into the UE4 source to see if there's some more reasonable way for that --- I understand it's nothing too urgent for you? If it is, pls let me know --- I'd then commit a change which would require adding a specific define to prevent the identifier glitch with UE4

jvukovich commented 5 years ago

Nope, not urgent! I'm good with commenting/uncommenting as needed in order to compile for now.

Just thought I'd get it reported since we've been seeing a number of folks using UE4 in Discord, in addition to myself.

Thanks again man!

Rizzist commented 1 year ago

Hey if possible can u give help how u installed it to ue4? struggling to use this 3rd party software