Originally posted by Elrodus
View Post
Announcement
Collapse
No announcement yet.
MMO Starter Kit
Collapse
X
-
Originally posted by yskwork View PostUse Steam,how to set Dedicated Server
Comment
-
OK,no use OnlineSubsystemSteam,how to get SteamID and account name
CSteamID from Player State
#include "steam/steam_api.h"
#include "steam/isteamuser.h"
#include "steam/isteamutils.h"
if(PlayerState)
{
CSteamID TheSteamifiedPlayerID(*(uint64*)PlayerState->UniqueId->GetBytes());
}
How to add to the projectLast edited by yskwork; 02-28-2019, 07:15 AM.
Comment
-
Originally posted by yskwork View PostOK,no use OnlineSubsystemSteam,how to get SteamID and account name
CSteamID from Player State
#include "steam/steam_api.h"
#include "steam/isteamuser.h"
#include "steam/isteamutils.h"
if(PlayerState)
{
CSteamID TheSteamifiedPlayerID(*(uint64*)PlayerState->UniqueId->GetBytes());
}
How to add to the project
When the player logs in, he sends his SteamSessionTicket to php scripts, which verify that he owns the game. To get the ticket, do this:
Code:FString UMMOUtility::GetSteamSessionTicket(int32 LocalUserNum) { IOnlineIdentityPtr Identity = Online::GetIdentityInterface(); if (!Identity.IsValid()) { return TEXT("Identity interface not found"); } return Identity->GetAuthToken(LocalUserNum); }
Code:$mydata = json_decode(file_get_contents('php://input')); $auth_token = $mydata ->auth_token; $curl = curl_init(); // ask steam_api if this user has this game curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => 'https://partner.steam-api.com/ISteamUserAuth/AuthenticateUserTicket/v0001/?format=json&key=YOUR_PARTNER_KEY&appid=YOUR_APP_ID&ticket='.$auth_token, CURLOPT_USERAGENT => 'Codular Sample cURL Request', CURLOPT_CONNECTTIMEOUT => 0, //timeout in seconds (0 - indefinitely) CURLOPT_TIMEOUT => 400 //timeout in seconds )); // Send the request & save response to $resp $response = curl_exec($curl); $response = str_replace ("\n", "", $response); $response = str_replace ("\t", "", $response); $json = json_decode($response, true); // Close request to clear up some resources curl_close($curl); if ($json['response']['params']['result']=="OK") { $steamid = $json['response']['params']['steamid']; // now you have his steamid from SteamAPI, so you know it's the real one // if the player's steam account does own the game, the php script creates a sort of a cookie in DB and sends it back to player as well
When the server has to authenticate the player, it checks whether the cookie the player is sending corresponds to the one in db.
Regarding your code, this is how you get SteamID, although you don't need it on Client, because sending it to server would be unreliable:
Code:PlayerController->PlayerState->UniqueId->ToString(); // gets you steamid that starts with 765....
Last edited by CodeSpartan; 03-01-2019, 04:46 PM.
Comment
-
Some includes are obviously missing.
Code:#include "Online.h" #include "OnlineIdentityInterface.h"
Last edited by CodeSpartan; 03-01-2019, 09:48 PM.
Comment
-
Hey CodeSpartan I Have A Problem Regarding TheLauncher/Auto Updater I get the gameupdater.exe working but whenever i launch the launcher i get this errors"one or more error has occured" i looked at doc and it said i do not have hash.xml but i do have it and it said try to adjust the permission.i dont know what should i adjust..do u have skype?
Comment
-
Originally posted by CodeSpartan View PostIt's a scope problem. You declare the variable in one scope, but want to access it in another, where it's not accessible. I recommend you to go through at least one basic php tutorial before continuing.
Comment
-
Originally posted by yskwork View PostCan not get auth_token,why
without using Online Subsystem Steam (plugin)
Originally posted by KhxiSaki View Post
Hey CodeSpartan I Have A Problem Regarding The Launcher/AutoUpdater When I Launch The Launcher I Got This Error "One Or More Error Has Occured" I Have The hash.xml but it still said i have error
Can't even venture a guess. You need to launch it through visual studio in debug mode to find out the reason. The sources are provided.
Comment
-
If using Online Subsystem Steam (plugin) ,Client Unable to connect dedicated server ,why
My project/Config DefaultEngine
[/Script/HardwareTargeting.HardwareTargetingSettings]
TargetedHardwareClass=Desktop
AppliedTargetedHardwareClass=Desktop
DefaultGraphicsPerformance=Maximum
AppliedDefaultGraphicsPerformance=Maximum
[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
[OnlineSubsystem]
DefaultPlatformService=Steam
PollingIntervalInMs=20
bHasVoiceEnabled=true
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480
GameServerQueryPort=27015
bRelaunchInSteam=false
GameVersion=1.0.0.0
bVACEnabled=1
bAllowP2PPacketRelay=true
P2PConnectionTimeout=90
[Voice]
bEnabled=true
[Core.Log]
LogNet=verbose
LogOnline=verbose
LogVoice=verbose
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="/Script/OnlineSubsystemSteam.SteamNetConnection"Last edited by yskwork; 03-03-2019, 11:01 PM.
Comment
Comment