Page 1 of 1

C++ Client API for Unreal Engine 4

Posted: 23 Jul 2014, 18:37
by rafaelbr
Hi to all,

I'm new here but I have used SFS2X with unity for a while. Now I'm trying to get C++ client working with UE4. This is the first time I get the c++ api and for now I'm trying to build exemples and trying to figure out dependencies in order to get them on UE4. My goal is to use it on PC and Android project, so, I'll need to figure out how it can be compiled with Android NDK. I don't know if I'll need to recompile UE4 source code but I willing to, if needed. If anyone are trying to get SFS2X working on UE4, I'll glad to know and also, I can ttry to help too.


Re: C++ Client API for Unreal Engine 4

Posted: 09 Aug 2014, 03:37
by gbarnes

I've successfully linked the API into Unreal today. I'm now starting to setup Blueprint connections and to implement a high level interface in oder to access the smartfox api. I created it as a plugin so it's easy to package and distribut it. Currently it only compiles in for Windows in 64 Bit.

Re: C++ Client API for Unreal Engine 4

Posted: 09 Aug 2014, 11:04
by Lapo
Thanks for your feedback. Would you be willing to explain the steps you have used? Is it complicated?

Re: C++ Client API for Unreal Engine 4

Posted: 10 Aug 2014, 01:20
by gbarnes

as soon as I verified that everything works out the way I planned I will post a description of how to compile and link the library with Unreal 4. I'll make the plugin available sometime in the future as soon as I've integrated basic functionality.

Re: C++ Client API for Unreal Engine 4

Posted: 10 Aug 2014, 23:57
by gbarnes
Sorry for the double post, but currently I've a problem that I can't solve without touching the source code of the API (I guess, I'm no expert in C++).

1>c:\projects\depot3\project\engine\engine\plugins\smartfoxclient\source\private\api\include\util\../SmartFox.h(766): error C2872: 'LogLevel': Mehrdeutiges Symbol
1> kann 'c:\projects\depot3\project\engine\engine\source\runtime\engine\public\Engine.h(115) sein: FLogCategoryLogLevel LogLevel'
1> oder "c:\projects\depot3\project\engine\engine\plugins\smartfoxclient\source\private\api\include\logging\LogLevel.h(10) : Sfs2X::Logging::LogLevel"
1>c:\projects\depot3\project\engine\engine\plugins\smartfoxclient\source\private\api\include\util\../SmartFox.h(766): error C2061: Syntaxfehler: Bezeichner 'LogLevel'

It basically tells me that the symbol is Ambiguous. Is there any solution without modifying the source code?

Re: C++ Client API for Unreal Engine 4

Posted: 12 Aug 2014, 14:55
by MBagnati
Seems that LogLevel symbol is ambiguous because it is defined twice: in SmartFox.h and in FLogCategoryLogLevel.

A way to solve the problem could be the usage of namespace.
The LogLevel defined by API is contained into Sfs2X::Logging namespace, on the other hand I suppose that LogLevel declared in FLogCategoryLogLevel has a
different namespace (it should have a different namespace).

Unfortunately API LogLevel is used in SmartFox.h file without the declaration of the namespace that owns it.

So, at the moment I think that there are two possibilities to solve the issue:
  • In your source files you must include FLogCategoryLogLevel LogLevel after the include of SmartFox.h
    In this way when the statement
    #include "SmartFox.h"
    is processed, the system knows only the API LogLevel because FLogCategoryLogLevel is not yet declared.
    In other places where you want to use the FLogCategoryLogLevel symbol, you must add it with its namespace

    ... but this is not a smart solution because is based on the file inclusion order ...
  • The next API release will solve this problem adding the namespace Sfs2X::Logging everywhere is used LogLevel in SmartFox.h file.
    In this way SmartFox.h does not have ambiguity to select the appropriate LogLevel...I think that this is a smart solution
    So, I suggest you to anticipate what there will be in the next version of the library:

    in SmartFox.h file
    void AddLogListener(LogLevel logLevel, boost::shared_ptr<EventListenerDelegate> eventListener);
    void AddLogListener(Sfs2X::Logging::LogLevel logLevel, boost::shared_ptr<EventListenerDelegate> eventListener);

    and in SmartFox.cpp file
    void SmartFox::AddLogListener(LogLevel logLevel, boost::shared_ptr<EventListenerDelegate> eventListener)
    void SmartFox::AddLogListener(Sfs2X::Logging::LogLevel logLevel, boost::shared_ptr<EventListenerDelegate> eventListener)

I hope that this solves the issue

Re: C++ Client API for Unreal Engine 4

Posted: 15 Aug 2014, 19:08
by gbarnes

thanks for the help. I choosed the second solution since that was what I had in mind but wanted to check first with you guys before I just change the api since this would mean that I couldn't update the api anymore. After some talks to some of the Epic Guys today at gamescom my plugin now works. I want to ask the Epic guys some more questions before I post a workflow here since I have some more changes todo.

I'll keep you updated! Sorry for the delay in my answer, but I had some busy days at gamescom.

Re: C++ Client API for Unreal Engine 4

Posted: 03 Sep 2014, 14:30
by gbarnes

I'm still working on the plugin and managed to port it over to the newest version of UE4. I still try to figure out the best way to implement it with the blueprint system and a new UE4 feature called UGameInstance. So still will take some weeks since I'm currently very busy with university and work.

Is it allowed to make double posts? If not I will edit my first post if that is possible.

Re: C++ Client API for Unreal Engine 4

Posted: 03 Sep 2014, 15:23
by Lapo
Thanks for the update.

Re: C++ Client API for Unreal Engine 4

Posted: 25 Jun 2015, 08:05
by Shadowfax
Any updates?

Re: C++ Client API for Unreal Engine 4

Posted: 25 Jun 2015, 08:56
by Lapo
We're going to publish an example of usage for UE4 in the next days.

Stay tuned.

Re: C++ Client API for Unreal Engine 4

Posted: 30 Jun 2015, 16:19
by Lapo
UPDATE: the Unreal example is out. Read all the details here: