Jump to content
  • entries
    51
  • comments
    106
  • views
    27,829

Protecting Your Early/Pre-Release Builds


reepblue

2,365 views

 Share

Leaks of games happen, and they still happen. You can spend months and months working on your game, only for a server attack or the wrong person to share it with their buddies; which then goes public accidentally, (or intentional). Having an unintended work in progress build out there can give people the wrong idea about your game because there are people out there who think the development process is pretty straight forward.

 

Let's take a look at the Half-Life 2 leak. The game, and the entire engine code was leaked and the entire thing was very unstable, It was also found out that all those

were scripted, and broke when you actually play them. A lot of doubts and concerns about the game were made as they felt like they were lied to after seeing videos and screenshots not representing the leak at all. Of course, this later on generated a community of it's own, but that's a rare scenario.

 

Since Leadwerks is far more stable than a Source Engine build from 2003, you can have months of playable work leaked. If you indeed plan to sell your game on Steam or Desura, you most likely don't want you're game freely available. So how can we prevent this?

 

If you already got a SteamAppID from Valve after a successful Greenlight campaign, there is nothing to worry as users need a key to access your game. But what about if all to your game is dev textures, rough code, and programmer art? If you only have the indie edition, or only use Lua scripts for your game, you can use the Game Launcher, and set your game to "Friends-Only". For games written in C++, or have a modified application, we can't do that as our program does not get uploaded to the workshop. With the Standard Edition of Leadwerks however, we can use more of the Steamworks API.

 

A friend of mine was talking to me about how an old Source mod use to detect if an invalid Steam user tried to boot the mod, it would not boot. Once I heard this, I was eager to see if I could get a similar system to work.

 

Every Steam user has a public unique ID that comes in many different forms. Steam and games use this to gather information about the user, among other things. In this case, we are going going to focus on the 64bit FriendID number. Thanks to the Leadwerks API, we can access Steamworks features without our game being on Steam!

 

Let's us first start with creating a bool function under the main.cpp.

 

bool CheckSteamID()

{

if (Steamworks::Initialize())

{

}

 

System::Print("Error: Failed to initialize Steam.");

return false;

}

 

So far so good! We make it a bool function so if we are not a fail to load Steamworks, or have the wrong ID, it will return false and close the program. Now let's get the users ID number with:

 

uint64_t user = Steamworks::GetUserID();

 

As I said before, SteamID's come in various forms. The easiest to get is the 64 bit FriendID which appears in profile urls such as http://steamcommunity.com/profiles/76561197996502882/

 

As you can see, my SteamID is 76561197996502882. For the rest of this article, I'm gonna use mine in place of where you should put yours. A way to get yours is to go on a site such as http://ihavenfi.net/steamid. Popping in the STEAM_0:0:******** format after putting your ID-less profile URL will give you your FriendID. Remember, these numbers are public, they aren't like credit card numbers, or anything.

 

So let's continue! For this example, I'm going to use My SteamID. So let's make a simple if statement comparing the account trying to play this game with a hard coded value.

 

bool CheckSteamID()

{

if (Steamworks::Initialize())

{

uint64_t user = Steamworks::GetUserID();

if (user == 76561197996502882) // Me!

{

return true;

}

else

{

System::Print("Error: Invaild SteamID!");

return false;

}

 

System::Print("Error: Failed to initialize Steam.");

return false;

}

 

With this code, (and I hope you replaced the SteamID), your game will only work for you if you're logged into your account. But you need beta testers, and what about the other developers? Let's Continue by adding more IDs!

 

As another example, let's grab Josh's SteamID. After all, he's the CEO and should be able to play any LE game he wants. wink.png Although his profile is private, we can still grab the ID-less URL which is: http://steamcommunity.com/id/Josh

 

Pop it in the converter and we get: STEAM 0:0:6085996. Let's pop that value in again and we finally have his FriendID which is: 76561197972437720

 

Now let's edit that if statement.

 

if (user == 76561197996502882 // Me!

|| user == 76561197972437720) // Josh

{

return true;

}

 

Now, Josh can play our game if he's logged into his Steam account. The best way to get ID's is to make a Steam Group for your testers this way you have all the profiles listed that you need to code in. We're not done yet, we still need to call this function near the start of the main function.

 

if (!CheckSteamID())

return 0;

 

Just make sure you comment that out when your game does get to be on steam, or when it releases elsewhere with a different DRM measure if you desire.

 

With this somewhat messy way, you can restrict your games to certain steam accounts without having your games on steam during development. As a bonus, let's welcome the user in the console to make the tester feel they're special. Put this before the function returns true.

 

std::string username = Steamworks::GetUserName(user);

System::Print("Hello there, " + username + "!");

 

And that's it! There is most likely other ways of doing this, but this way is the simplest and easiest. If you hard code FriendIDs, and use the stand-alone publishing for beta builds, your game is just a bunch of unplayable bites and bits if it falls into the wrong hands!

  • Upvote 7
 Share

1 Comment


Recommended Comments

You should note, however, that the hardcoded ids are found in the compiled assembly-code and won't stop someone who is slightly experienced in binary editing.

  • Upvote 1
Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...