Share Your Code

Simple local score framework

Posted by Abica, Posted on May 3, 2010, Last updated October 7, 2010

I wrote a simple and easy to use local high score system for some of my games and I thought I'd share.

I also have support for global high scores in the works using google app engine. When I ever get some time to finish the global stuff it'll be very similar to cocoslive.net.

Scores are timestamped, sorted by score and stored as json. There is a dynamic grouping system to allow for on the fly generation of scoreboards.

The end goal will be to make local and global high scores completely transparent and to make them as easy to work with as possible.

Check the readme for some code examples:
http://github.com/Abica/lime

Let me know what you guys think.

Compatibility: 
Corona 2.0

Replies

amigoni
User offline. Last seen 1 year 12 weeks ago. Offline
Joined: 12 Aug 2010

Very cool. Any news on the google app engine version?

Thanks

EdwardK
User offline. Last seen 2 years 33 weeks ago. Offline
Joined: 15 Dec 2010

2011/1/21 Abica,
Using the score code in a game; THANKS for sharing.
Our game has skill levels of play.
scores = lime.localScores({ name = name, level = level})
gets the scores for this player at this level.
want: lime.localScores({ name = name})
to get ALL the scores for the player to get their overall high score.
We looked at modifying your code.
Wow do we have a lot to learn about Lua; the complexity was above our current abilities.
Thanks again for sharing.
2/4 wrote some comparatively primitive functions to get high scores & generate a high score board. Not posting code because they depend on our implementation of this more general concept. Willing to share if you think it will help you. EdwardK@TriSail.net

robmiracle
User offline. Last seen 8 weeks 4 days ago. Offline
Joined: 18 Jan 2011

I'm using this framework from the sample code:

http://developer.anscamobile.com/code/another-local-score-framework

It works pretty well.

cshaopin
User offline. Last seen 7 weeks 21 hours ago. Offline
Joined: 13 May 2011

Hi,

I have 4 files. They are main.lua, game.lua, gameOver.lua & highScore.lua

I'm using Director class to navigate across them.

My problem is the "lime.setup({maxScores = 10})". I don't know where to put this line of code. Currently I put it in game.lua, so that it will initial a score table of 10 when I start playing.

But every time the game.lua is loaded, this line of code setups a new high score table again, removing the previous high scores.

Therefore I'm thinking of how to make this code run only once for the whole game, so that even next time when I close the app & re-open it, the previous high scores are still there.

Another way is to modify the lime.lua so suits my application, ie - directly change lime.lua to have maxScores = 10 and I don't have to setup the maxScores in my .lua files. But I have no idea how to change it. Please help.

paskuniak
User offline. Last seen 7 weeks 22 hours ago. Offline
Joined: 21 May 2012

Thanks mate!