Facepunch / Facepunch.Steamworks

Another fucking c# Steamworks implementation
MIT License
2.93k stars 350 forks source link

Trying to check if the player is a developer or publisher for the game. #777

Closed NoSleepKid closed 2 months ago

NoSleepKid commented 3 months ago

I'm trying to integrate developer tools in my game. And i was wondering if i can have a better way of checking if the player is a developer/publisher of the game or not without having to make a developer build or whatever so i can use the developer tools on any version of my game from any location by just being in my account using facepunch in unity.

DK189 commented 2 months ago

You can do this by checking if the SteamID of the current session matches the developer id. The simplest implementation is to collect a list of SteamIDs of the team members, put them in an array, and whenever you need to check, just confirm that SteamClient.SteamId exists in that array.

Another, and I think more ideal, approach is to integrate with the steam public api, where you check if SteamClient.SteamId is in a specific group that you manage. That way, even after release, you can change the developer list without rebuilding the codebase.

Example:

https://steamcommunity.com/groups/Valve/memberslistxml/?xml=1

For more information:

https://partner.steamgames.com/documentation/community_data
kristianpiacenti commented 2 months ago

You can do this by checking if the SteamID of the current session matches the developer id. The simplest implementation is to collect a list of SteamIDs of the team members, put them in an array, and whenever you need to check, just confirm that SteamClient.SteamId exists in that array.

Another, and I think more ideal, approach is to integrate with the steam public api, where you check if SteamClient.SteamId is in a specific group that you manage. That way, even after release, you can change the developer list without rebuilding the codebase.

Example:

https://steamcommunity.com/groups/Valve/memberslistxml/?xml=1

For more information:

https://partner.steamgames.com/documentation/community_data

be careful not to do the checking on the client

NoSleepKid commented 2 months ago

Okay! This sounds great!

DK189 commented 2 months ago

You can do this by checking if the SteamID of the current session matches the developer id. The simplest implementation is to collect a list of SteamIDs of the team members, put them in an array, and whenever you need to check, just confirm that SteamClient.SteamId exists in that array. Another, and I think more ideal, approach is to integrate with the steam public api, where you check if SteamClient.SteamId is in a specific group that you manage. That way, even after release, you can change the developer list without rebuilding the codebase. Example:

https://steamcommunity.com/groups/Valve/memberslistxml/?xml=1

For more information:

https://partner.steamgames.com/documentation/community_data

be careful not to do the checking on the client

Of course, it's better to build a specific version or publish a dlc/workshop item. If you use the workshop channel, you can configure it to only allow friends of the owner to download it, you can create a dedicated account for the extension containing the devtools, and add friends with the admins.

If your game/app is really concerned about security, this is a viable and accessible way.