Download

C++ 4.14 Transition Guide

Dear Community,

It is that joyous time again!

Please feel free to share all of your upgrade learnings and questions here!

:heart:

Rama

After upgrading my project builds but the plugin I’m working on is not enabled. Any ideas?

Update: no idea why it wasn’t showing or loading or rebuilding. Did a full rebuild and now I can see all the stuff I have to update.

StaticMesh members are now behind a getter/setter and their materials have become an array of FStaticMaterials, which contain a material interface and a slot name. Not a bad transition and a useful addition.

Only a warning about PhysicsHandleComponent that say to use GrabComponentAtLocation or GrabComponentAtLocationWithRotation instead of GrabComponent.

I can’t move from 4.13.2 to 4.14, have problem with “use of undefined type UWheeledVehicleMovementComponent”
(Sorry, I don’t know how to make show it with English description in Visual Studio)
543f8b10e8097b6b0b26970f68a92a34d2713ffb.jpeg

This is my OST_WheeledVehicle.cpp


#include "OST_Game.h"
#include "OST_Character.h"
#include "OST_WheeledVehicle.h"
 
 
AOST_WheeledVehicle::AOST_WheeledVehicle(const class FObjectInitializer& PCIP)
    : Super(PCIP)
{
    Name = "noname";
    About = "no about info";
    Usable = true;
    VehicleID = 0;
}
 
bool AOST_WheeledVehicle::CanUsing()
{
    return Usable;
}
 
FString AOST_WheeledVehicle::GetUsableName()
{
    return Name;
}
FString AOST_WheeledVehicle::GetUsableAbout()
{
    return About;
}
 
void AOST_WheeledVehicle::DoUse(AActor* OtherUser)
{
    OnCustomUse(OtherUser);
    OnUsed.Broadcast(OtherUser);
    if (Cast<ACharacter>(OtherUser))
    {
        SetDriver(Cast<ACharacter>(OtherUser));
    }
}
 
bool AOST_WheeledVehicle::UseByThisKey(TSubclassOf<class AOST_Inventory> key)
{
    return true;
}
 
void AOST_WheeledVehicle::ReceiveActorBeginOverlap(class AActor * OtherActor)
{
    if (Cast<AOST_Character>(OtherActor)) Cast<AOST_Character>(OtherActor)->AddUsingActor(this);
}
 
void AOST_WheeledVehicle::ReceiveActorEndOverlap(class AActor * OtherActor)
{
    if (Cast<AOST_Character>(OtherActor)) Cast<AOST_Character>(OtherActor)->RemoveUsingActor(this);
}
 
FTransform AOST_WheeledVehicle::GetAboutTextPlace()
{
    if (TextAboutComp)
    {
        return TextAboutComp->GetComponentTransform();
    }
    return GetTransform();
}
 
USceneComponent* AOST_WheeledVehicle::GetSitPlaceComp()
{
    return SitPlaceComp;
}
 
void AOST_WheeledVehicle::SetDriver(ACharacter* NewDriver)
{
    AOST_Character* _driver = Cast<AOST_Character>(NewDriver);
    DriverCharacter = NewDriver;
    if (_driver && _driver->bCanUsingVehicle)
    {
        _driver->StartDrivingOfVehicle(this, bIsHideDriver);
        _driver->GetController()->Possess(this);
    }
}
 
void AOST_WheeledVehicle::ClearDriver()
{
    AOST_Character* _driver = Cast<AOST_Character>(DriverCharacter);
 
    if (_driver)
    {
        _driver->StopDrivingOfVehicle();
 
        if (OutPlace.Num() > 0)
        {
            //_driver->SetActorLocation(OutPlace[0]->GetComponentTransform().GetLocation());
        }
 
        GetController()->Possess(_driver);
    }
    DriverCharacter = NULL;
}
 
void AOST_WheeledVehicle::StartContactMaterialSurface(UVehicleWheel* wheel, UPhysicalMaterial* material)
{
    OnStartContactMaterialSurface(wheel, material);
}
 
void AOST_WheeledVehicle::StopContactMaterialSurface(UVehicleWheel* wheel)
{
    OnStopContactMaterialSurface(wheel);
}
 
void AOST_WheeledVehicle::Tick(float DeltaSeconds)
{
    bool _bIsContacting = false;
 
    Super::Tick(DeltaSeconds);
 
    if (!GetVehicleMovement() || GetVehicleMovement()->Wheels.Num() < 1)
    {
        return;
    }
 
    for (int32 i = 0; i < GetVehicleMovement()->Wheels.Num(); i++)
    {
        UPhysicalMaterial* ContactMat = GetVehicleMovement()->Wheels*->GetContactSurfaceMaterial();
        if (ContactMat)
        {
            _bIsContacting = true;
            StartContactMaterialSurface(GetVehicleMovement()->Wheels*, ContactMat);
        }
        else
        {
            StopContactMaterialSurface(GetVehicleMovement()->Wheels*);
        }
    }
 
    if (!_bIsContacting)
    {
        OnVehicleStopContactAnySurface();
    }
 
    int32 _gear = GetVehicleMovement()->GetTargetGear();
    if (LastGear != _gear)
    {
        OnChangeGear(_gear);
        LastGear = _gear;
    }  
}

Can someone help with this please? Very want to try new 4.14 features=)

Had to remove the GUBP from my server.target.cs file.

Removed:
public override List<UnrealTargetPlatform> GUBP_GetPlatforms_MonolithicOnly(UnrealTargetPlatform HostPlatform)
{
if (HostPlatform == UnrealTargetPlatform.Mac)
{
return new List<UnrealTargetPlatform>();
}
return new List<UnrealTargetPlatform> { HostPlatform, UnrealTargetPlatform.Win32, UnrealTargetPlatform.Linux };
}

public override List&lt;UnrealTargetConfiguration&gt; GUBP_GetConfigs_MonolithicOnly(UnrealTargetPlatform HostPlatform, UnrealTargetPlatform Platform)
{
    return new List&lt;UnrealTargetConfiguration&gt; { UnrealTargetConfiguration.Development };
}

I can do a build now of my code after I navigated to <sourcedir>\Engine\Source\Runtime\PakFile\Private\IPlatformFilePak.cpp(23):#define EXCLUDE_NONPAK_UE_EXTENSIONS USE_NEW_ASYNC_IO // Use .Build.cs file to disable this if the game relies on accessing loose files

and I right clicked on my project and selected build.

Now to test to see if it actually build the dedicated server correctly.

Update #1: Dedicates server seems to be running. Tried to run the newly rebuild client and I get “Plugin ‘GearVR’ failed to load because module ‘GearVR’ could not be found”. Sigh. Never wanted it. Now to learn how to say I don’t want it. I just learned how to build a dedicated server a couple of days ago in 4.13.2. Weeeee!

Update #2: Found it under Main Menu, Edit->Plugins, then Virtual Reality. Disabled all of them since this project will not be using VR.

Update #3 - Final: Dedicated server built, client built and able to connect and see the other client. The GameMode and GameState created from 4.13.2 working without problems.

This was good to do again to tweak my notes and cleanup some of the mess from learning this earlier in the week.

I’m getting errors on all of my GetVehicleMovementComponent() calls in my code, everything worked fine before the update, any ideas?

**fixed it! Turns out I needed to explicitly include “#include “Vehicles/WheeledVehicleMovementComponent4W.h”” to resolve the errors. Strange because I had “GameFramework/WheeledVehicle.h” already included which had worked in previous version.

Thank you for posting this :slight_smile:

In the same boat trying your fix as well. :slight_smile:

If you are switching to AGameModeBase or AGameStateBase for your C++ to inherit from do both. I could not get it to work with just one. I then had to go into my BP’s that referenced any object that had these as it parent, delete and re-add them. I also had to re-specify the game state value in my game mode bp as it had been set to “none” by the editor.

I have deep scars from the editor and C++ not being in sync already. Rebuilding visual studio files, rebooting the Editor, never believing the editor reflects any changes in by C++ saves long term headaches.

Thank you. After #include "Vehicles/WheeledVehicleMovementComponent4W.h I have only 2 errors:

Error C2227 left of “->GetContactSurfaceMaterial” must point to class/struct/union/generic type OST_WheeledVehicle.cpp Line:123
Error C2027 use of undefined type “UVehicleWheel” OST_WheeledVehicle.cpp Line:123
Can someone help with this please?
My OST_WheeledVehicle.cpp

@Lumina3D They probably cleaned up some of the includes while refactoring the vehicle movement. The compiler is complaining because it doesn’t know what ‘UVehicleWheel’ is. Make sure you include the header for UVehicleWheel in your OST_WheeledVehicle .cpp file.

I’m not very good with programming, can someone show me please, how to include the header for UVehicleWheel in my OST_WheeledVehicle.cpp ?

Add this to your header file #include “Vehicles/VehicleWheel.h”

Thank you so much, it’s work fine now=)

Just completed porting over for a custom IK node. If you have your own AnimGraphNode, the selection/widget/editing has moved from being part of the AnimGraphNode to being in a separate class derived from FAnimNodeEditMode.

Mostly it is a case of adding a new class derived from FAnimNodeEditMode - most of the functionality that is depreciated in 4.14 on the AnimGraphNode moves across.
Your FAnimNodeEditMode derived class has to be registered - the built in ones are registered in AnimGraphModule.cpp

I found TwoBoneIkEditMode.cpp/h gave the best example in my case for how things are now - I’d used it as a reference when I first wrote the code.

-Brian.

Thank you for sharing your learning process in this thread @acxsasx!

And thank you everyone for sharing your solutions / questions!

This is great info, thanks for sharing @TurtleSimos / Brian!

:heart:

Rama

Tbh these threads should get a sticky each update :slight_smile:

I’d like to see someone get dedicated servers advertise on steam master server in 4.14!

Here’s one:

Games now default to ‘Windowed’ mode when starting up. This is due to a change in GameUserSettings.cpp, ‘GetDefaultWindowMode’



EWindowMode::Type UGameUserSettings::GetDefaultWindowMode()
{
    return EWindowMode::Windowed;
}


In order to fix this properly (since scalability settings have a priority system when being set, and setting from command line / console will break any options menus if you have them), create your own GameUserSettings class. GetDefaultWindowMode isn’t virtual (putting in a request to make it so), so you’ll want to create your own and override SetToDefaults() to call your own function.



void UGameUserSettings::SetToDefaults();
{
    // DON'T call Super, copy-paste code!
    DefaultWindowMode = MyGame_GetDefaultWindowMode();
}
    
EWindowMode::Type UGameUserSettings::MyGame_GetDefaultWindowMode()
{
    return EWindowMode::WindowedFullscreen;
}


Weird problem after upgrading from 4.13.2 to 4.14.0
It’s a C++ project based off of 3d person template.
When I play in the editor with no dedicated server selected, everything is golden.
When I try to play with the dedicated server enabled, I can’t seem to move. I can only look around, but I can’t control my character.
It looks like all the particle systems are also not showing.

I tried printing a debug message from both the character’s and controller’s beginplay functions, and it only printed it once (usually, it’d print it for every instance, so in my case it should’ve been once for the server, and once for the client).
I can’t paste any code. I have absolutely NO clue what could even be causing it. It looks like there’s some weird replication problem.

If anybody knows which direction should I even look to try and solve it, let me know.

I downloaded github version of 4.14 to facilitate your request only to realise that GetDefaultWindowMode is static, so Epic wont be able to make it virtual without removing its static status which then breaks its current usage in all projects.



/**   @return The default window mode when no mode is set */
UFUNCTION(BlueprintCallable, Category=Settings)
static EWindowMode::Type GetDefaultWindowMode();


This great fellow named @TheJamsh posted what you can do instead:

I think you two would like each other!

:heart:

Rama