Announcement

Collapse
No announcement yet.

How to get player steam id?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to get player steam id?

    We're making a multiplayer online game with a persistent world.
    Every player can create multiple characters and play with them, so we need to store players info to know who is who.
    As we'll be using SteamAPI for authorization and multiplayer servers, we would like to know how we can, from the server, obtain the player Steam ID.
    We cant find any variable or method in docs to get the Steam ID.
    Last edited by Sveitar; 03-02-2015, 05:30 PM.

    #2
    If you use the SteamSubsystem, the PlayerID will be the SteamID. You can find the PlayerID in the PlayerState.

    https://docs.unrealengine.com/latest...rId/index.html
    Open for contracted work | C++/BP (incl. Multiplayer) | Tutoring | VR

    My UE4 Blog/Page with Tutorials and more: Hit me for ALL the things!
    (Including 100+ Pages Multiplayer Network Compendium to get you started.)

    Comment


      #3
      But PlayerID is an integer, it's giving me the value "256" no matter what account I use. How can it be the SteamID (STEAM_X:X:XXXXXX)?

      PS: I posted in the wrong section, can you move this to the C++ forum? Thank you
      Last edited by Sveitar; 02-23-2015, 04:47 PM.

      Comment


        #4
        Hm, this is odd. I just googled a bit and i can't seem to find any information on how to get the ID.

        Rama tried something in the Beta version of the Engine but the question about getting the ID wasn't really answered.

        Maybe write him a PM and ask him about it. (:
        Open for contracted work | C++/BP (incl. Multiplayer) | Tutoring | VR

        My UE4 Blog/Page with Tutorials and more: Hit me for ALL the things!
        (Including 100+ Pages Multiplayer Network Compendium to get you started.)

        Comment


          #5
          Originally posted by Storngrir View Post
          But PlayerID is an integer, it's giving me the value "256" no matter what account I use. How can it be the SteamID (STEAM_X:X:XXXXXX)?

          PS: I posted in the wrong section, can you move this to the C++ forum? Thank you
          This most likely means you are not actually using the Steam Online Subsystem

          Make sure you have your DefaultEngine.ini setup correctly!

          Always check out the latest version of ShooterGame/Config/DefaultEngine.ini to see what you need for Steam as the engine evolves.

          I have this wiki on the subject of Steam Integration
          https://wiki.unrealengine.com/Steam,...ng_Development



          Rama

          PS: There are other ways to get Steam ID that are more complicated, but let know if the above helps.
          UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

          ♥ Rama

          Comment


            #6
            Thank you Rama, I'll try it tonight and post here the results

            Comment


              #7
              I made the setup again from scratch using 4.7.1. Everything is configured following your wiki and checking the ShooterGame/Config/DefaultEngine.ini and it's not working.
              I get the steam screen overlay when pressing SHIFT+TAB
              I'm printing the PlayerState->PlayerId using GEngine->AddOnScreenDebugMessage.
              If I run the game as standalone it prints "256".
              If I run the game in a new editor window using run dedicated server it prints "0" and the editor hangs and stops responding.

              My DefaultEditor.ini file:

              Code:
              [URL]
              [/Script/HardwareTargeting.HardwareTargetingSettings]
              TargetedHardwareClass=Desktop
              AppliedTargetedHardwareClass=Desktop
              DefaultGraphicsPerformance=Maximum
              AppliedDefaultGraphicsPerformance=Maximum
              
              [/Script/WindowsTargetPlatform.WindowsTargetSettings]
              +TargetedRHIs=PCD3D_SM5
              +TargetedRHIs=PCD3D_SM4
              
              [/Script/Engine.GameEngine]
              !NetDriverDefinitions=ClearArray
              ;+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="/Script/OnlineSubsystemUtils.IpNetDriver")
              +NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
              
              [OnlineSubsystem]
              DefaultPlatformService=Steam
              PollingIntervalInMs=20
               
              [OnlineSubsystemSteam]
              bEnabled=true
              SteamDevAppId=480
              GameServerQueryPort=27015
              bRelaunchInSteam=false
              GameVersion=1.0.0.0
              bVACEnabled=1
              bAllowP2PPacketRelay=true
              P2PConnectionTimeout=90
              
              [/Script/OnlineSubsystemSteam.SteamNetDriver]
              NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"
              AllowDownloads=false
              
              [/Script/Engine.RendererSettings]
              r.MobileHDR=True
              r.AllowOcclusionQueries=True
              r.MinScreenRadiusForLights=0.030000
              r.MinScreenRadiusForDepthPrepass=0.030000
              r.PrecomputedVisibilityWarning=False
              r.TextureStreaming=True
              Compat.UseDXT5NormalMaps=False
              r.AllowStaticLighting=True
              r.NormalMapsForStaticLighting=False
              r.GBuffer=True
              r.GenerateMeshDistanceFields=False
              r.Shadow.DistanceFieldPenumbraSize=0.050000
              r.TessellationAdaptivePixelsPerTriangle=48.000000
              r.SeparateTranslucency=True
              r.CustomDepth=1
              r.DefaultFeature.Bloom=True
              r.DefaultFeature.AmbientOcclusion=True
              r.DefaultFeature.AmbientOcclusionStaticFraction=True
              r.DefaultFeature.AutoExposure=True
              r.DefaultFeature.MotionBlur=True
              r.DefaultFeature.LensFlare=True
              r.DefaultFeature.AntiAliasing=2
              r.EarlyZPass=3
              r.EarlyZPassMovable=False
              r.DBuffer=False
              r.ClearSceneMethod=1
              r.MSAA.CompositingSampleCount=4
              r.WireframeCullThreshold=5.000000
              UIScaleRule=ShortestSide
              UIScaleCurve=(EditorCurveData=(Keys=),ExternalCurve=None)
              
              [/Script/Engine.UserInterfaceSettings]
              UIScaleCurve=(EditorCurveData=(Keys=((Time=480,Value=0.444),(Time=720,Value=0.666),(Time=1080,Value=1.0),(Time=8640,Value=8.0))),ExternalCurve=None)
              UIScaleCurve=(EditorCurveData=(Keys=((Time=480.000000,Value=1.000000),(Time=745.200012,Value=1.000000),(Time=947.260803,Value=1.000000),(Time=8640.000000,Value=1.000000))),ExternalCurve=None)
              
              [/Script/EngineSettings.GameMapsSettings]
              EditorStartupMap=/Engine/Maps/Templates/Template_Default
              EditorStartupMap=/Game/Maps/World
              TransitionMap=
              bUseSplitscreen=True
              TwoPlayerSplitscreenLayout=Horizontal
              ThreePlayerSplitscreenLayout=FavorTop
              GameDefaultMap=/Engine/Maps/Entry
              GameDefaultMap=/Game/Maps/EntryLevel
              ServerDefaultMap=/Engine/Maps/Entry
              ServerDefaultMap=/Game/Maps/World
              GlobalDefaultGameMode=/Script/Engine.GameMode
              GlobalDefaultGameMode=/Script/SoulnetServer.WorldGameMode
              GlobalDefaultServerGameMode=None
              Last edited by Sveitar; 03-01-2015, 12:18 PM. Reason: little mistake

              Comment


                #8
                The 0 ID is one thing, but could you post the log that's saved when the editor crashes on Pastebin or something similar?
                Journeyman's Minimap - Available on Marketplace - Forum topic - Video

                Comment


                  #9
                  Originally posted by NisshokuZK View Post
                  The 0 ID is one thing, but could you post the log that's saved when the editor crashes on Pastebin or something similar?
                  Sorry, it just hangs and stops responding

                  Comment


                    #10
                    Originally posted by eXi View Post
                    If you use the SteamSubsystem, the PlayerID will be the SteamID. You can find the PlayerID in the PlayerState.

                    https://docs.unrealengine.com/latest...rId/index.html
                    I am pretty sure the PlayerId is not the SteamID.
                    The SteamID is a 64bit unsigned integer (unsigned long long), however the PlayerId is a 32bit signed integer.

                    Code:
                    UPROPERTY(Replicated, BlueprintReadOnly, Category=PlayerState)
                    int32 PlayerId
                    To get the "STEAM_X:X:XXXXXX" format first you have to get the 64bit format.

                    The UniqueID has some access to the steamid, but the steamid itself seems to be hidden.

                    Code:
                    UPROPERTY(ReplicatedUsing=OnRep_UniqueId)
                    FUniqueNetIdRepl UniqueId
                    https://docs.unrealengine.com/latest...eId/index.html
                    I hope it helps.

                    Comment


                      #11
                      I thought that in order to use the steam subsystem you needed to have an ID for your game, which according to steam means you must have a project that has been greenlighted. Is this not the case?
                      Acclivity Game Studios. Making a BP FPS, Tutorial Series on Blog : On Unreal Wiki : Twitch

                      Comment


                        #12
                        You don't need to have an approved game on steam. If you want to work with the SDK (test your game for example) you can use a test AppID.

                        Greenlight FAQ:
                        http://steamcommunity.com/greenlight/faq/

                        How do I get access to Steamworks?

                        You can download the Steamworks SDK, view documentation, and compile with a test appID by visiting https://partner.steamgames.com and accepting the SDK Access Agreement. Developers wishing to integrate the Steamworks SDK with their own games or applications still need to first be Greenlit and provided with an appID.

                        Have a look at the SDK documentation:
                        https://partner.steamgames.com/documentation/

                        But i wouldn't worry about the steam integration if my game is not approved just yet.
                        Last edited by Azarus; 03-02-2015, 04:04 AM.

                        Comment


                          #13
                          The steamuserID is contained inside a CSteamID which has a function to convert it to a usable 64-bit Uint.

                          Comment


                            #14
                            Originally posted by Azarus View Post
                            I am pretty sure the PlayerId is not the SteamID.
                            The SteamID is a 64bit unsigned integer (unsigned long long), however the PlayerId is a 32bit signed integer.

                            Code:
                            UPROPERTY(Replicated, BlueprintReadOnly, Category=PlayerState)
                            int32 PlayerId
                            To get the "STEAM_X:X:XXXXXX" format first you have to get the 64bit format.

                            The UniqueID has some access to the steamid, but the steamid itself seems to be hidden.

                            Code:
                            UPROPERTY(ReplicatedUsing=OnRep_UniqueId)
                            FUniqueNetIdRepl UniqueId
                            https://docs.unrealengine.com/latest...eId/index.html
                            I hope it helps.
                            Nice, but I need the steam id to identify players in a persistent world storing a custom id and the steam id in a database. I think the UniqueId may change every time the user plays the game right?

                            Comment


                              #15
                              Originally posted by Storngrir View Post
                              I think the UniqueId may change every time the user plays the game right?
                              No a Steam ID is unique / steam account and it will not change. To identify a player use: FUniqueNetIdRepl / FUniqueNetIdSteam. So the UniqueId will give you the SteamID.
                              I think it has a ToString method according to the code it returns a 64bit integer in an FString. Convert it back to uint64_t then you can use it for database queries.

                              GitHub Code:
                              https://github.com/EpicGames/UnrealE...emSteamTypes.h
                              Last edited by Azarus; 03-02-2015, 03:23 PM.

                              Comment

                              Working...
                              X