Love Achievements

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
LiquidHelium
Prole
Posts: 8
Joined: Wed May 02, 2012 2:07 pm
Contact:

Love Achievements

Post 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.
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Love Achievements

Post 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.
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
User avatar
Ellohir
Party member
Posts: 235
Joined: Sat Oct 22, 2011 11:12 pm

Re: Love Achievements

Post by Ellohir »

Really cool and clean, good job :D
User avatar
LiquidHelium
Prole
Posts: 8
Joined: Wed May 02, 2012 2:07 pm
Contact:

Re: Love Achievements

Post 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
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Love Achievements

Post by Davidobot »

This is awesome do I have permission to use this in my upspcoming projects?
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

Re: Love Achievements

Post 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.
User avatar
LiquidHelium
Prole
Posts: 8
Joined: Wed May 02, 2012 2:07 pm
Contact:

Re: Love Achievements

Post 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.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Love Achievements

Post 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. ;)
Help us help you: attach a .love.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: Love Achievements

Post 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.
coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

Re: Love Achievements

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest