4.2 C++ Transition Guide

Yaaay! :slight_smile:

Rama

Dear Josh.Markiewicz ,

I guess we’re forcing play-in-editor to open a listen server… I don’t get why you won’t allow networking in PIE though.
I’m used to doing this in Unity and it’s a wonderful option for debugging any network games. Seeing everything as the network run is huge plus from my experience.

Anyway, this is what we did->

  • Open Unreal editor from the normal shortcut (no command line option.)

  • Open our gameFront map (which is like shooter’s entry level.) It’s for handling all the game session.

  • Click Play in the editor, with 1 client.

  • At GameFront’s BeginPlay() we check and switch to listen server for hosting/accepting any gameSession request with the code below


if (GetNetMode() == NM_Standalone)
	{
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("Switching to server mode."));
		mWorld->ServerTravel(TEXT("/Game/Maps/GameFront?listen"));
	}


  • After that we call [mSession->CreateSession(ControllerId, SessionName, *HostSettings)] as mention above and the editor crashes.
    (I didn’t pin point the exact crash point. It could have also crashed after the delegate is returned, and calling serverTravel() to another listen map too.)

Hope this help…

:rolleyes:

ps1. I still don’t understand how to open any listen server without re-opening it with ?listen though. My concern is that, we have no such option in the editor unless we open “2” clients with the play button. How the shooter’s entry level always open as a listen server without doing all this is still beyond me. Any pointer?

ps2. I don’t know if this is related to any of the above, but my 32bit shipping built still cannot travel along with any of the joined 64bit built. Any other guide would be appreciated.

Also:

FMath::Trunc is now FMath::TruncToInt

I think Rama just inherited Eric Blade’s role for UDK!
Time to start running a diff across versions!

Most of the related functions have “ToInt” appended to them:
Ceil -> CeilToInt
Floor -> FloorToInt
Round -> RoundToInt

etc.

Hee hee!

Great to hear from you Bob!

:slight_smile:

Rama

Hi. I just downloaded the Unreal Engine 4.2, and found that ISocket Subsystem is not working anymore. It was working in the previous version. HELP!!!

could you post this on answerhub? This is really important!

Though it is also quite possible an Epic Dev will answer you here :slight_smile:

Rama

Hi,

I was using an override of DisplayDebug on my character class. But in 4.2, I can compile anymore.
I saw that the signature has changed but FDebugDisplayInfo is not found :frowning:

Any tips?

I had to retreat to 4.1.1 because my Blueprints would crash when I attempted to open them as discussed here. Did any other programmers run into this? I suppose I could have looked into recreating my BPs in version 4.2. May try that later if no fixes from Epic surfaces anytime soon. For now, 4.1.1 works fine for me though

the signature changed from


virtual void DisplayDebug(class UCanvas* Canvas, const **FDebugDisplayInfo**& DebugDisplay, float& YL, float& YPos) OVERRIDE;

to


virtual void DisplayDebug(class UCanvas* Canvas, const **TArray<FName>**& DebugDisplay, float& YL, float& YPos) OVERRIDE;

Looks like they got rid of a struct they felt was extraneous

its actually easier to use now

just replace with new signature and make your own TArray<FName> to pass in!

Enjoy!

I dont know yet, I have a very large code base that I"ve been building since the beta that I am now having to transition from classes/private/public to the new format of only using private include paths and Public

sooooo

I’ve been transitioning for days now :slight_smile:

Gonna go handle a few more compile errors now…

hee hee!

Rama

PS: **the benefit of finally moving on from Classes is that my compiles times have sped up ENORMOUSLY
**

Rama

@Rama,

In fact, on character.h it’s not the same signature.
They moved from 4.1 to 4.2 to the “old” signature :frowning:

So any class inherited from Character will have a different signature. More, I don’t know how it compiles :frowning: in the engine source as it override a signature that do not exist anymore.

Could someone confirm my opinion so we can raise the case to Epic?

Thanks,

oh yea its now


virtual void DisplayDebug(class UCanvas* Canvas, const FDebugDisplayInfo& DebugDisplay, float& YL, float& YPos) OVERRIDE;

from the 4.1 version

I dont see the issue though

you just change your signature and you are set?

I searched the code base and there are plenty of references to FDebugDisplayInfo,

including AnimInstance.cpp

so what exactly is your issue at the moment?


**The Definition**

The struct is defined in **DisplayDebugHelpers.h**



```

// Tracks what debug information we have switched on
class FDebugDisplayInfo
{
private:

	TArray<FName> DisplayNames;

	TArray<FName> ToggledCategories;

public:

	FDebugDisplayInfo(const TArray<FName>& InDisplayNames, const TArray<FName>& InToggledCategories) : DisplayNames(InDisplayNames), ToggledCategories(InToggledCategories) {}

	bool IsDisplayOn(FName DisplayName) const { return DisplayNames.Contains(DisplayName); }
	bool IsCategoryToggledOn(FName Category, bool bDefaultsToOn) const { return ToggledCategories.Contains(Category) != bDefaultsToOn; }
};

```



WinGrep

I can highly recommend this for searching the code base outside of VS

Rama

I m not in front my pc but I can t compile as my class can t found FDebugDisplayInfo.
I check the character.h and I didn t found any extra includes so I don t know what the way to fix this.

Should I add a path in the build file or something else?

I m sure it is stupid but I have no idea yet :frowning:

Thanks,

@epic staff,
What is the purpose of this change? Why having 2 types of definition for this function. Is it a migration that is ongoing? If so what s the target?

Thanks


**Solution**

Add this to the top of your .**cpp** and you are going to be set!



```

#include "DisplayDebugHelpers.h"

```





**Yaaay in Advance!!**!

Rama

Thanks Rama.
This solved my compile issues.

Yaaay :smiley:

Thanks Rama.
This solved my compile issues.

With the Header management of UBT, I forgot the basic stuff like this :slight_smile:
But why do I have to add it specifically whereas class like Character, Actor … you don’t have to include it? It is because it’s part of the Core Header and they are added automatically?

Thanks,

Dear Elvice and KeeganGibson,

Yaaay!

Glad it is working for you both now!

Actually I found out how to add it by searching the code base, they add it to!

Rama

After your answer I look at the cpp file and I saw the include. I just look at the h file the first time.

So now it s close but if an epic guy can clarify the use of the new signature and when we need to add header most of us will learn and be more efficient.

To answer your two “ps” questions first…

LocalMapOptions is an ini setting and also an editor setting (under GameMapsSettings::DefaultMaps) that will let you append a ?listen and should start you off as a server from the beginning.

I’ve used 32 bit and 64 bit successfully, but independently. I wouldn’t expect there to be any reason for them not to interop, but I would suggest you start a new AnswerHub quest about it to make sure there isn’t a bug or some user error at play.

So, we don’t disable networking in PIE (play in editor), but we have to make a distinction between the various “online” features we provide. “Unreal Networking” is what gives you connectivity, netdrivers, replication, etc and is not disabled at all in PIE. The second bit is the “online subsystem” which handles bookkeeping other platform specific functionality (Steam, LIVE, PSN, etc). We have that disabled by default because as far as editor platforms go (Windows/Mac/etc) there is only one supported platform, Steam. Steam only allows for one client to be connected per computer and Steam client. I’ve tried sandboxing multiple Steam clients to no success and in fact dangerous inconsistency of their API. To let Steam work in PIE with say multiple clients running would basically allow the same player to play from multiple clients which breaks many assumptions about UniqueNetId and session management. LIVE/PSN are console only obviously, so it didn’t leave good reason to try to use the online subsystems in PIE.

OnlineSubsystemNULL is our attempt at allowing game teams to write consistent code against a no-op platform so they can continue to rely on delegates and the async nature of online without having to put various defines in and change behavior. NULL does provide basic LAN support as well.

That being said, I’m working on a currently experimental way for PIE to run with each client “logged in” to a online subsystem. But you are circumventing that right now by calling CreateSession on the “editor instance” of the online subsystem and not a logged in instance. For now, you should consider not calling those functions if GIsPlayInEditor. I can possibly show you how to turn on this mode, but I haven’t really tested it against the NULL interface yet.