Starting a c++ project
in Native
Hi,
I am new to Photon and I am trying to setup my project to get started.
I have looked into the documentation, but I cannot find which libraries and files to include(I work on visual studio 2015+). Also the examples that come with the SDK seems that they have problems with compiling.
I also looked at the c++ setup documentation, but once again it is only for the basic libraries and oll other examples are written for load balancing library?
Thanks in advance for any help you provide.
I am new to Photon and I am trying to setup my project to get started.
I have looked into the documentation, but I cannot find which libraries and files to include(I work on visual studio 2015+). Also the examples that come with the SDK seems that they have problems with compiling.
I also looked at the c++ setup documentation, but once again it is only for the basic libraries and oll other examples are written for load balancing library?
Thanks in advance for any help you provide.
0
Best Answers
-
Hi @GabrielKotev.
I assume you are using the Client SDK for Windows. please correct me, if I am wrong.
I cannot find which libraries and files to include(I work on visual studio 2015+).
In that case you should use the Visual Studio 2015 builds of the libs, of course.
The Windows Client SDK currently supports VC 11 (the C++ compiler of VS2012), VC12 (the C++ compiler of VS2013) and VC14 (the C++ compiler of VS2015).
The naming scheme of the libs in the Windows Client SDK is as follow:
libname-cpp_compilerversion_configuration_platform_runtimevariant_architecture.
The libs are Common-cpp, Photon-cpp, LoadBalancing-cpp and Chat-cpp. Your app should always link at least against Common-cpp and Photon-cpp. Photon Cloud Realtime apps and app that connect to a self-hosted Photon Server instance which runs the LoadBalancing application, should additionally link against LoadBalancing-cpp. Photon Cloud Chat-apps should link against Chat-cpp (but they don't need to link against LoadBalancing-cpp). Apps that use Realtime and Chat, accordingly should link against all 4 lib.
All 4 libs come in various flavors. You only ever need to link against one flavor of a lib at once, but against which one you need to link depends on the configuration of you app.
The variants for the compiler version are nothing for the lowest supported version (currently VC11) and the compiler versions for the other supported versions (currently 'vc12' and 'vc14').
The available configurations are 'debug' and 'release' and should match the configuration of your application ('debug' builds of your app should link against 'debug' versions of the libs and 'release' builds of your app should link against 'release' builds).
The only value for the platform is 'windows' (the libs provided by other Photon C++ Client SDKs provide different values here).
The values for the runtime are 'md' (multi threaded DLL) and 'mt' (multi threaded) and need to match the value that your app uses (project properties -> Configuration properties -> C/C++ Code Generation -> Runtime Library).
The values for architecture are 'Win32' and 'x64' and need to match the solution platform in VS that your app compiles for (32bit builds of your app need to link against Win32 versions of the libs and 64bit builds need to link against x64 versions).
Example:
Common-cpp_vc14_release_windows_mt_x64
This is the Common-cpp Visual Studio 2015 release config 64 bit build that links against the static lib variant of the runtime.
Also the examples that come with the SDK seems that they have problems with compiling.
They all build just fine for me. What are the errors that you are getting?
Are you sure that you actually open the versions of the demo projects that are intended for your version of VS studios (meaning, the ones that include a 'vc14' in their names when you are using VS 2015)?
If you would for example open the Visual Studio 2012 version of a demo project in Visual Studio 2015, then Visual Studio would offer you to automatically update the project, but that auto-update would not update your linker settings and the project would still link against the VS 2012 variants of the Photon libs, which will result in linker errors (however not in compiler errors).5 -
Hi @GabrielKotev.
Do I need the load balancing to create the multi-player game or I can do everything directly with the common libraries ?
It depends.
The Photon core functionality is provided by the Common-cpp (everything not directly network related, like data containers, serialization, memory management, etc.) and the Photon-cpp (lower level networking) libraries. The server side equivalent to this would be a raw Photon Server instance without any application running.
On top of that raw instance one needs to run a server side so called application to actually add functionality beyond sending raw messages. Photon Cloud runs the LoadBalancing and the Chat application on it's servers and LoadBalancing-cpp and Chat-cpp add the equivalent Client side for the functionality that is added by those applications.
Therefor using LoadBalancing-cpp (for multiplayer and in-game communication) or Chat-cpp (for cross room communication) is mandatory with Photon Cloud.
With Photon Server one can implement ones one application and in case that this application is not written on top of what LoadBalancing-cpp already provides, but from scratch, one would not use LoadBalancing-cpp on the Client side, but write ones Client side networking code to directly use Photon-cpp for everything.
However writing ones own server application that does not base on LoadBalancing-cpp at all is a rather rare scenario, that might affect less than 1% of the Photon server users.
So usually when using Photon Server, you would use LoadBalancing-cpp, too.5
Answers
-
Hi @GabrielKotev.
I assume you are using the Client SDK for Windows. please correct me, if I am wrong.
I cannot find which libraries and files to include(I work on visual studio 2015+).
In that case you should use the Visual Studio 2015 builds of the libs, of course.
The Windows Client SDK currently supports VC 11 (the C++ compiler of VS2012), VC12 (the C++ compiler of VS2013) and VC14 (the C++ compiler of VS2015).
The naming scheme of the libs in the Windows Client SDK is as follow:
libname-cpp_compilerversion_configuration_platform_runtimevariant_architecture.
The libs are Common-cpp, Photon-cpp, LoadBalancing-cpp and Chat-cpp. Your app should always link at least against Common-cpp and Photon-cpp. Photon Cloud Realtime apps and app that connect to a self-hosted Photon Server instance which runs the LoadBalancing application, should additionally link against LoadBalancing-cpp. Photon Cloud Chat-apps should link against Chat-cpp (but they don't need to link against LoadBalancing-cpp). Apps that use Realtime and Chat, accordingly should link against all 4 lib.
All 4 libs come in various flavors. You only ever need to link against one flavor of a lib at once, but against which one you need to link depends on the configuration of you app.
The variants for the compiler version are nothing for the lowest supported version (currently VC11) and the compiler versions for the other supported versions (currently 'vc12' and 'vc14').
The available configurations are 'debug' and 'release' and should match the configuration of your application ('debug' builds of your app should link against 'debug' versions of the libs and 'release' builds of your app should link against 'release' builds).
The only value for the platform is 'windows' (the libs provided by other Photon C++ Client SDKs provide different values here).
The values for the runtime are 'md' (multi threaded DLL) and 'mt' (multi threaded) and need to match the value that your app uses (project properties -> Configuration properties -> C/C++ Code Generation -> Runtime Library).
The values for architecture are 'Win32' and 'x64' and need to match the solution platform in VS that your app compiles for (32bit builds of your app need to link against Win32 versions of the libs and 64bit builds need to link against x64 versions).
Example:
Common-cpp_vc14_release_windows_mt_x64
This is the Common-cpp Visual Studio 2015 release config 64 bit build that links against the static lib variant of the runtime.
Also the examples that come with the SDK seems that they have problems with compiling.
They all build just fine for me. What are the errors that you are getting?
Are you sure that you actually open the versions of the demo projects that are intended for your version of VS studios (meaning, the ones that include a 'vc14' in their names when you are using VS 2015)?
If you would for example open the Visual Studio 2012 version of a demo project in Visual Studio 2015, then Visual Studio would offer you to automatically update the project, but that auto-update would not update your linker settings and the project would still link against the VS 2012 variants of the Photon libs, which will result in linker errors (however not in compiler errors).5 -
Hi @Kaiserludi
Thanks a lot for the information, I will try everything you mentioned here!
There is only one miss understanding about load balancing and the common libraries. Do I need the load balancing to create the multi-player game or I can do everything directly with the common libraries ?
If there will be some other cases Issues I will write.
Thanks once again for your help!0 -
Hi @GabrielKotev.
Do I need the load balancing to create the multi-player game or I can do everything directly with the common libraries ?
It depends.
The Photon core functionality is provided by the Common-cpp (everything not directly network related, like data containers, serialization, memory management, etc.) and the Photon-cpp (lower level networking) libraries. The server side equivalent to this would be a raw Photon Server instance without any application running.
On top of that raw instance one needs to run a server side so called application to actually add functionality beyond sending raw messages. Photon Cloud runs the LoadBalancing and the Chat application on it's servers and LoadBalancing-cpp and Chat-cpp add the equivalent Client side for the functionality that is added by those applications.
Therefor using LoadBalancing-cpp (for multiplayer and in-game communication) or Chat-cpp (for cross room communication) is mandatory with Photon Cloud.
With Photon Server one can implement ones one application and in case that this application is not written on top of what LoadBalancing-cpp already provides, but from scratch, one would not use LoadBalancing-cpp on the Client side, but write ones Client side networking code to directly use Photon-cpp for everything.
However writing ones own server application that does not base on LoadBalancing-cpp at all is a rather rare scenario, that might affect less than 1% of the Photon server users.
So usually when using Photon Server, you would use LoadBalancing-cpp, too.5