OpenFeint

OpenFeint is a 3rd party library that enables social gaming features such as public leaderboards and achievements. For more information, see http://www.openfeint.com/ and http://www.openfeint.com/developers.

  • This API is experimental and subject to change, since OpenFeint is currently evolving, and Apple’s Game Center has recently been announced.
  • In the current alpha, this feature is iOS-only, since OpenFeint is not available for Android.
  • There is no simulator support for this feature, since OpenFeint is not available for MacOS.

Corona uses OpenFeint version 2.7.2.

For examples of basic OpenFeint integration, see the “OpenFeint landscape” and “OpenFeint portrait” sample projects (these must be built for iPhone or iPad).

OpenFeint API

This line makes the OpenFeint features available under the “openfeint” namespace:

openfeint = require "openfeint"
openfeint.init( "<OpenFeint Product Key>", "<OpenFeint Product Secret>", "Display Name" )

Initializes an app with the specified product key, secret, and display name. This should only be called once, as early as possible.

openfeint.launchDashboard()

Launches the OpenFeint dashboard.

openfeint.launchDashboard("leaderboards")

Opens the user's Leaderboards dashboard.

openfeint.launchDashboard("challenges")

Opens the user's Challenges dashboard.

openfeint.launchDashboard("achievements")

Opens the user's Achievements dashboard.

openfeint.launchDashboard("friends")

Opens the user's Friends dashboard.

openfeint.launchDashboard("playing")

Opens the user's Playing dashboard.

openfeint.launchDashboard("highscore")

Opens the user's High Score dashboard.

openfeint.launchDashboardWithListLeaderboardsPage()

Deprecated. Use openfeint.launchDashboard("leaderboards").

openfeint.launchDashboardWithChallengesPage()

Deprecated. Use openfeint.launchDashboard("challenges")

openfeint.launchDashboardWithAchievementsPage()

Deprecated. Use openfeint.launchDashboard("achievements")

openfeint.launchDashboardWithFindFriendsPage()

Deprecated. Use openfeint.launchDashboard("friends")

openfeint.launchDashboardWithWhosPlayingPage()

Deprecated. Use openfeint.launchDashboard("playing")

openfeint.unlockAchievement( achievementId )

Unlocks the specified achievement.

openfeint.setHighScore( { leaderboardID=ID, score=highScore [, displayText=displayString] } )

Sets the user's high score. You can optionally specify a text string to display in place of the actual numeric high score on OpenFeint dashboards.

The function takes a table as parameter with the following elements:

  • leaderboardID: String. The ID of the OpenFeint leaderboard where the high score should be posted.
  • score: Number. The new high score value to post to the specified leaderboard.
  • displayText: String. An optional string to display in place of the numeric score specified by the value assigned to the score parameter.

An example of using setHighScore follows:

1
openfeint.setHighScore( { leaderboardID="abc123", score=82342, displayText="82,342 pts" } )
openfeint.setHighScore( leaderboardId, score )

Deprecated. Use the setHighScore parameter form described above instead.

Network Save Card

You can now save arbitrary blobs of game data in the cloud, using OpenFeint's "Network Save Card":
local downloadListener = function(event) 
    print(event.name .. " => '" .. event.blob .. "' downloaded") 
    return true 
end
 
openfeint.uploadBlob( blobKey, "some blob data" )
openfeint.downloadBlob( blobKey, downloadListener )

The blobKey is a string key to identify what data to store. The blob data is any lstring up to the length that OpenFeint allows.

The download listener will be invoked when the download finishes. If the blob's length is 0, then the download did not succeed.

Replies

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
amigoni
User offline. Last seen 5 weeks 13 hours ago. Offline
Joined: 12 Aug 2010

Is display name the same as app name?

fdi777's picture
fdi777
User offline. Last seen 38 weeks 1 day ago. Offline
Joined: 13 Apr 2010

Pressing close ubtton gives black screen.

When continue for the first time, status bar shows up again.

horacebury's picture
horacebury
User offline. Last seen 2 hours 26 min ago. Offline
Joined: 17 Aug 2010

openfeint.launchDashboard("highscore") does nothing.

jonbeebe
User offline. Last seen 1 week 6 days ago. Offline
Joined: 26 Jul 2010

Using Game Edition 2010.109:

Ansca engineers may want to look into this one, using this function:

openfeint.setHighScore()

It didn't work for me when I had the displayText property set. It's optional, so when I ommited it, everything worked fine.

Also, is there an estimate timeframe when the next version of Game Edition will be released because my game is in need of Achievements, which are broken in 2010.109

-Thanks

Tim
User offline. Last seen 1 year 5 weeks ago. Offline
Alumni
Joined: 12 Aug 2010

Hi everyone,

@amigoni - The display name is the string displayed by the OpenFeint user interface that is included in your compiled app. It can be any name you want.

@fdi777 - Which close button are you referring to? Can you provide some more information? thanks.

@horacebury - Try passing the leaderboard ID in your call, like this:

1
openfeint.launchDashboard( "highscore", { leaderboardID = yourID } )

Our docs do not indicate this parameter is necessary, and I will be sure to fix that up, thank you.

@jon -- The issue with setHighScore() not working with displayText was an issue that we found before the 2010.109 release and is/was, presumably, fixed. I just tried using setHighScore() w/displayText in the same build and it worked as expected, so I'm a little puzzled. Here's the test code that I'm using (requires ui.lua in your project folder and a single button image).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
local ui = require("ui")
require "openfeint"
 
local app_key = ""
local app_secret = ""    
local display_name = "Your App Name"
 
openfeint.init( app_key, app_secret, display_name)                                                   
 
local newAPIDisplayText = function (event)
        local newscore = os.time()                                                  
        local displayScore = tostring(newscore) .. " Points"
--      print("Setting high score = " .. newscore)
--      print("Display text  = " .. displayScore)
        openfeint.setHighScore( {leaderboardID="313263", score=newscore, displayText=displayScore} )
end
 
 
local button2 = ui.newButton{
        default = "buttonBlue.png",
        id = "setHighScore",
        text = "setHighScore() w/displayText",
        size = 12,
        onRelease = newAPIDisplayText
}          
 
button2.x = display.contentWidth / 2
button2.y = 100
                                

jonbeebe
User offline. Last seen 1 week 6 days ago. Offline
Joined: 26 Jul 2010

@Tim: I'll try again, thanks. The reason I said it wasn't working was because nothing happened when I had displayText set, and when I took it off, it immediately started updating my scores. Perhaps OF was delayed at the time I tested with displayText.

horacebury's problem is strange to me because my code was working fine without the leaderboardID parameter set, maybe I'll put that in my code for just-in-case purposes.

jonbeebe
User offline. Last seen 1 week 6 days ago. Offline
Joined: 26 Jul 2010

@Tim: I found out what I was doing wrong. For future reference, and for anyone else reading, this is what I did wrong:

I modified the string within the table like so (didnt work):

1
openfeint.setHighScore( {leaderboardID="313263", score=newscore, displayText="Level " .. newscore } )

When I stored it in a variable first, and then passed the parameter, everything worked fine:

1
2
local displayScore = "Level " .. newscore
openfeint.setHighScore( {leaderboardID="313263", score=newscore, displayText=displayScore} )

Tim
User offline. Last seen 1 year 5 weeks ago. Offline
Alumni
Joined: 12 Aug 2010

@Jon, glad to hear you figured it out. I filed a bug to get this fixed (case 1689).

fdi777's picture
fdi777
User offline. Last seen 38 weeks 1 day ago. Offline
Joined: 13 Apr 2010

Hello, the close button I was referring to is the close button inside the open feint drop downs.

It was a problem related to my own code hiding everything after calling open feint.

However, unlockAchievement() in the new game edition version is definitely problematic. I have tried everything for a week now and it crashes everytime it is called if compiled using the latest game edition.

Exact issue can be found @ http://developer.anscamobile.com/issues/2658

Tim
User offline. Last seen 1 year 5 weeks ago. Offline
Alumni
Joined: 12 Aug 2010

Thank you for the bug report and comments, and apologies for the inconveniences this issue is causing. We are looking into this right away.

Tim

finnk
User offline. Last seen 15 weeks 19 hours ago. Offline
Joined: 5 Nov 2010

Can't get openFeint to work in device/xcode builds in the newest version of Corona (243).

Simply attempting to initiate openFeint will make device builds not work properly. Removing it makes the app work as normal.

edit:
Okay, seems there's a new parameter that needs to be included.

yuewah
User offline. Last seen 22 weeks 6 days ago. Offline
Joined: 4 Dec 2010

Does Corona support OpenFeint offline mode ?

MauricioM
User offline. Last seen 23 weeks 1 day ago. Offline
Joined: 26 Sep 2010

Does Corona support OpenFeint offline mode????
Are you planning on support it???

rhalferty
User offline. Last seen 5 weeks 3 days ago. Offline
Joined: 24 Jan 2011

Are there plans to make this support in Android? I know the Android build is relatively recent, but openfeint now supports Android.

Thanks

Edit: I got some sort of response saying look at http://www.openfeint.com/ and http://www.openfeint.com/developers. I understand it's a third party product, but I have no Idea how to include it into the build process if I have no insight into that. Is there a way to include an external jar in Android builds?

superfungames
User offline. Last seen 4 weeks 6 days ago. Offline
Joined: 17 Dec 2010

I'm trying to store the openfeint username into a variable in order to implement it into pubnub but I can't seem to find a way. Any ideas?

brucemartin's picture
brucemartin
User offline. Last seen 28 min 51 sec ago. Offline
Joined: 20 Jan 2011

I'm finishing my first iOS game with the awesome Corona SDK, and now I'm trying to add OpenFeint. I am not a gamer, just an old-time programmer, so I'm having some trouble understanding the idea of OpenFeint. I just added the code yesterday, and it seems to be working. But here are some questions.

For instance, it seems that only the device is considered a player, and it is registering the highscores. If husband and wife are sharing an iPod touch for game playing, how do they maintain separate leaderboards? I don't see any sign-in to identify different users on the same device.

When I call openfeint.launchDashboard("leaderboards"), it tells me that "This game is not recognized by Game Center.". Is that referring to Apple's game center? How do I prevent this if I'm not yet using Apple's game center?

And I get an alert message at the top of the screen that says "Welcome back player 12345678". Is there a way to change the number to a user's name?

Peach - I used your tutorials about OpenFeint to accomplish this. Thanks for that.

brucemartin's picture
brucemartin
User offline. Last seen 28 min 51 sec ago. Offline
Joined: 20 Jan 2011

Isn't always the way. Ask questions, and then you find the answers later yourself. After I relaxed and sat down with my iPad and game, I explored the OF dashboard and found out how to change my player name, how to add another player, etc, etc. I expect I'll continue to learn how to use it.

But I would still like to get rid of the Game Center prompt.

And here's a bug. When the dashboard first opens, the title bar at the top has both "Leaderboards" and my game's name superimposed. "Leaderboards" should not be there, the back button has "Leaderboards" on it.

Bruce

horacebury's picture
horacebury
User offline. Last seen 2 hours 26 min ago. Offline
Joined: 17 Aug 2010

I think you might find that it's being opened twice. I had a similar issue where I was opening the leaderboard in a touch event handler, but not waiting for the ended event, so it got called at least twice. There's no filter on the OF control to stop it showing if it's already open...

https://developer.anscamobile.com/forum/2011/03/10/open-feint-display-broken#comment-27175

brucemartin's picture
brucemartin
User offline. Last seen 28 min 51 sec ago. Offline
Joined: 20 Jan 2011

Yes, you are correct. That correction fixed it. Thanks.

mantic1's picture
mantic1
User offline. Last seen 1 day 7 hours ago. Offline
Joined: 20 Jan 2011

Any chance OpenFeint 2.10 could get in there? There has been a ton of bug fixes on their part since 2.7.2.

http://support.openfeint.com/dev/readme-for-openfeint-ios-sdk-2-10/

Especially in connection with Game Center. I'm trying to submit to apple now, but they keep coming back saying "Your app is game center enabled, but you haven't finished implementing game center..." As far as I can tell, it isn't game center enabled, and I'm stuck. :(

makelvin
User offline. Last seen 5 weeks 3 days ago. Offline
Joined: 17 Jan 2011

When OpenFeint is used the first time using the openfeint.init(), the orientation of the Enable OpenFeint dialog box is displayed incorrectly if the app is using landscape mode. It seems as though the dialog is trying to use portrait even though the app is using landscape.

I thought I did something wrong with my code; but it turns out if I try to use the sample code for OpenFeint in landscape that came with Corona SDK the same thing happens as well. So there is clearly something wrong with OpenFeint module during its init() operation.

matt22
User offline. Last seen 31 weeks 5 days ago. Offline
Joined: 6 Apr 2011

I have the exact same problem, my game is in landscape but the enable screen seems to be landscape size but stuck in a portrait orientation

jonathanbeebe's picture
jonathanbeebe
User offline. Last seen 12 hours 13 min ago. Offline
Staff
Joined: 12 Apr 2011

@makelevin: Please enter the issue you're experiencing (with full details, etc.) in the bug base so this can be sure to get fixed in a later release. Thanks!

http://bugs.anscamobile.com/

Grimpops
User offline. Last seen 14 weeks 4 days ago. Offline
Joined: 27 Jan 2011

I've just looked up this article to get openfeint in my game and ran into trouble. Might be worth changing the doc to include Client Application ID which is also required to initiate open feint.

personalnadir
User offline. Last seen 1 week 5 days ago. Offline
Joined: 24 Nov 2010

I'm having issues where the init function seems to require 4 parameters as opposed to the three mentioned

sunny_y_m
User offline. Last seen 7 weeks 6 days ago. Offline
Joined: 29 Jan 2011

How can I start a new challenge?
I used openfeint.launchDashboard("challenges"),but it just show me the challenge history,and told me "You don't have any pending challenges for XXX".I just want to start a new challenge with friends.How should I do?

lnjuanj's picture
lnjuanj
User offline. Last seen 5 weeks 5 days ago. Offline
Joined: 29 May 2011

Hi!
When I run Corona, it says:
WARNING: openfeint.init() is deprecated. Use gameNetwork.init() instead.
WARNING: gameNetwork.init() is not supported in simulator.
WARNING: openfeint.launchDashboard() is deprecated. Use gameNetwork.show() instead.

So I would say the info in this page should be updated to reflect the new functionality.

I write here what I think is the new way of invoking game network.

local gameNetwork = require "gameNetwork"
gameNetwork.init ("openfeint",of_product_key, of_product_secret, display_name, of_app_id)
gameNetwork.show ()

sheraz.jamshed's picture
sheraz.jamshed
User offline. Last seen 1 day 6 hours ago. Offline
Joined: 15 Jun 2011

I purchased Corona a day before as my game was almost complete. I thought there is pretty easy tutorial to integrate OpenFeint but when It started giving me errors like

WARNING: openfeint.init() is deprecated. Use gameNetwork.init() instead.
WARNING: openfeint.launchDashboard() is deprecated. Use gameNetwork.show() instead.

Then I used the API as linked here:
http://developer.anscamobile.com/reference/index/game-network

But the app screen calling gamenetwork code gives this error :

This application has been corrupted".

I thought paying CORONA would make my life easy. but totally got the opposite.

Regards

Sheraz Jamshed

carlos.varela.com's picture
carlos.varela.com
User offline. Last seen 2 weeks 3 days ago. Offline
Joined: 24 Aug 2010

Today I did received this email from Openfeint:

Important announcement to all OpenFeint developer partners - please check to make sure you have integrated the new iOS SDK 2.12.5, in order to avoid rejection during the Apple app review process.

It was recently discovered that our "updateBadge" symbol coincided with an internal symbol that Apple began filtering this week from app store submissions. OpenFeint no longer needs this symbol, and has therefore removed it from our latest iOS SDK, 2.12.5.

We encourage developers to either use the newest version, iOS SDK 2.12.5, available now on our download page, or to remove the 4 lines of text from previous versions of the iOS SDK before submitting to Apple.

Resources:
SDK 2.12.5 Download -- http://www.openfeint.com/source_code?version=2.12.5
SDK 2.12.5 Readme -- http://support.openfeint.com/dev/readme-for-openfeint-ios-sdk-2-12-5/
Manual code removal from previous versions of the iOS SDK -- http://support.openfeint.com/dev/updatebadge/

This page says "Corona uses OpenFeint version 2.7.2."

Somebody nows something about this?
Are we affected in our last daily builds?

Regards,

Varela

sbritton
User offline. Last seen 1 week 14 hours ago. Offline
Joined: 19 Sep 2009

Checking the daily builds summary - it looks like this is addressed in v 2011.678.

Presuming we will need to use 2011.678 or higher when submitting apps using openfeint features from here out?

crssmn's picture
crssmn
User offline. Last seen 1 hour 8 min ago. Offline
Joined: 2 Nov 2010

Ansca should update these docs.

y.sravankumar's picture
y.sravankumar
User offline. Last seen 4 hours 54 min ago. Offline
Joined: 13 Oct 2011

since OpenFeint is available on Android also, does Corona supports OpenFeint on android? or still only on iOS?

SteveK
User offline. Last seen 2 hours 42 min ago. Offline
Joined: 4 Feb 2010

y.sravankumar,

Buried in the release notes for 2011.557 (June 30, 2011) is the following:
"Android: Added OpenFeint and "gameNetwork" support."

I missed it too, but started seeing comments elsewhere that implied Android support so I went looking for confirmation.

- Stephen
Kigra Software