Installation Instructions

Installation instructions are now being maintained on openworldserver.com

FAQ / Troubleshooting

I die instantly when I hit the play button in the Editor

This means that you are not able to get your character's HP from the OWS Character Persistence API, so it is set to zero. Check your Config/DefaultGame.ini and replace the OWSAPIKey (OWSAPICustomerKey="[Your APIKey]") with the one from your database (CustomerGUID). If that doesn't fix it, then open the Third Person Game Mode BP, goto Class Defaults and set Debug Character Name to the name of your character.

I get an "Invalid Class Name" error when trying to create a Character.

This means that it was unable to find the default values for a new Character from the Class table in the OWS Character Persistence API. In most cases this is because your API Key is wrong. Check your Config/DefaultGame.ini and replace the OWSAPIKey (OWSAPICustomerKey="[Your APIKey]") with the one from your database (CustomerGUID).

When I login I get a black screen and my character just keeps falling (huge negative Z for player location)

This happens when the MapName you are trying to connect to does not exist in the setup and so UE tries to load the Entry map instead. Make sure that the MapName of the player you are trying to login as exists as a ZoneName in the Maps table.

How can I set my start location when debugging my map in the UE Editor.

Open up the Game Mode and you will see a Debug Start Location and Debug Character Name. Keep in mind that the Character Name is not the Email you use to login (your username).

When I travel through a portal, I get kicked back to the login screen. In my client log I can see that it tried to client transfer to 127.0.0.1 instead of my correct server IP and I get this warning: "SetActiveLevelCollection attempted to use an out of date NetDriver: GameNetDriver"

Set EnableAutoLoopBack in the Customers table to false (0). EnableAutoLoopBack = 1 is causing it to use 127.0.0.1 instead of the proper IP address.

I get the error message "".

UE5 Change Log

  • 2022/07/17 - 20220717 Release - Updated to UE 5.0.3.
  • 2022/06/12 - 20220612 Release - Modifed the OWS Instance Launcher to stop using Process.WaitForIdle and instead wait until the server has made a call back to OWS to set the ZoneInstance Status to 2 (ready for players to connect). This may result in a slightly slower player connection time on spin up, but should be more reliable for making sure players don't try to connect too early and that the Status is always set to 2. The OWS Instance Launcher and OWSPlugin have been modified to work with this new method. ***** This update will break the MySQL and PostgreSQL versions of OWS 2. *****.
  • 2022/05/30 - 20220530 Release - Added support for Add, Update, and Remove Ability from Character.
  • 2022/05/16 - 20220516 Release - Fixed an issue where the character model was hidden in the Select Character screen. Other minor UI fixes. Added the new OWS Instance Launcher with LauncherGUID matching.
  • 2022/04/13 - 20220413 Release - Fixed an issue with using OWSCharacter.
  • 2022/04/02 - 20220402 Release - Fixed an issue with GetServerFromPort.
  • 2022/03/28 - 20220328 Release - Fixed a mixup between OWSAPIKey and OWSAPICustomerKey.
  • 2022/03/25 - 20220325 Release - Moved SaveAllPlayerLocations batch process to the OWS Game Mode. Fixed an issue with UpdateCharacterStats.
  • 2022/03/18 - 20220318 Release - Updated to UE5 Preview 2.
  • 2021/05/27 - 20210527 Release - Updated to UE5 Early Access.

UE4 Change Log

  • 2022/06/12 - 20220612 Release - Modifed the OWS Instance Launcher to stop using Process.WaitForIdle and instead wait until the server has made a call back to OWS to set the ZoneInstance Status to 2 (ready for players to connect). This may result in a slightly slower player connection time on spin up, but should be more reliable for making sure players don't try to connect too early and that the Status is always set to 2. The OWS Instance Launcher and OWSPlugin have been modified to work with this new method. ***** This update will break the MySQL and PostgreSQL versions of OWS 2. *****.
  • 2022/05/30 - 20220530 Release - Added support for Add, Update, and Remove Ability from Character.
  • 2022/05/16 - 20220516 Release - Fixed an issue where the character model was hidden in the Select Character screen. Other minor UI fixes. Added the new OWS Instance Launcher with LauncherGUID matching.
  • 2022/04/13 - 20220413 Release - Fixed an issue with using OWSCharacter.
  • 2022/04/02 - 20220402 Release - Fixed an issue with GetServerFromPort.
  • 2022/03/28 - 20220328 Release - Fixed a mixup between OWSAPIKey and OWSAPICustomerKey.
  • 2022/03/25 - 20220325 Release - Moved SaveAllPlayerLocations batch process to the OWS Game Mode. Fixed an issue with UpdateCharacterStats.
  • 2022/03/18 - 20220318 Release - Fixed an error in the OWS Instance Launcher caused by updating to .NET 5.
  • 2022/03/11 - 20220311 Release - Added AddZone API.
  • 2022/03/08 - 20220308 Release - Moved fully to OWS 2 API. Updated to 4.27.2.
  • 2021/07/13 - 20210713 Release - Removed OWSPawn. Added OWSFloorTileSpawner.
  • 2021/04/21 - 20210421 Release - Fixed an error where falling mobs would crash.
  • 2021/04/19 - 20210419 Release - Upgraded to 4.26.2. Added a climbing system to the OWSCharacterMovementComponent.
  • 2021/03/27 - 20210327 Release - Modified OWS Instance Launcher to verify appsettings.json configuration on startup.
  • 2021/03/12 - 20210312 Release - Fixed an issue with Character names with spaces in them.
  • 2021/03/10 - 20210310 Release - Fixed broken portals and teleport.
  • 2021/03/07 - 20210307 Release - Upgraded to 4.26.1. Replaced the RPG World Server with the OWS Instance Launcher (runs natively on Windows/Linux/Mac).
  • 2020/12/05 - 20201205 Release - Upgraded to 4.26.0. (A special thanks to Mat for the help!).
  • 2020/10/20 - 20201020 Release - Moved from V1 of the UE4 build system to V2. This fixes issues when adding the OWS Plugin to a new project.
  • 2020/07/30 - 20200730 Release - Updated to 4.25.3. Added the ability to play an Anim Montage on an alternate skeletal mesh component in a Gameplay Task.
  • 2020/06/03 - 20200603 Release - Updated to 4.25.1. Some minor animation BP changes.
  • 2020/05/04 - 20200504 Release - Fixed GetInventoryItemsComplete not being called when AutoLoadInventory is disabled error. Add support for Posess/Unpossess. I strongly recommend against using this, but I added support just so no one can say OWS doesn't support it.
  • 2020/04/19 - 20200419 Release - Added additional fields to NotifyCreateCharacter. If you are not using the base version of OWSLoginPlayerController you will need to fix the error on the NotifyCreateCharacter BP node.
  • 2020/04/12 - 20200412 Release - Updated to 4.24.3. Added Xsolla login integration. Added encryption for Zone Transfer parameters. UserSessionGUID added to OWSPlayerState.
  • 2020/04/04 - 20200404 Release - Added LastActivity and CreateDate to GetAllCharacters BP node. Added FirstName, LastName, and Email to GetUserSession BP node. Modified OWSCharacter functions to be usable from C++ (will eventually make all BP nodes usable from C++).
  • 2020/03/11 - 20200311 Release - Updated to 4.24.2. Modified RPG World Server to add a mode that doesn't need port forwarding. Contact me to have it enabled on your account. Cleaned up the Starter Project map and BP's.
  • 2020/01/12 - 20200112 Release - Updated to 4.24.1. Deployed OWS 2.0 phase 1. See upgrade note for modification required to DefaultGame.ini for existing projects.
  • 2019/12/10 - 20191210 Release - Updated to 4.24. See special note!
  • 2019/12/05 - 20191205 Release - Fixed an error in UpdateNumberOfPlayers.
  • 2019/12/04 - 20191204 Release - New RPG World Server with Server Health Monitoring.
  • 2019/10/27 - 20191027 Release - Updated to 4.23.1. Modified UpdateCharacterStats to use the gameplay ability attribute base.
  • 2019/10/6 - 20191006 Release - Re-enabled auto-load inventory after fixing some bugs.
  • 2019/9/8 - 20190908 Release - Added Change Weapon BP node. Fixed an auto-load inventory bug that crashed to desktop when your inventory was empty.
  • 2019/9/3 - 20190903 Release - Updated to 4.23. Added new event driven HUD resource bar updating.
  • 2019/7/2 - 20190702 Release - Draw window improvements.
  • 2019/6/30 - 20190630 Release - Inventory system improvements.
  • 2019/6/22 - 20190622 Release - Fixed a packaging error related to HeadMountedDisplayTypes.h.
  • 2019/6/20 - 20190620 Release - Updgraded to 4.22.3. Fixed an error where Gender didn't load in the Character Selection screen. Fixed an error where Mana and Energy went past their maximum values. Added numbers to the resource bars in the Player HUD. New multiplayer inventory system is a work in process.
  • 2019/6/7 - 20190607 Release - Added phsyical material and other hit result data to the Advanced Projectile collision. Inventory System WIP.
  • 2019/6/4 - 20190604 Release - Added new gameplay ability to the gameplay ability gallery showing User Confirmed abilities.
  • 2019/5/24 - 20190524 Release - Updgraded to 4.22.2. Modified the gameplay ability system to swtich from mutable float to FGameplayAttribute. Added new get, set, and init gameplay attribute functions in BP for all attributes (Ex: OWSGetHealth, OWSSetHealth, OWSInitHealth).
  • 2019/5/20 - 20190520 Release - Enabled "Event Driven Loading" in the Project Settings to fix a crash when trying to run a packaged client (Thanks for tracking this down John!). Added back missing UseWeapon1 binding.
  • 2019/5/1 - 20190501 Release - Fixed broken sprint in OWSCharacterMovementComponent.
  • 2019/4/27 - 20190427 Release - Upgraded to 4.22.1. Added Set Max Walk Speed to the OWS CMC. Started refactoring character initialization (Replace RPGInitializationComplete event with OWSSAttributeInitializationComplete).
  • 2019/4/24 - 20190424 Release - Added Advanced Projectile System.
  • 2019/4/7 - 20190407 Release - Added back missing AttackWithWeaponCollision ability for compatability with the Let's make an MMO in UE4 tutorial series.
  • 2019/4/5 - 20190405 Release - Fixed an error in the OnDeath event caused by upgrading to 4.22.
  • 2019/4/2 - 20190402 Release - Upgraded to 4.22.0. More Gameplay Ability Example reorganization.
  • 2019/3/31 - 20190331 Release - Redesigned Gameplay Ability Examples. Added StartSprinting and StopSprinting to OWSCharacterMovementComponent.
  • 2019/3/17 - 20190317 Release - Added HUD based floating combat text.
  • 2019/3/2 - 20190302 Release - Redesigned how dungeon instances are launched and how they are owned by player groups. Added OnTakeDamage and OnInflictDamage events that tie into the Gameplay Ability system.
  • 2019/2/24 - 20190224 Release - Added improved support for tieing dungeons to player groups (you can pick a group type when you launch the dungeon). Added per item instance custom data. Added Remove Character BP node. Upgraded to 4.21.2.
  • 2019/1/15 - 20190115 Release - Fixed a bad config file in the previous release.
  • 2019/1/13 - 20190113 Release - Added new AI Team Number system and basic Replication Graph. The replication graph is on by default. You can disable it in DefaultEngine.ini.
  • 2019/1/7 - 20190107 Release - Added new LoadGameplayAbilityClass BP node.
  • 2019/1/5 - 20190105 Release - Added new ClearAbility BP node. Fixed chat channels. Upgraded to 4.21.1.
  • 2018/11/20 - 20181120 Release - Fixes for the access levels in OWSGameMode.
  • 2018/11/14 - 20181114 Release - Fixed isses with Agility attribute and with Silver, Copper, FreeCurrency, and PremiumCurrency variables. Added a new OWS log system.
  • 2018/11/08 - 20181108 Release - Upgraded to 4.21.0.
  • 2018/10/28 - 20181028 Release - Added support for Team Number Filtering in Gameplay Abilities.
  • 2018/10/23 - 20181023 Release - Added new OWSAbilityActor.
  • 2018/10/20 - 20181020 Release - Added support for OnRPGInitializationComplete for Mobs.
  • 2018/10/07 - 20181007 Release - Added new GetCurrentWorldTime for Day/Night cycle synch across World Servers.
  • 2018/9/30 - 20180930 Release - Added new WhoKilledMe ref to the OnDeath event.
  • 2018/9/23 - 20180923 Release - Updated for 4.20.3. Add Inventory Name to Inventory Item Struct.
  • 2018/9/19 - 20180919 Release - Added ClassName to GetAllCharacters for use in the character selection screen.
  • 2018/9/13 - 20180913 Release - Fixed some errors related to the new loading screen system. Added a new OWSDontRepToOwnerActor.
  • 2018/9/05 - 20180905 Release - Fixed some minor errors in the previous release.
  • 2018/9/04 - 20180904 Release - Added ClassID to Character. Added a new system to persist abilities and ability bars.
  • 2018/8/08 - 20180808 Release - Gameplay ability bug fixes.
  • 2018/8/05 - 20180805 Release - Added line trace to Travel to Map BP to stop from falling through the landscape when it is steep. Added Get Address URL and Port BP node.
  • 2018/7/29 - 20180729 Release - Updated for 4.20.1. Added new Calculate Updated Damage overridable function to OWSCharacterWithAbilities. This allows you to modify the incoming damage from Gameplay Effects in BP's.
  • 2018/7/22 - 20180722 Release - Fixed some bugs in the previous release. This update contains breaking changes. All previous versions will fail until you update to this version or later!
  • 2018/7/18 - 20180718 Release - Updated for 4.20.0.
  • 2018/6/24 - 20180624 Release - Added support for unicode languages such as Chinese. Split world server IP into Internal IP and External IP for advanced deployment configurations.
  • 2018/5/28 - 20180528 Release - Fixed an error with the new loading dialog delegate.
  • 2018/5/23 - 20180523 Release - Added support for mobile/PC cross device gameplay. Tested with Android 8.1 and a Windows 10 PC.
  • 2018/5/18 - 20180518 Release - Added a sprint ability. Use Left Shift key to sprint.
  • 2018/5/17 - 20180517 Release - Added back the loading dialogs on map transfer using delegates bound at runtime. Add examples for teleport to dungeon (black button next to door frame) and teleport back ("T" key)
  • 2018/5/8 - 20180508 Release - Fixed some errors with the 20180506 Release. Split out RPGAPIPath to a config file.
  • 2018/5/6 - 20180506 Release - Updated to 4.19.2. Added a new gameplay ability to show how to do a line trace gun shot (FireLaser #9). Fixed an error where Thirst and Hunger were not loading correctly.
  • 2018/5/1 - 20180501 Release - Fixed an issue with OnDeath in the 20180429.
  • 2018/4/29 - 20180429 Release - Started moving login related content into the Content section of the plugin. Added death mechanics with ragdoll and respawn.
  • 2018/4/16 - 20180416 Release - Fixed an error where some fields were missing from OWSCharacter that were in OWSCharacterWithAbilities. Modified 2 BP's to work with those new fields.
  • 2018/4/10 - 20180410 Release - Upgraded to 4.19.1. Fixed some errors that stopped C++ code from working inside the OWS Starter Project.
  • 2018/4/7 - 20180407 Release - Upgraded to 4.19. Converted OWS to a plugin!
  • 2017/10/27 - Test Version 30 - Upgraded to 4.18. Added ChangeSpell and GrantAbility BP nodes for use with the Gameplay Abilities system.
  • 2017/8/22 - Test Version 29 - Added CharactersOnline array to the GameMode to keep track of all players that are currently online. You can set the GetCharactersOnlineIntervalInSeconds or set it to zero to disable this feature. The is also a new IsPlayerOnline BP node.
  • 2017/7/23 - Test Version 28 - Fixed a minor bug that always kept you on ThirdPersonExampleMap and added a Global Data store.
  • 2017/6/24 - Test Version 27 - Minor bug fixes. Fixed Launch Dungeon (a previous update broke it). Increased HTTP timeout.
  • 2017/6/9 - Test Version 26 - Updated to UE 4.16.1. Fixed issue where spaces were not allowed in character names. Added additional validation for character names. Increased HTTP timeout.
  • 2017/5/30 - Test Version 25 - Updated to UE 4.16. Added AddOrUpdateCosmeticCustomCharacterData BP Node and added an example showing how to use it during character creation to set the character color.
  • 2017/5/25 - Test Version 24 - *You must login to the game with a password now. The default for previous user accounts is 123456. Redesigned the login process to separate user accounts from characters. You can now create a user account (without any characters) and then add more characters when you login. I fixed a previous issue where you had to add @localhost to the end of a username to get it to reroute to 127.0.0.1 when the client and world server are running on the same PC. The system is now smart enough to reroute you automatically.
  • 2017/5/7 - Test Version 23 - Renamed RPG prefix to OWS prefix to create less naming collisions. Refactored the Character into OWSCharacter and OWSCharacterBase.
  • 2017/4/22 - Test Version 22 - Add UI Mode toggle (tab key) - Thanks Demarii! Camera zoom with mouse wheel with settings for CameraZoomRate and CameraZoomLagRate. Added multicast delegate for InventoryItemsLoaded. Loaded missing item resource paths in Character->GetInventoryItems.
  • 2017/4/17 - Test Version 21 - Moved inventory asset loading BP's to the GameInstance. Removed ItemMesh and MeshToUseForPickup. Loaded missing item resource paths in GameMode->GetAllInventoryItems.
  • 2017/4/12 - Test Version 20 - No longer using a UE4 instance for the login server. Add spherical portals for space to ground to space transfers. Added more inventory management BP nodes. Added more error handling to the login process and zone transfer process.
  • 2017/3/28 - Test Version 19 - Added an extra item field for TextureIcon. Fixed a memory leak while loading the item meshes.
  • 2017/3/26 - Test Version 18 - Added extra item fields for ItemDuration, CanBeDropped, and CanBeDestroyed.
  • 2017/3/26 - Test Version 17 - Added extra item fields for WeaponActorClass, StaticMesh, and Skeletal Mesh. Added Gameplay Ability with Damage Over Time and Ability Bar (Work in Process). Fixed Launch Management Console button.
  • 2017/3/23 - Test Version 16 - Added extra item fields. Added Gameplay Ability with Cast Bar.
  • 2017/3/21 - Test Version 15 - Upgraded to 4.15.1. Fixed some ability system errors. Added a Player HUD to show Health, Energy, and Mana.
  • 2017/3/19 - Test Version 14 - Added tons of new stats. Made the ability system character the default now that it is working well with the other systems.
  • 2017/3/14 - Test Version 13 - Added some targeting to the ability system.
  • 2017/3/7 - Test Version 12 - Load master item list in to the GameMode on startup. Early preview version of ability system.
  • 2017/2/26 - Test Version 11 - RPG World Server fixes, starter project clean up, and added Experience field to Character.
  • 2017/2/25 - Test Version 10 - Upgraded to 4.15. New RPG World Server with multi-threading and better erorr messages. Added an example of using the Add or Update Custom Character Data BP node.
  • 2017/2/19 - Test Version 9 - Changed UniqueItemID to UniqueItemGUID. This fixes a pickup item bug.
  • 2017/2/18 - Test Version 8 - Added pickup and drop to inventory. Pickup an item by running into the cube with "Greatsword" over it. Currently the drop action in the Starter Project destroys the item. Added Zones to allow you to split one large map into smaller playable sections. Zones can be tested by going through Map 2 to a new map I added with two Zones.

Since OWS is now a plugin, I will not be posting detailed code changes for each new version.

Changes in V30

If you have not made changes to the OWS codebase, then just replace the following files in the source folder:


    Source\OpenWorldStarter.Target.cs
    Source\OpenWorldStarterEditor.Target.cs
    Source\OpenWorldStarterServer.Target.cs
    Source\OpenWorldStarter\OWSThirdPersonCharacterWithAbilities.h
    Source\OpenWorldStarter\OWSThirdPersonCharacterWithAbilities.cpp

Changes in V29

If you have not made changes to the OWS codebase, then just replace the following files in the source folder:


    Source\OpenWorldStarter\OpenWorldStarter.Build.cs
    Source\OpenWorldStarter\OWSGameMode.h
    Source\OpenWorldStarter\OWSGameMode.cpp

If you have made changes to the OWS codebase, then you may need to manually integrate the changes below:

Change line 7 of OpenWorldStarter.Build.cs from:

public OpenWorldStarter(TargetInfo Target)

TO

public OpenWorldStarter(ReadOnlyTargetRules ROTargetRules) : base(ROTargetRules)

The previous version is deprecated due to recent UE4 engine changes. The old version continue to work, but throws a warning about it being removed at some point in the future.

Add the following right below "TArray<FInventoryItemStruct> AllInventoryItems;" around line number 101 in OWSGameMode.h:


        UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Character")
        TArray<FCharactersOnlineStruct> CharactersOnline;

        UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Character")
        float GetCharactersOnlineIntervalInSeconds = 10.f;

        FTimerHandle OnGetAllCharactersOnlineTimerHandle;
                

Add the following right above "protected:" around line number 162 in OWSGameMode.h:


        //Get all players online
        UFUNCTION(BlueprintCallable, Category = "Character")
        void GetAllCharactersOnline();
        void OnGetAllCharactersOnlineResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful);

        UFUNCTION(BlueprintImplementableEvent, Category = "Character")
        void ErrorGetAllCharactersOnline(const FString &ErrorMsg);

        //Is player online
        UFUNCTION(BlueprintCallable, Category = "Character")
        bool IsPlayerOnline(FString CharacterName);
                

Add the following to the bottom of OWSGameMode.cpp starting at line 453:


    void AOWSGameMode::GetAllCharactersOnline()
    {
        TSharedRef<IHttpRequest>
        Request = Http->CreateRequest();
        Request->OnProcessRequestComplete().BindUObject(this, &AOWSGameMode::OnGetAllCharactersOnlineResponseReceived);
        //This is the url on which to process the request
        FString url = FString(TEXT("http://rpgwebapi.sabredartstudios.com/RPGServer/GetAllCharactersOnline/"));
        FString PostParameters = FString(TEXT("CustomerGUID=")) + RPGAPICustomerKey;
        Request->SetURL(url);
        Request->SetVerb("POST");
        Request->SetHeader(TEXT("User-Agent"), "X-UnrealEngine-Agent");
        Request->SetHeader("Content-Type", TEXT("application/x-www-form-urlencoded"));
        Request->SetContentAsString(PostParameters);
        Request->ProcessRequest();
        }
        void AOWSGameMode::OnGetAllCharactersOnlineResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
        {
            if (bWasSuccessful)
            {
                TSharedPtr<FJsonObject>
                JsonObject;
                TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create(Response->GetContentAsString());
		        if (FJsonSerializer::Deserialize(Reader, JsonObject))
		        {
			        CharactersOnline.Empty(CharactersOnline.Num());
			        if (JsonObject->HasField("rows"))
			        {
				        TArray<TSharedPtr<FJsonValue>> Rows = JsonObject->GetArrayField("rows");
				        for (int RowNum = 0; RowNum != Rows.Num(); RowNum++) {
					        FCharactersOnlineStruct tempCharacterOnline;
					        TSharedPtr<FJsonObject> tempRow = Rows[RowNum]->AsObject();
					        tempCharacterOnline.CharacterID = tempRow->GetIntegerField("CharacterID");
					        tempCharacterOnline.CharName = tempRow->GetStringField("CharName");
					        tempCharacterOnline.CharacterLevel = tempRow->GetIntegerField("CharacterLevel");
					        tempCharacterOnline.Gender = tempRow->GetIntegerField("Gender");
					        tempCharacterOnline.Alignment = tempRow->GetIntegerField("Alignment");
					        tempCharacterOnline.Fame = tempRow->GetIntegerField("Fame");
					        tempCharacterOnline.TeamNumber = tempRow->GetIntegerField("TeamNumber");
					        CharactersOnline.Add(tempCharacterOnline);
				        }
			        }
			        //NotifyGetAllCharactersOnline(CharactersOnline);
			        UE_LOG(LogTemp, Error, TEXT("Total number of players online: %d"), CharactersOnline.Num());
		        }
		        else
		        {
			        UE_LOG(LogTemp, Error, TEXT("OnGetAllCharactersOnlineResponseReceived Server returned no data!"));
			        ErrorGetAllCharactersOnline(TEXT("OnGetAllCharactersOnlineResponseReceived Server returned no data!"));
		        }
	        }
	        else
	        {
		        UE_LOG(LogTemp, Error, TEXT("OnGetAllCharactersOnlineResponseReceived Error accessing server!"));
		        ErrorGetAllCharactersOnline(TEXT("OnGetAllCharactersOnlineResponseReceived Error accessing server!"));
	        }
        }
        bool AOWSGameMode::IsPlayerOnline(FString CharacterName)
        {
	        return CharactersOnline.ContainsByPredicate([&](FCharactersOnlineStruct Result) {return CharacterName == Result.CharName; });
        }

Changes in V28

If you have not made changes to the OWS codebase, then just replace the following files in the source folder:


    Source\OpenWorldStarter\OWSGameMode.h
    Source\OpenWorldStarter\OWSGameMode.cpp

If you have made changes to the OWS codebase, then you may need to manually integrate the changes below:

Change line 310 of OWSGameMode.cpp from:

+ FString(TEXT("&MapName=")) + "ThirdPersonExampleMap"

TO

+ FString(TEXT("&MapName="))

The previous version is an error that will always set the map to ThirdPersonExampleMap every time the player locations are saved.

Add the following code to OWSGameMode.h at Line 58:


//Get Global Data Item
UFUNCTION(BlueprintCallable, Category = "Global Data")
    void GetGlobalDataItem(FString GlobalDataKey);
void OnGetGlobalDataItemResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful);
UFUNCTION(BlueprintImplementableEvent, Category = "Global Data")
    void NotifyGetGlobalDataItem(const FString &GlobalDataKey);
UFUNCTION(BlueprintImplementableEvent, Category = "Global Data")
    void ErrorGetGlobalDataItem(const FString &ErrorMsg);
//Add or Update Global Data Item
    UFUNCTION(BlueprintCallable, Category = "Global Data")
        void AddOrUpdateGlobalDataItem(FString GlobalDataKey, FString GlobalDataValue);
    void OnAddOrUpdateGlobalDataItemResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful);
    UFUNCTION(BlueprintImplementableEvent, Category = "Global Data")
    void NotifyAddOrUpdateGlobalDataItem();
    UFUNCTION(BlueprintImplementableEvent, Category = "Global Data")
    void ErrorAddOrUpdateGlobalDataItem(const FString &ErrorMsg);
        

Add the following code to OWSGameMode.cpp at Line 235:


void AOWSGameMode::GetGlobalDataItem(FString GlobalDataKey)
{
    Http = &FHttpModule::Get();
    if (!RPGAPICustomerKey.IsEmpty())
    {
        TSharedRef<IHttpRequest> Request = Http->CreateRequest();
        Request->OnProcessRequestComplete().BindUObject(this, &AOWSGameMode::OnGetGlobalDataItemResponseReceived);
        //This is the url on which to process the request
        FString url = FString(TEXT("http://rpgwebapi.sabredartstudios.com/RPGServer/GetGlobalDataItem/")) + GlobalDataKey;
        FString PostParameters = FString(TEXT("CustomerGUID=")) + RPGAPICustomerKey;
        Request->SetURL(url);
        Request->SetVerb("POST");
        Request->SetHeader(TEXT("User-Agent"), "X-UnrealEngine-Agent");
        Request->SetHeader("Content-Type", TEXT("application/x-www-form-urlencoded"));
        Request->SetContentAsString(PostParameters);
        Request->ProcessRequest();
    }
}
void AOWSGameMode::OnGetGlobalDataItemResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
{
    if (bWasSuccessful)
    {
        TSharedPtr<FJsonObject> JsonObject;
        TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create(Response->GetContentAsString());

        if (FJsonSerializer::Deserialize(Reader, JsonObject))
        {
            FString GlobalDataValue = JsonObject->GetStringField("GlobalDataValue");;

            NotifyGetGlobalDataItem(GlobalDataValue);
        }
        else
        {
            UE_LOG(LogTemp, Error, TEXT("OnGetGlobalDataItemResponseReceived Server returned no data!"));
            ErrorGetGlobalDataItem(TEXT("OnGetGlobalDataItemResponseReceived Server returned no data!"));
        }
    }
    else
    {
        UE_LOG(LogTemp, Error, TEXT("OnGetGlobalDataItemResponseReceived Error accessing server!"));
        ErrorGetGlobalDataItem(TEXT("OnGetGlobalDataItemResponseReceived Error accessing server!"));
    }
}

void AOWSGameMode::AddOrUpdateGlobalDataItem(FString GlobalDataKey, FString GlobalDataValue)
{
    Http = &FHttpModule::Get();

    if (!RPGAPICustomerKey.IsEmpty())
    {
        TSharedRef<IHttpRequest> Request = Http->CreateRequest();
        Request->OnProcessRequestComplete().BindUObject(this, &AOWSGameMode::OnGetGlobalDataItemResponseReceived);
        //This is the url on which to process the request
        FString url = FString(TEXT("http://rpgwebapi.sabredartstudios.com/RPGServer/AddOrUpdateGlobalDataItem/")) + GlobalDataKey;

        FString PostParameters = FString(TEXT("GlobalDataValue=")) + GlobalDataValue
            + FString(TEXT("&CustomerGUID=")) + RPGAPICustomerKey;

        Request->SetURL(url);
        Request->SetVerb("POST");
        Request->SetHeader(TEXT("User-Agent"), "X-UnrealEngine-Agent");
        Request->SetHeader("Content-Type", TEXT("application/x-www-form-urlencoded"));
        Request->SetContentAsString(PostParameters);
        Request->ProcessRequest();
    }
}

void AOWSGameMode::OnAddOrUpdateGlobalDataItemResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
{
    if (bWasSuccessful)
    {
        TSharedPtr<FJsonObject> JsonObject;
        TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create(Response->GetContentAsString());

        NotifyAddOrUpdateGlobalDataItem();
    }
    else
    {
        UE_LOG(LogTemp, Error, TEXT("OnAddOrUpdateGlobalDataItemResponseReceived Error accessing server!"));
        ErrorAddOrUpdateGlobalDataItem(TEXT("OnAddOrUpdateGlobalDataItemResponseReceived Error accessing server!"));
    }
}