Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Inviting / joining steam friends

Hello everyone,

I'm looking in to how to invite and join others through your steam friends list. I couldn't find any information on how to do this in Blueprints.

Hope someone can help me, Thank you.

Product Version: UE 4.8
more ▼

asked Jun 19 '15 at 09:22 AM in Blueprint Scripting

avatar image

247 27 28 39

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

That can't be done in Blueprints,

You can expose those from C++ though but that will require some work.

Check OnlineSessionInterface.h out, it has all the functions you need, the function to invite a friend is

 virtual bool SendSessionInviteToFriends(...);*

For answering to an invite, you'll need to check the OnSessionInviteAccepted Delegate. I have successfully set up and worked with those but it's not exactly well explained. Some info can be found on how to use them in ShooterGame example code.

You can access to the interface with the line

 IOnlineSubsystem* OnlineSubsystem = IOnlineSubsystem::Get();

From there, you should be able to access a wide variety of options. If you have an IDE correctly set up and if you are a decent programmer this should get you started.

Can't give you my code unfortunately :) Good luck !

more ▼

answered Jun 22 '15 at 03:52 PM

avatar image

79 2 3 6

avatar image altnabla Jun 24 '15 at 04:20 PM

Since people don't seem to like my post, i'll hint a bit more ...

The right way to set it up is to use the IOnlineSubsystem wich will give you a correct pointer to the currently used Interface.

hence for instance, to set up a Callback that will be called whenever you receive a Steam Invite and you're in-game

 IOnlineSubsystem* OnlineSub = IOnlineSubsystem::Get(); 
 // Retrieve our Interface
 if (OnlineSub) // if an Online Interface is valid
     IOnlineSessionPtr SessionInt = OnlineSub->GetSessionInterface();
     // Get the Session Interface Pointer
     FOnSessionInviteAcceptedDelegate OnSessionInviteAcceptedDelegate = FOnSessionInviteAcceptedDelegate::CreateUObject(this, &MyClass:MyCallbackFunction); 
     // Create a Delegate For Session Invite Acceptance. 
     //This will trigger our function Whenever we accept an Invite 
     SessionInt->AddOnSessionInviteAcceptedDelegate_Handle(0, OnSessionInviteAcceptedDelegate); 
     // Bind the Delegate

The Delegate Method Should have the following signature

 MyCallbackFunction(int32 LocalUserNum, bool bWasSuccessful, const FOnlineSessionSearchResult & SessionToJoin)

from FOnlineSessionSearchResult you can use GameSession to Join a Game

avatar image Serellyn Jun 25 '15 at 07:07 AM

Thank you all for your help. I'll have to dive into C++ and hope I can figure this out :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hi, from steamwork sdk isteamfriends.h i found this

// Requests rich presence for a specific user. virtual void RequestFriendRichPresence( CSteamID steamIDFriend ) = 0;

 // rich invite support
 // if the target accepts the invite, the pchConnectString gets added to the command-line for launching the game
 // if the game is already running, a GameRichPresenceJoinRequested_t callback is posted containing the connect string
 // invites can only be sent to friends
 virtual bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString ) = 0;

so i guess UE4 should use GameRichPresenceJoinRequested_t callback to work with friend invites

in spacewar example game there's

// callback for when the lobby game server has started STEAM_CALLBACK( CSpaceWarClient, OnLobbyGameCreated, LobbyGameCreated_t, m_LobbyGameCreated ); STEAM_CALLBACK( CSpaceWarClient, OnGameJoinRequested, GameRichPresenceJoinRequested_t, m_GameJoinRequested ); STEAM_CALLBACK( CSpaceWarClient, OnAvatarImageLoaded, AvatarImageLoaded_t, m_AvatarImageLoadedCreated );

in UE4 source code there's

void FOnlineAsyncTaskManagerSteam::OnInviteAccepted(GameRichPresenceJoinRequested_t* CallbackData) { FOnlineAsyncEventSteamInviteAccepted* NewEvent = new FOnlineAsyncEventSteamInviteAccepted(SteamSubsystem, FUniqueNetIdSteam(CallbackData->m_steamIDFriend), UTF8_TO_TCHAR(CallbackData->m_rgchConnect)); UE_LOG_ONLINE(Verbose, TEXT("%s"), *NewEvent->ToString()); AddToOutQueue(NewEvent); }

STEAM_CALLBACK(FOnlineAsyncTaskManagerSteam, OnInviteAccepted, GameRichPresenceJoinRequested_t, OnInviteAcceptedCallback);

but in UE4 editor i can't find OnInviteAccepted in blueprints (without contex sensetivity ofc), also i don't see any friend events when open blueprints functions in context menu without contex sensetivity, there's only few of them under "online":


also i searched in blueprints with words: invit, friend, task, rich - nothing interesting were found

also looked into

void FOnlineAsyncTaskManager::AddToOutQueue(FOnlineAsyncItem* CompletedItem) { FScopeLock Lock(&OutQueueLock); OutQueue.Add(CompletedItem); }

but it doesn't give me an idea how UE4 engine designed to tell blueprints something

this isn't anwer to your question, but hope may help you or other dig deeper

more ▼

answered Jun 19 '15 at 10:06 AM

avatar image

576 53 46 72

avatar image Serellyn Jun 19 '15 at 11:44 AM

Thank you for these insights, this might help me a bit. I still hope someone from the staff will be able to give a bit more information on the Blueprint functions for this.

avatar image happyhorror Jun 19 '15 at 12:09 PM

in case steam already linked into engine maybe it's possible to handle these functions from C++ custom classes and make your own interface to blueprints

i din't try this yet, but think there should be some C++ functions/methods to get reference on current exist FOnlineAsyncTaskManagerSteam class instance, maybe it's globally stored somewhere, guess Rama may know

avatar image altnabla Jun 24 '15 at 04:17 PM

This is probably overkill for what the user originally requested.

  virtual bool InviteUserToGame( CSteamID steamIDFriend, const char* pchConnectString ) = 0;

is basically the UE-Steam interface which you can access of course but has already been linked through the OnlineSessionInterface, it's easier to use OnlineSessionInterface because it will return the correct interface (if you're playing on PS4, you'll use PSN for instance).

I'm giving hints on how to set it up correctly in my post

avatar image happyhorror Jun 24 '15 at 05:03 PM

i'm not so expirienced in C++ and how UE4 built, seems you know it better ^^

avatar image Motanum Feb 18 '17 at 12:51 AM

Sorry to resurrect this answer back from the dead. But I noticed in Steamworks 138 in the SpaceWarsClient.h example that the STEAM_CALLBACKS() is changed to

       STEAM_CALLBACK( CSpaceWarClient, OnLobbyGameCreated, LobbyGameCreated_t );

cutting out the last member parameter m_LobbyGameCreated.

But I can't compile my code either wait. Without the member I get

error C4003: not enough actual parameters for macro 'STEAM_CALLBACK'

And I also get

error C2208: 'CCallback': no members defined using this type

But if I add the member to the STEAM_CALLBACK macro, then I get the error:

Error C2512: 'CCallback': no appropriate default constructor available

I am stucked either way. I am using Steamworks 132 in the Engine 4.14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question