Hi Planet KDE!

Yeah, I know I’m late, but here’s another Season of KDE student 🙂 My name is Felix Rohrbach and I am working on a statistics and achievements system for Gluon.

What are Statistics and Achievements?

The simplest form of a statistic is a score, which is created during a game, and at the end of the game, it will be compared with the highest score you ever got in this game, and saved, if it is higher. More complex ones are arrays, where every index is connected to a certain event, like visiting some place in a RPG or getting a coin in a platform game. Another option would be to have more than one score saved, or to get an average score of all the times you played.

An achievement is on top of a statistic. An achievement defines that you need at least an score of X in a certain statistic to get this achievement, or you need to get X indexes in the array, etc. Additionally an achievement can have other achievements as dependencies. If you don’t have achieved all the dependencies, you won’t see the achievement.

What I have already done

Simple score statistics and achievements are already done. To use them, you need to create a Statistic Asset and a Achievement Asset in the project dock. Now, you can right-click on them to create a new statistic and achievement. Then, you connect the achievement with the statistic (just click on the button next to the label "statistic"). To change the statistic, you need to add a Statistics Component to an object in the Scene dock. Again, you need to connect that component to the statistic. Then it should look like this:

Now, you open your script component of that object (or add a new one) and type things like

this.GameObject.StatisticsComponent.statistic.score = 20;

to change the current score. To save the score at the end, you need to call

this.GameObject.StatisticsComponent.statistic.commitScore();

Now, Gluon will save scores for every user that plays your game. To see your achievements, you need to copy your game to /usr/share/gluon/games/ and to open the KDE Ext Player of Gluon. Select your game in the list of the installed games, go to the achievement tab and you should see something like this:

Plans for the future

First, I will work on more complex statistics (like the array one) and achievements (dependencies). Then the visual presentation of achievements needs to be improved (icon, progress bar). Other Gluon player applications might also get achievement support.

The most exciting feature is in a more distant future though: support of Open Collaboration Services server (show and sync achievements) 🙂 But here, libattica and the server have to support this first, so I still need to wait some time before working on that.

Want to test?

You can find the code in the Gluon repository (git clone git://anongit.kde.org/gluon) in the branch "achievements". I would be happy about some constructive feedback or feature wishes, just leave a comment here or tell me on the #gluon irc channel about it (my nick is fxrh). Ah, and before I forget:

so you can speak with me there, too 🙂