In contrast with the other WordPress assets in my store, WordPress Serials require virtually no work for you to do in Unity at all and does most of what it does in the WordPress dashboard
To get started with the kit just install it into your project and if you haven’t already done so upload and activate the wuss_serials plugin on your WordPress website. You only need to do this once and you are good to go with all other games you install on your website in future.
ABOUT WordPress Serials
So what is WordPress Serials exactly? Simply put, it allows you to pre-generate any number of serials you want and then it let’s players take ownership of them by linking their user accounts to a serial.
Going a little fast there? Let me slow it down. Every user, once they register on your website, gets a unique ID. When they register with a valid serial that ID is linked to that serial. This means 4 very important things:
Nobody else can use that serial any more because It is already allocated to someone
That serial is linked to that game for that person regardless of the device he is playing on. This means that he can register the game once on one device and then the game is registered on all his devices automatically. This includes any future device replacements or even when borrowing someone else’s device for a while. The serial is linked to THEM, not to one of the player’s devices.
As inferred from the aforementioned point, this means the serial is only ever needed once to register one copy of the game on one device. After that the serial never needs to be entered by the owner ever again. Not even when they contact customer support since you already get to see all the serials for all their games just by calling up their account in the dashboard. This means you don’t have to display the serial in the game unless you want to and for all sense and purposes the owner can completely forget about the serial after he used it.
This also means that sharing the game or selling it on second hand makes absolutely no sense. The game cannot be played without a serial and the serial is linked to a user’s account. If they ever decide to “share” the game then they would have to give the person access to their entire account including the ability to change their username, email address and password. And if they want to sell the game second hand they first have to contact you and ask you to remove the serial from their account. Now the other party still needs a license (which you can allocate to them with one click) but if the original owner ever wants to play again he will have to buy another serial for himself again. Piracy of your game(s) no longer make any sense…
WordPress Serials comes with a complete dashboard interface for generating and removing serials. You can reserve serials for games being distributed in retail stores and (if you have the WordPress Money kit installed) you can also sell your games directly via your website which results in non-reserved serials being allocated and registered to the buyer automatically meaning they never have to enter the serial even once. They don’t ever even need to see the serial as everything will just work from the moment your WooCommerce transaction completed.
Also on the dashboard are displays listing all available and all allocated serials, per game as well as a means of viewing all serials belonging to a single user. When viewing a user’s account you can simply select a game from a drop down box and with one click register a serial to him for that game. Alternatively, next to every serial he owns is a button to remove that person’s registration for that particular game.
Absolute control over all things registration related in no more than 2 clicks for any action…
Welcome to WordPress Serials !
MUCH ADO ABOUT NOTHING
From within Unity WordPress Serials only exposes 3 functions for you to call:
If a customer owns a serial and has not yet registered the game use this function to send the serial to the server to register the serial to the user.
If at any time you wish to check if a game is registered to the logged in player, call this. It takes no parameters and will either return a bool named “valid” with a value of true or it will trigger your error response function. This is useful at the start of the game or if you just want to inject random checks to minimize any kind of game hacks
Again, this takes no parameters. Just be sure the user is logged in when you call it and when it’s done you can use the results as you see fit. NOTE: The serial is NOT needed for anything after registration so the results of this function are purely for you to use in some cosmetic way
SEAMLESS WordPress Login INTEGRATION
I have modified the default WordPress login prefab to automatically detect if you have WordPress Serials installed or not. If you do it will expose a couple of field for you to set:
If true WordPress Login will automatically test for the user’s registration during login and set the static value WULogin.HasSerial accordingly
If true the registered serial will be returned for you to display in game should you wish to do so
When true is changes the behavior of the WordPress Login prefab. Instead of closing the prefab so players can start to play, it now redirects to the screen where they have to either register with a serial they have in their possession or they can click on the button to buy a serial if they do not already have one. Additionally, the PostLoginMenu screen’s “Continue playing” button now also validates that a legit serial exists for the user.
If Fetch_serial was set to true then these fields should be handled for you automatically. If you turned them off then you will have to make a manual call to the server using the ValidateRegistration function mentioned above.
If this field is not set then clicking on the button to buy a serial will take you to your website’s home screen. If you want to link directly to the game’s description or product page simply enter the full URL here.
NEW STATIC PROPERTIES AT YOUR DISPOSAL
WordPress Login now contains the following new static properties:
The private variable you set in the inspector was meant for the login function to know whether or not to check for the serials. For the rest of the game this variable I what you will access to determine if a serial is required to play the game or not
As the name implies this checks to see if a valid serial has been found for the user. WordPress Login sets this value on login if you elected to have it check for serials but if you call ValidateRegistration then you will need to manually update this value based on the results you receive
This property is not guaranteed to hold any value and in most cases is not needed. WordPress login sets this value if you had Fetch_serial set to true during boot. If you call FetchSerialNumber manually you need to populate this property based on the results. This exists purely for cosmetic reasons only
All WooCommerce integration for all my products is enabled by installing the WordPress Money plugin on your website. If you have that plugin installed and enabled then all you need to do to integrate WordPress Serials into WooCommerce and Unity is to create a normal WooCommerce, digital product and give it an SKU of the format WUSKU_GID_GAME (where GID is the actual Game ID of the game you are selling). That is all. It’s done!
By doing this anyone who buys the game from your website will automatically be allocated a serial and have that serial registered to his account. this means the customer need never even see his serial if you don’t want him to. Just click on buy and as soon as the transaction state indicates the transaction is completed, they can just start playing on whatever device they want without any fuss.
Some thoughts on what you can do with this. If you enable the Require_serial_for_login option then you are effectively forcing people to pay before they can play. This means you can make your game available for free download and not have to worry about it.
As an alternative, you can have the login function check for a serial during login but NOT have it require the serial for login. By doing this you can allow people to play the first few levels of your game and at some point you can add a test to see if WULogin.HasSerial is true and if not you can pop up the login prefab again and show them the screen where they need to enter their serial. Alternatively, instead of loading scene 6, just load a scene that says “Thank you for playing. If you want to continue, please purchase a serial number now to exit demo mode”…and with that you have turned this kit into a means for making demo games from any game and you can very easily do the validation test again at any point in the game (on game start, on an enemy dying, on saving the game, on using a health pack… check “Does this player have a serial? Trust the local bool or fetch the results from the server. Your choice)
As an aside, why not supplement my piracy prevention with some cheating prevention also by looking at the Anti-Cheat Toolkit.
Cheat proof and pirate proof games… Doesn’t that just sound the best? 😀
As you will see in the modified demo, adding this kit to your project requires a slight change in the way you approach logins. Before, when a login was successful yo could just start to play the game. Now you also have to take into account whether or not the serial is required before players can do so. The onLoggedIn event still fires after the login completed so if your code just waits for that event and then loads the new scene you will have to modify that code to exit if WULogin.HasSerial is false. Instead, you will now have to register to the onResumeGame event to check if you can continue running your old code. It’s a minor change but an important one. See the updated demo for more