AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   [ANY] SteamWorks (https://forums.alliedmods.net/showthread.php?t=229556)

KyleS 11-09-2013 17:56

[ANY] SteamWorks
 
1 Attachment(s)
Hello, this extension actually provides a bunch of things now (originally; Family Sharing detection).

This should function for any SteamWorks enabled game. However, I've only tested using CS:S on Linux. Windows builds are possible, but I can't support them.

Interfaces presently supported (and exposed to Pawn). ISteamGameServer, ISteamHTTP, ISteamGameServerStats. If you'd like more interfaces added (with natives/hooks); by all means just post.

Include File: https://github.com/KyleSanderson/Ste...SteamWorks.inc
Confirmed (maybe) working: CS:GO Lin/Win, CS:S Lin/Win, DoD:S Win, L4D2 Lin/Win, TF2 Lin/Win.

My game doesn't work! Nothing works! :(
That's a bug, let me know and we can probably fix it.

Installation Instructions:
If your server has an outdated Steam Client (presume yes, even if your game has been updated recently; unless if you know for sure), you need the latest SteamClient. I've included this from the redistributable portion of the SteamWorks SDK (1.28). This goes in the bin directory beside your gamedir.
This is no longer the case, Valve has since updated a lot of games with a newer steamclient copy then what's attached. If your game has been updated recently, you should be fine (a lot has changed in 3 years).
If you're still running an ancient game like L4D2 and not something more recent and up to date like CS:S or DoD:S you need any steamclient from the past 4 years to have this work.

The rest is pretty straight forward, just extract SteamWorks to your gamedir.

Thanks to:
VoiDeD - Showing how to use Callback Macros.
psychonic - Example for HTTP, knowing which binaries to replace, significant buildbot help.
Drifter - Significant amb2 help.
Unknown Steamworks Devs - Adding the requested functionality to SteamWorks after Family Sharing was being heavily abused.

Plugins to supplement SteamWorks.ext Functionality:
https://forums.alliedmods.net/showthread.php?p=2331846

Plugins using SteamWorks.ext:
https://forums.alliedmods.net/showthread.php?t=236521
https://forums.alliedmods.net/showthread.php?t=237481
https://forums.alliedmods.net/showthread.php?t=253404
https://forums.alliedmods.net/showthread.php?t=252712

Full Documentation:
https://github.com/alliedmodders/hl2...3/public/steam
https://partner.steamgames.com/

Hopefully this helps someone.
The latest development version can be found here: https://github.com/KyleSanderson/SteamWorks
The latest development builds can be found here: https://github.com/KyleSanderson/SteamWorks/releases
Old development builds can be found here: http://users.alliedmods.net/~kyles/builds/SteamWorks/

Dr. Greg House 11-09-2013 21:10

Re: [ANY] SteamWorks
 
In L4D2 people can prevent you from joining a server (precisely the one they are currently playing on) by blocking you in steamfriends/-community. This is bullshit because it happens quite regularly that this way people lock you out of your own server and there is nothing you can do about it.
I remember asking asherkin about this, but unfortunately I cannot remember the exact content of the conversation anymore. I THINK "steamworks" came up, I don't know, so this request could turn out to be misplaced. But I would be more than glad to be able to a) know who's preventing who from joining and b) allowing a person to join anyway.

KyleS 11-10-2013 02:13

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by Dr. Greg House (Post 2058961)
a) know who's preventing who from joining

I don't know how L4D(2) works. However, looking at the available callbacks, it looks like ComputeNewPlayerCompatibility is probably what you're after (I seem to remember this being a CS:GO thing). I don't think we can do B as that would require SH which removes the game independence, for some strange reason (I'll try to look into if it can be avoided).

If you want to try a test extension, I can add the callback for you :O

Dr. Greg House 11-10-2013 14:20

Re: [ANY] SteamWorks
 
Ofc, the least I can do is be your guinea pig.

Also, from what I understand how CS:GO works, it bases on many things l4d(2) has introduced.

KyleS 11-10-2013 16:10

Re: [ANY] SteamWorks
 
1 Attachment(s)
Quote:

Originally Posted by Dr. Greg House (Post 2059320)
guinea pig

Give this a go :wink:
PHP Code:

forward SW_OnNewCompatibilityResult(EResult:resultPlayersDislikeCandidateCandidateDislikesPlayersClanDislikesCandidateCandidateAuthID); 


Dr. Greg House 11-10-2013 23:54

Re: [ANY] SteamWorks
 
I will try to test this tomorrow (depends on whether the person who has the right amount of patience is available).

Weasel 11-11-2013 13:03

Re: [ANY] SteamWorks
 
Is this (just) an extension that makes it possible to ID the owner and player SteamID's? or is there also a plugin or something that makes SourceMod banning work based on that?

KyleS 11-11-2013 13:46

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by Weasel (Post 2059697)
Is this (just) an extension that makes it possible to ID the owner and player SteamID's?

The intention isn't just for that, but that's all it officially has at the moment.
Quote:

Originally Posted by Weasel (Post 2059697)
or is there also a plugin or something that makes SourceMod banning work based on that?

There's a variety of ban systems out there, you're going to need a plugin tailored for your implementation.

Dr. Greg House 11-13-2013 20:03

Re: [ANY] SteamWorks
 
Had the time to test this now. I wrote a small testplugin to log the output (if any) and nothing happened. So I looked more closely if both the extension and the plugin loaded successfully and they did. So no message is logged, neither on allowed join nor on a blocked attempt.

The console of the blocked client(!) shows this
Code:

CSysSessionClient: lobby response 10!
I am giving you this because I think it might be helpful.

KyleS 11-13-2013 20:59

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by Dr. Greg House (Post 2060611)
The console of the blocked client(!) shows this

10 is
PHP Code:

k_EChatRoomEnterResponseMemberBlockedYou 10// Join failed - some member in the chat has blocked you from joining 

You can find the List here.

Do you have any output from the server? I can expose:
PHP Code:

//-----------------------------------------------------------------------------
// Purpose: Sent on entering a lobby, or on failing to enter
//            m_EChatRoomEnterResponse will be set to k_EChatRoomEnterResponseSuccess on success,
//            or a higher value on failure (see enum EChatRoomEnterResponse)
//-----------------------------------------------------------------------------
struct LobbyEnter_t
{
    
enum k_iCallback k_iSteamMatchmakingCallbacks };

    
uint64 m_ulSteamIDLobby;                            // SteamID of the Lobby you have entered
    
uint32 m_rgfChatPermissions;                        // Permissions of the current user
    
bool m_bLocked;                                        // If true, then only invited users may join
    
uint32 m_EChatRoomEnterResponse;    // EChatRoomEnterResponse
}; 

but it doesn't look like there's the connecting member's accountid, so I don't think it's even server side(?).

Dr. Greg House 11-13-2013 21:04

Re: [ANY] SteamWorks
 
Nope, no output at all.

I actually don't necessarily care about who prevents someone from joining, I'd simply like to join either way (if that is still possible).

Dr. Greg House 11-16-2013 23:57

Re: [ANY] SteamWorks
 
Okay, I have another one:

Dr. McKay's steamupdater (and a script I wrote) uses steamtools to determine when the masterserver informs the server of an update. Steamtools currently does not support L4D2 and other games, so I was wondering if you could add the forward needed for the plugins to be able to be ported to other engines.

KorDen 11-27-2013 09:52

Re: [ANY] SteamWorks
 
1 Attachment(s)
If this is allowed (I remember that psychonic removed compiled extensions at some thread during SteamPipe beta, so I don't know..), here is windows build.
Can't test it, because on Win I have only test TF2 server, but for TF2 callback shows same ID's (and its my account UID), so I think it works. Later I will install CSS server for tests and check this ext.

UPD: Tested on CSS Windows. Works fine.

asherkin 11-27-2013 10:49

Re: [ANY] SteamWorks
 
You need to attach the exact source code you used.

KorDen 11-27-2013 11:18

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by asherkin (Post 2065971)
You need to attach the exact source code you used.

I'm used sources from first post, just modified VS project variables to include right folders for compiler. Am I need to upload this files? Also, am i need to modify it to use environment variables instead of full paths? I see that SteamTools don't use this logic (e.g. path to opensteamworks dir is d:\opensteamworks)

KorDen 11-27-2013 12:14

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KyleS (Post 2058917)
However, I've only tested using CS:S on Linux. Windows builds are possible, but I can't support them.

Did you tested that it really shows Owner SteamID? I have a problem on Linux: If I install libraries from SDK, my server shows correct OwnerID, but lagging like under DDoS. If I install original files, it don't show correct OwnerID. I have no idea what happens... Also, on Windows server it shows right OwnerID without any replaces (maybe because it use interfaces of running Steam Client..)

KyleS 11-27-2013 12:36

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KorDen (Post 2065999)
Did you tested that it really shows Owner SteamID?

http://steamcommunity.com/groups/gbe_elites Yes, it works... In some bizarre cases 0 is returned, so who knows.

Quote:

Originally Posted by KorDen (Post 2065999)
I have a problem on Linux: If I install libraries from SDK, my server shows correct OwnerID, but lagging like under DDoS.

I'm very confused by this; it also seems really unrelated to the extension :?

Quote:

Originally Posted by KorDen (Post 2065999)
If I install original files, it don't show correct OwnerID.

Correct, the value is uninitialized; garbage memory is being read.

Quote:

Originally Posted by KorDen (Post 2065999)
I have no idea what happens... Also, on Windows server it shows right OwnerID without any replaces (maybe because it use interfaces of running Steam Client..)

I believe this was the case with really old games. Newer games are independent, as far as I'm aware; I'm not very aware.

KorDen 11-28-2013 10:50

Re: [ANY] SteamWorks
 
1 Attachment(s)
Quote:

Originally Posted by KyleS (Post 2066004)
I believe this was the case with really old games. Newer games are independent, as far as I'm aware; I'm not very aware.

Tested: copied server to the PC without Steam - see random garbage. Installed Steam, updated it and close - see real ID. Uninstalled Steam - grabage. Downloaded and updated SteamCMD - garbage. Copied files from SDK - real ID

Attached MSVC10 project files. Using environment variables HL2SDK and STEAMWORKS_SDK, other paths are relative to sourcemod/extensions folder. It's enough for compile.

Also, here is simple fix for SB plugin (add this to the end of sourcebans.sp) that will just check if the user using Family sharing and if the owner banned.
PHP Code:

#include <SteamWorks>
public SW_OnValidateClient(OwnerSteamIDClientSteamID)
{
    if(
OwnerSteamID && OwnerSteamID!=ClientSteamID)
    {
        new 
tmp;
        for(new 
1<= MaxClientsi++)
        {
            if(
IsClientConnected(i))
            {
                
tmp GetSteamAccountID(i);
                if(
tmp && tmp == ClientSteamID)
                {
                    
decl String:steamid[32];
                    
Format(steamidsizeof(steamid),"STEAM_0:%d:%d", (OwnerSteamID 1), (OwnerSteamID >> 1));
                    
LogMessage("[SB] Checking FamilySharing user %L Owner: %s (OSID: %d, CSID: %d)",i,steamid,OwnerSteamID,ClientSteamID);
                    
OnClientAuthorized(i,steamid);
                    break;
                }
            }
        }
    }


The only problem with this fix is that if OwnerID banned, than query in VerifyBan function that insert info into banlogs table will fail, because this ID will not be in banlist. I think that I need to modify VerifyBan query to select not only bid, but authid too.. I will try to realize it later.
Also, later I will try to modify banning system to ban only owner SteamID.

V1SoR 11-29-2013 08:09

Re: [ANY] SteamWorks
 
Good idea KyleS. This will prove to be very useful once the Family Sharing gets out of beta.

I'm going to try and spread this across all competitive servers in L4D2. Smurf accounts in that game are already an acute problem as it is, but with FS it will only get uglier. Best is to lock out FS users out of the competitive scene completely.

KyleS 11-29-2013 14:56

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KorDen (Post 2066384)
Format(steamid,sizeof(steamid),"STEAM_0:%d:%d ",OwnerSteamID%2,OwnerSteamID/2);

PHP Code:

Format(steamidsizeof(steamid),"STEAM_0:%d:%d", (OwnerSteamID 1), (OwnerSteamID >> 1)); 

Modulo is usually pretty slow. I guess the end result is the same, how we get there is slightly different ;)

KorDen 11-30-2013 16:03

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KyleS (Post 2066786)
Modulo is usually pretty slow. I guess the end result is the same, how we get there is slightly different ;)

Ah, forgot about bit operations at the night when wrote this code, thanks.

Will you add my MSVC config (and maybe compiled win version) to the first post? Or you will not support windows builds at all?

V1SoR 01-05-2014 04:44

Re: [ANY] SteamWorks
 
Uncompilable with L4D2 SDK nor Source 2013 SDK. And the compiled version, despite loading fine in L4D2, doesn't generate anything, or generates random trash values.

KorDen 01-05-2014 15:37

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by V1SoR (Post 2081344)
Uncompilable with L4D2 SDK nor Source 2013 SDK. And the compiled version, despite loading fine in L4D2, doesn't generate anything, or generates random trash values.

Have you replaced auth libraries (from the first post)? Remember that they replaced back every time you run update script.

Dr. Greg House 01-05-2014 17:49

Re: [ANY] SteamWorks
 
This needs the natives free to be kicked uses so that something similar can be done for L4D2 which is pretty much unplayable at the moment.

V1SoR 01-06-2014 02:34

Re: [ANY] SteamWorks
 
KorDen
Thanks, worked.

Dr. Greg House
Didn't quite understand what you said there. Did you mean that you want a way to detect "free-to-buy" Christmas players?

Dr. Greg House 01-06-2014 22:35

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by V1SoR (Post 2081838)
Dr. Greg House
Didn't quite understand what you said there. Did you mean that you want a way to detect "free-to-buy" Christmas players?

YES

KyleS 01-08-2014 05:31

Re: [ANY] SteamWorks
 
1 Attachment(s)
If anyone's feeling brave, here's a WIP. I lied, there are a few natives, and forwards.

Steam_IsVACEnabled();
Steam_GetPublicIP(addr[4]);
Steam_GetPublicIPCell();
Steam_IsLoaded();
Steam_SetGameDescription(const String:sDesc[]);
Steam_IsConnected();
Steam_SetRule(const String:sKey[], const String:sValue[]);
Steam_ClearRules();
Steam_ForceHeartbeat();

And Forwards
Steam_SteamServersConnected
Steam_SteamServersConnectFailure(EResult);
Steam_SteamServersDisconnected(EResult);

If you have anything legacy from SteamTools and use it, let me know. If there's anything on ISteamClient, ISteamGameServer, ISteamUtils, ISteamNetworking, ISteamGameServerStats or ISteamHTTP again let me know. Things that require callbacks (like most stat functions / http) will come later. I'd say they wont, but at this point; might as well jump in and splash around. Natives are a bit strange in this, everything not explicit is a bool and will return false on failure.

Current Source is available: https://github.com/KyleSanderson/SteamWorks
Compiled From: https://github.com/KyleSanderson/Ste...90b0d2d7b2af85

Pull requests are definitely welcome; try to match the style :(

If you encounter a crash or something equally bizarre. It's a debug build; so if you attach a debugger and type `bt full` without back-ticks we can probably figure it out.

KorDen 01-08-2014 06:30

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KyleS (Post 2082852)
If anyone's feeling brave, here's a WIP. I lied, there are a few natives, and forwards.

oO

Do I understand it right, you want to implement SteamTools features that related to a server and doesn't require connection to Steam backend? (so you will not add e.g. gameplay stats?)

Question: is there a way to detect which version of auth libraries are on the server? E.g. to check before use SW_OnValidateClient?

Quote:

Originally Posted by Dr. Greg House (Post 2081715)
This needs the natives free to be kicked uses so that something similar can be done for L4D2 which is pretty much unplayable at the moment.

I think you must use Steam_CheckClientSubscription/Steam_GetClientSubscription from SteamTools. Subs for F2P are 36144 (ROW), 36145 (DE), 36146 (AU)
Something like
PHP Code:

bool:IsClientF2P(client)
{
    new 
subIdsubCount Steam_GetNumClientSubscriptions(client);
    for (new 
0subCounti++)
    {
        
subId=Steam_GetClientSubscription(clienti);
        if (
36144 <= subId <= 36146)
        {
            return 
true;
        }
    }
    return 
false;



KyleS 01-08-2014 06:58

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KorDen (Post 2082880)
Do I understand it right, you want to implement SteamTools features that related to a server and doesn't require connection to Steam backend? (so you will not add e.g. gameplay stats?)

This requires a lot more logic and planning to get the specific data the client has requested. I'm trying my best to not look at SteamTools (the only time I had to was with the strange implementation of Steam_GetPublicIP, I'm glad I did too; it was completely reversed...).
Quote:

Originally Posted by KorDen (Post 2082880)
Question: is there a way to detect which version of auth libraries are on the server? E.g. to check before use SW_OnValidateClient?

There's probably a public version string available. It would be a guess as I don't think they actually bumped anything in the binary besides adding the member, but oh well.

asherkin 01-08-2014 08:23

Re: [ANY] SteamWorks
 
Please use your own prefix rather than SteamTools' Steam_, people can't use both extensions on the same server currently as the names clash.

KyleS 01-08-2014 08:31

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by asherkin (Post 2082905)
Please use your own prefix

No problem! Sorry you've already run into trouble :(

KorDen 01-08-2014 08:51

Re: [ANY] SteamWorks
 
SW_OnValidateClient but SteamWorks_***...
Maybe use one style, e.g. SW_*** for all?

KyleS 01-08-2014 09:23

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KorDen (Post 2082910)
SW_OnValidateClient but SteamWorks_***...
Maybe use one style, e.g. SW_*** for all?

hmm. The namespace is getting pretty cluttered which is why I went with a verbose SteamWorks rather then SW. Old plugins will still work (I'll add a new forward to preserve compatibility). Unless if there's a reason not to :o

KorDen 01-08-2014 13:34

Re: [ANY] SteamWorks
 
Looks like you don't have .inc file on github. I have a question: which results can be in forwards? I think that copy entire EResult enum to .inc isn't a best way, because there are many states not related to the servers...

KyleS 01-08-2014 15:09

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KorDen (Post 2083050)
Looks like you don't have .inc file on github.

Indeed. The Pawn interface may change dramatically if there's a request for a certain style of natives. If we're just mimicking SteamTools, what is present seems sane.
Quote:

Originally Posted by KorDen (Post 2083050)
I have a question: which results can be in forwards? I think that copy entire EResult enum to .inc isn't a best way, because there are many states not related to the servers...

EResult is a generic enum that's used. I think what it's going to end up as is a folder containing a bunch of incs. Then you just include what you want/need (#include <steamworks/http>). EResult is used with a bunch of callbacks, it would probably be wise to preserve it.

Dr. Greg House 01-08-2014 15:20

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KorDen (Post 2082880)
[...]I think you must use Steam_CheckClientSubscription/Steam_GetClientSubscription from SteamTools. Subs for F2P are 36144 (ROW), 36145 (DE), 36146 (AU)
Something like
PHP Code:

bool:IsClientF2P(client)
{
    new 
subIdsubCount Steam_GetNumClientSubscriptions(client);
    for (new 
0subCounti++)
    {
        
subId=Steam_GetClientSubscription(clienti);
        if (
36144 <= subId <= 36146)
        {
            return 
true;
        }
    }
    return 
false;




Yup.

@KyleS: Can you do it? :)

KorDen 01-08-2014 15:26

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by Dr. Greg House (Post 2083094)
Yup.
@KyleS: Can you do it? :)

This already implemented in SteamTools :rtfm:

---
Tested on CS:S Windows. Looks like all works fine. (Test plugin & inc)
https://i.imgur.com/k7WmKFc.png
The only thing I can't understand is why EResult=84 when I disconnect network interface (in enum there are 1-83)

Dr. Greg House 01-08-2014 15:29

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by KorDen (Post 2083098)
[...] :rtfm:[...]

My point exactly. There is no steamtools support for l4d2.

V1SoR 01-08-2014 18:04

Re: [ANY] SteamWorks
 
Quote:

Originally Posted by Dr. Greg House (Post 2083100)
My point exactly. There is no steamtools support for l4d2.

Actually there is, since ~Monday. But I'm still betatesting it. Had to cut some hooks and interfaces that aren't present in L4D2, so stuff got kinda complicated. The main issue I'm having right now is that players connecting from the lobby are establishing connection with the server before the Steam functions are hooked. To put it simple, they're skipping the subscription check. Those who connect later or simply reconnect are fine though.

h3bus 01-09-2014 04:59

Re: [ANY] SteamWorks
 
Would this extension be usefull to fix steam connection loss on linux CS:GO SRCDS (server that don't re-connect to steam until hibernation)?
This is really a pain and occurs sometimes more than once a day, server then need to be empty to allow new user connections (or they get "Session no longer available").

Maybe forcing a heartbeat might get server to re-connect...


All times are GMT -4. The time now is 10:21.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.