thumb

The WordPress Achievements plugin for WordPress Login truly is a very simple product to understand and use. Once you understand how it works you will be able to use it like a boss in no time at all. For that reason let me give you the background info first and then end off with how you can get started using the kit…

The basic premise is as simple as this

  1. You go to your dashboard and create a new achievement, giving it a graphic to display when it has been achieved and a graphic to display when it has not. Next, pick what game this achievement belongs to and you now have a bare-bones achievement.The game identifier and the two graphics are the only things that are really required. Everything else is optional. I would recommend you give it a name also, though, just to make it easier for you to find when you want to modify it.

    Should you want to, you can also add:

    – text to display when the achievement has been unlocked
    – text to explain to the player how they can unlock the achievement
    – any number of requirements to test if an achievement can be unlocked

  2. Inside your game you decide for yourself when someone deserves an achievement to be unlocked and if you feel that is the case then all you need to do is call WUAchieve.UnlockAchievement(int id) and pass it the achievement’s id. The achievement is now unlocked.

That’s it. That easy.
Like I said. Very simple to understand and use.


 There HAS to be more to it than that, surely?

Not really. I tried to keep it as functional but as simple as humanly possible. You create the achievement, you get the ID, you decide when to award it and when you are ready you just call UnlockAchievement(int) and on the back end everything is hunky dory. That only leaves the front end… i.e. how do you show the achievements in Unity?

That, however, depends on each individual game. I provide you with a host of functions so that you can decide for yourself how you want to display the achievements in your game but I also include a fully functional prefab to use as a reference.

Using this system boils down to this:

  1. Request a list of all achievements once (ideally directly after login)
  2. Receive all info of all achievements including which of them the player has already unlocked
  3. Display that info in any way you choose

Inside this prefab I make provision for awards that you can unlock manually in case you want to use your own award tracking system but I also make provision for awarding the achievements on your behalf if you set the requirements on your website. As a bonus feature, if the image you wish to display is found in a Resources folder in your project the prefab uses the local image instead of fetching it from online. If the image is not found then it will go fetch it.


Automatic awarding of achievements

The requirements system allows you to define specific unlocking conditions directly on your website and thus allows you to change the requirements even after the game was published.

Simply put, simply decide when something of importance has happened in your game and then store a key to indicate it has happened. Every time you update a key the prefab will store it so that the event(s) that happened persist between play sessions. It then loops through each locked achievement with server side defined requirements and checks each requirement to see if any achievement now fulfils the unlock requirements. If it does then it is unlocked.

For the demo scene I created some buttons above the prefab to allow you to simulate what would happen in game when you award or remove keys and also allow you to manually toggle awards on or off.


About the game keys and requirement system

Game keys are how I track game progress in the demo prefab.
They are simply strings and can be anything you want them to be but includes a value to indicate how many of those keys you currently hold.

Example keys:
gold, level, enemy_kills, headshots, reputation… quite literally anything you want.

While the game is playing, whenever something of any importance happens, simply add a key to keep track of how many times this “something” has happened thus far. For example, say your character does a head shot… You would just call:

UpdateKeys("HeadShot", 1);

With that single line of code you now have one more head shot key than you had before.


So how do they work, exactly?

In your dashboard, when you define your achievement, you can add as many requirements as you like for each achievement. All requirements must be met before it is considered unlocked by the prefab.
Each requirement consists of 3 fields.

The first is selected via a drop down box to determine if this achievement:

  1. Requires AT LEAST…
  2. Must have LESS THAN…
  3. Or must HAVE EXACTLY…

…the amount of keys you specify.

The second field is a text field where you specify the name of the key (case sensitive). The final field is a number representing how many keys would qualify this requirement as being met. All requirements must be met before an achievement is unlocked.

Example:
Let’s say you create an achievement called “Master Sniper” and you set three requirements.
After setting the three values for each of your three requirements they will essentially read like this :

IF you have AT LEAST 10 HeadShots keys
AND you have LESS THAN 1 Missed keys
AND you have EXACTLY 3 Lives keys
THEN receive the Master Sniper achievement.

You can make this as simple as “Killed at least 100 Orcs” or you can make an achievement have 500 requirements. How easy or difficult you make it is entirely up to you.

While playing the game you just call UpdateKeys whenever something happens and the prefab will keep checking all the various keys against all the various requirements of all the locked achievements and award the achievements when appropriate. You just sit back and relax.


Quick recap…

You can have two types of awards:

  1. You track achievements yourself and just call WUAchieve.UnlockAchievement to unlock an achievement
  2. You can define any number of requirements in advance and have a central function in your project test against them and award achievements as and when they are earned.

In both cases you will need a way to track what the player has and has not done so you might already have another system in place and would prefer to use that method instead. With method two, above, the prefab takes care of storing and retrieving your progress for you and truly automates the entire process.


I just ran the demo scene and nothing happened.
How do I get started?

  1. Go to your WordPress dashboard and install the wuss_achievements plugin if you haven’t already done so.
    This can be found inside the “Assets/myBadStudios/WUSS/Wordpress/Plugins/” folder in Unity
  2. Go to the WUSS menu and click on the All Achievements sub menu. On the page that opens, click “Add New”
  3. On the page that opens enter a name for your achievement as the post’s title
    The post content box is where you type in the text that is shown after the achievement is unlocked
    The Excerpt panel is where you enter the unlock requirements in plain text
    The Featured Image box is where you define the graphic to show after the achievement was unlocked
    The Locked Icon box is where you define the locked image, as the name implies
    Finally there is the Requirements tab. If you want to add any just click on the Add Requirement button to get started
    NOTE: Be sure to click on Save Requirements before you update the page (!!!)
    NOTE: There are some sample graphics in the project you can use to get started with making achievements
  4. Now just publish or update the post and you are done here.
  5. When you return to the WUSS main menu and then click on the Badges tab you will see all the achievements listed per person. Simply select a user via the drop down box to see which achievements they have unlocked. Obviously at this point everything will still be locked but on this page you can manually assign or remove any achievement from any person simply by clicking on the black button floating over the achievement.
  6. Now go to Unity and open the Achievements demo scene. Click on the canvas and make sure the WPServer component is pointing to your website and also, for this particular demo scene, enter your login username and password in the DemoScript component.

That is all there is to it. You can now run the demo and see the achievements you created on your website. Feel free to play around with adding and removing keys and seeing what happens.

THIS TAB IS STILL UNDER CONSTRUCTION

Please check back in soon...

THIS TAB IS STILL UNDER CONSTRUCTION

Please check back in soon...

THIS TAB IS STILL UNDER CONSTRUCTION

Please check back in soon...

You may also like…