Global Data Share

Configuring your project

In order to hook up your game with your website you need to create a custom Game Instance and configure it like so:


That is all that is required. Your game is now ready to access your specified website, sell access to your game from your website via the product page you specified and log players in to their account (or create an account first, if they don’t have one already), manage their passwords and personal details and access your game.

Setup is complete. Now to customize the experience

Open the WordPress Widget and look at the class defaults to find the available customization options.  You can  select which personal information you want to retrieve from the website during login by ticking the boxes next to them.

All details stored in the usermeta file on your website is available to be fetched, irrespective of the plugin that created the data. All you need is the name of the meta_key value. Enter this into the Meta array to fetch it’s value and have it ready for use as soon as login succeeds, no extra steps needed.

In addition, WordPress For Gaming allows you to use any number of virtual currencies in your game and during login it can fetch the player’s current balance automatically. Simply specify the name(s) of the currency(s) you use in your game and their balance will be fetched during login.

 

You are now ready to add WordPress for Gaming to your login scene

In this example scene I show how to hook up WordPress For Gaming into a scene. After the login succeeds one would typically do something like loading a new level but in this case I stay in the same scene and I spawn a demo selection widget.

Since I am going to be staying in this same scene I hooked up the OnResumeGame event to also take me back to the WordPress widget. The widget will automatically detect if you are logged in or not and either display the Login Panel or the Post Login Panel.  Typically the OnResumeGame event would only be needed inside your game levels as this acts as your game’s pause screen (referred to in this asset as the Post Login Panel).

Finally, I also hooked up a button to pause the game and, thus, show the widget again. Typically one would press Escape to bring up the pause menu but since Escape exits PlayMode in the editor I hooked it up to F12 instead.

 

WordPress For Gaming – Getting Started In Unreal