Help on networking -> IOnlineSubsystem:;Get() always return null.

I’m trying to follow networking code from the shooter demo. However, when I call IOnlineSubsystem::Get() in my own project, it always returns nothing.
Do I have to initialize it first or do something before hand? I couldn’t find such code in the sample so I’m kinda stucked. (Not to mention that most networks API pages are blanks.)

Would really appreciate it if someone can give me some pointer…

Best,

Hi, I just recently subscribed so this might be completely wrong.
Could this be related to some ini setting? There are a number of things in the Shooter Game 4.1\Config\DefaultEngine.ini that seem to be related to the OnlineSubsystem.

[FONT=Comic Sans MS]Welcome to Unreal 4, UnrealEverything!!!

:heart:

Rama

Hey there KillerPenguin ^^

UnrealEverything is correct :slight_smile: You also have to enable OnlineSubsystem in your Game.Build.cs file like this:



      PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore", "HTTP", "OnlineSubsystem"}); <--- add "OnlineSubsystem" if not present :)

      PrivateDependencyModuleNames.AddRange(new string] {});

	// Uncomment if you are using Slate UI
	// PrivateDependencyModuleNames.Add("Slate");
		
	// Uncomment if you are using online features
	//PrivateDependencyModuleNames.Add("OnlineSubsystem"); <--- Uncomment this line


rescan your solution and you should be able to use it now :slight_smile: (The rescan is just in case Intellisense plays up, if you’re already able to access OnlineSubsystem then you may not have to follow this step :stuck_out_tongue: )

MrNexy

1 Like

Gosh I remember reading about it when I was adding slate.

Thx! ^^;

Hmm I added and rescan+rebuild the codes as follow:

I still get nothing from IOnlineSubsystem::Get() though.

Worse yet, when I called:

It totally crashes UT4. Is there anything else I need to do first here?

ps. What’s this Sockets modules for though? Shouldn’t that also handle connection via UDP port? (What’s the point of IOnlineSubsystem then if I’m not connecting to Facebook etc…?)

Hey Killer,

I realize this setup may be a bit confusing. The OnlineSubsystem module has some basic, common functionality that is shared between the concrete online subsystem implementations. These implementations are separate modules themselves, and must also be included in your dependencies. I recommend starting with OnlineSubsystemNull, as this will allow you to test multiplayer with multiple instances on one machine as well as over multiple machines on a LAN. Take a look at how ShooterGame includes OnlineSubsystemNull and OnlineSubsystemSteam.

Also, you may need to add


[OnlineSubsystem]
DefaultPlatformService=Null

in your DefaultEngine.ini config file (if you use something other than OnlineSubsystemNull though, change this line appropriately!).

The Sockets module does handle the low-level UDP (and TCP) connections. The online subsystems expose higher-level, usually platform-specific features and services, such as achievements, leaderboards, friends, etc.

Yes, I got it OnlineSubsystem working now. All that was missing was the proper DefaultEngine.ini config.

World be nice if you could get those network documents clear up though… Very hard to work with right now.

Hello,
I fully agree with KillerPenguin. OnlineSubsystem is really tricky to set up and there is no proper tutorial/documentation about it. would be nice if anyone from Unreal crew took their time and broke it down in “HowTo” document.

Does it work in 5.1 ?