Useful Tip:
You can use the plugin from C++ code in your project.
You will need to buy and download the plugin for the demo to compile.
Get the pluginIf you have an engine version installed from the launcher, go to the next step.
If you have a custom copy: Just copy the plugin in your plugins folder (engine or project).
git clone https://github.com/juaxix/photon_api_ue4_sample.git
Get your app data from the Photon Cloud Dashboard. Then open the project in Unreal Editor 4
How to start using the example project as base [link]
photon_api_ue4_sample is used as the basic example of a multiplayer game. You can build your own version via Unreal Editor using the plugin from the store. This is an example of how to access the code of the plugin from a game project.
You can use the plugin from C++ code in your project.
using System;
using UnrealBuildTool;
public class YourProject : ModuleRules
{
public YourProject(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "PhotonCloudAPI" }); //be sure you use this lines
PrivateIncludePathModuleNames.AddRange(new string[] { "PhotonCloudAPI" });
PublicIncludePaths.AddRange(new string[] { "../Plugins/PhotonCloudAPI/Source/PhotonCloudAPI/Public" });
}
}
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "YourGameModeBase.generated.h"
/**
* Example of Game Mode with the ability of adding the current PhotonCloudAPI Actor in the seamlessTravelActor list to remain when the level changes.
*/
UCLASS()
class ROLLINGPHOTONCLOUD_API AYourGameModeBase : public AGameModeBase
{
GENERATED_BODY()
AYourGameModeBase(const FObjectInitializer & ObjectInitializer);
void GetSeamlessTravelActorList(bool bToTransition, TArray& ActorList) override;
};
#include "YourGameModeBase.h"
#include "PhotonCloudAPIBPLibrary.h"
#include "PhotonCloud.h"
AYourGameModeBase::AYourGameModeBase(const FObjectInitializer & ObjectInitializer) : Super(ObjectInitializer)
{
bUseSeamlessTravel = true;
}
//You need to add here the Photon Cloud Mediator Actor to avoid it to be destroyed on level change
void AYourGameModeBase::GetSeamlessTravelActorList(bool bToTransition, TArray& ActorList)
{
AActor* mediator = UPhotonCloudAPIBPLibrary::GetPhotonCloud();
if (IsValid(mediator)) ActorList.Emplace(mediator);
}
If you need something special for your project related to this plugin contact me :).
Please if you find any bug in the plugin, report it in the issues page, together we will make a better API!