Where can I write server logic?

I want to create a Client/Server multiplayer. As I have understood, there is not clear separation, where is server code and where is client code.
I have understood, that client, for example, has not access to GameMode, so GameMode works on server only. But I want to create some own classes, where I’ll connect to database (mongodb) and which have some private data, and I do not want to see it compiled on client-side code.
How can I to do it?

#if UE_SERVER

#endif

The preprocessor can exclude code if wrapped with UE_SERVER

1 Like

WITH_SERVER_CODE also include regular game builds like the Listen-Server Standalone configuration. If the code is meant only to run on a dedicated Server I recommend you use UE_SERVER

yo quick answer:

#if WITH_SERVER_CODE
     Do Server Stuff here;
 #endif

Thank you!