Page 1 of 2

Love Achievements

Posted: Tue May 22, 2012 3:53 pm
by LiquidHelium
I have been bored so I made a lightweight achievement system that can be easily added to games.

Here it is on github: https://github.com/LiquidHelium/LoveAchievements

Here are some videos I made, one is a shitty game I created as an example for the code and the other is my system in In Your Face City Trains:



To get it to work you need to do the following
copy the achievements directory into your love folder, so you have achievements.lua in achievements/achievements.lua
then add the following to the top of your main.lua

Code: Select all

require("achievements/achievements")
then add this to the your love.load() method

Code: Select all

achievementSystem = AchievementSystem.New()
then add this to the your love.update() method

Code: Select all

achievementSystem:Update()
then add this to the your love.draw() method

Code: Select all

achievementSystem:Draw()
then edit achievements/config.lua to add some achievements, there are some examples in there already, you should probably remove them, they follow this syntax:

Code: Select all

achievementSystem:CreateAchievement(UniqueID, Title, Description, imagename)
achievements have to be defined in achievements/config.lua, nowhere else

the imagename should just be file name and extension, not the full folder path, it should refer to a file in achievements/img, you should add your own images for achievement icons in that folder
to unlock an achievment you use

Code: Select all

achievementSystem:UnlockAchievement(UniqueID)
displaying all the achievements and wether they are locked must be done by you for the moment, you can use

Code: Select all

achievementSystem:GetData()
to return a table with tables storing the UniqueID, name, description, image and unlock status of each achievement
It still needs some work (I need a way to display all achievements, currently it's left up to each game to implement how it's done individually because I don't know how I'm going to display them all on the screen, since I don't know what resolutions this is going to be run on) but as far as I know there is no other achievement system for love games, and if there is then I had fun making this so nothing has been lost. Feel free to add this to your games or do whatever you want with it, just give credit.

Re: Love Achievements

Posted: Tue May 22, 2012 4:26 pm
by josefnpat
This is very cool, so I thought I'd give it a quick try on a previous game.

I got it to work, but I noticed it only works when I packaged it up as a love file.

If you decompress the zip, and run it from CLI, for some reason it doesn't work.

Nice job though, I really like it.

Re: Love Achievements

Posted: Tue May 22, 2012 4:34 pm
by Ellohir
Really cool and clean, good job :D

Re: Love Achievements

Posted: Tue May 22, 2012 5:51 pm
by LiquidHelium
I added an update so if you hold down = you can see all the achievements and whether you have unlocked them or not.

josefnpat wrote:This is very cool, so I thought I'd give it a quick try on a previous game.

I got it to work, but I noticed it only works when I packaged it up as a love file.

If you decompress the zip, and run it from CLI, for some reason it doesn't work.

Nice job though, I really like it.
Strange, I'll look into it

Re: Love Achievements

Posted: Tue May 22, 2012 6:55 pm
by Davidobot
This is awesome do I have permission to use this in my upspcoming projects?

Re: Love Achievements

Posted: Tue May 22, 2012 7:16 pm
by coffee
josefnpat wrote:This is very cool, so I thought I'd give it a quick try on a previous game.

I got it to work, but I noticed it only works when I packaged it up as a love file.

If you decompress the zip, and run it from CLI, for some reason it doesn't work.

Nice job though, I really like it.
Was really a piece of cake. You could add achievements for reach x points.

Nice lib LiquidHelium. Well done.

Re: Love Achievements

Posted: Tue May 22, 2012 7:29 pm
by LiquidHelium
Thanks guys
Davidobot wrote:This is awesome do I have permission to use this in my upspcoming projects?
Yeah, feel free to use it for whatever you want, I don't really know/care about licences or people needing my permission, all I ask is that you don't claim it's your own work.

Re: Love Achievements

Posted: Tue May 22, 2012 9:06 pm
by Robin
LiquidHelium wrote:I don't really know/care about licences or people needing my permission, all I ask is that you don't claim it's your own work.
It will be useful to pick a specific license. That way everyone knows what to expect, and you don't need to give people permission to use Love Achievements all the time. ;)

For what you want, the zlib/libpng license seems to fit perfectly. LÖVE itself is distributed under that license, so you know it's a good one. ;)

Re: Love Achievements

Posted: Wed May 23, 2012 3:16 am
by TechnoCat
Very cool library you made here.

Does it have persistence between sessions?

And probably way out of your scope, but how about a central repo for storing our achievements online with methods for comparing with other people's achievements? I've been wanting to make something like this, but I feel it needs https.

Re: Love Achievements

Posted: Wed May 23, 2012 5:50 am
by coffee
TechnoCat wrote:Very cool library you made here.

Does it have persistence between sessions?

And probably way out of your scope, but how about a central repo for storing our achievements online with methods for comparing with other people's achievements? I've been wanting to make something like this, but I feel it needs https.
It keeps a txt file "achievements.txt" (that could actually be configurable/initialized without mess with lib). Persistence worked very well as from I saw in Mega example. Only problems could be the existence of cheating/no encryption if we intend a more serious achievement system.

Your repo idea would be nice. If Hellium extend it some day with some .lua to contact a configured server (or even provide some basic php ladder management since he seems have knowledge of it) would make this achievement system most complete.