Game Development Community

Scoreloop and OpenFeint

by Ronald Ian Bantayan · in iTorque 2D · 07/30/2009 (1:24 pm) · 84 replies

these are third party (and free) services that provide achievements and other functions like chatroom integration and such on top of your app. i'm experimenting with these products to see if i could add global and cumulative achievements to my games. it would be interesting to hear what other iTGB devs have to say about this.

http://www.scoreloop.com/
http://www.openfeint.com/
#41
08/05/2009 (2:13 am)
Why oh why do programmers always need to be sarcastic and dramatic :P

I'm aware that most engines have bugs and problems.
But I guess iTGB is the so far most "target platform not meeting" tech I've used as even trivial iphone optimizations aren't there or actively killed by antioptimizations (like the each particle / each tile is an own vertex buffer, flooding the poor iphone OpenGL ES driver and thus cpu to dead, and that although 1. the apple optimization guidelines clearly point out what to do and what not and 2. the iphone supports even interleaved *think they were called that way* arrays to store vertex, tri, color, ... all in a single array to raise the performance)
Thats at least to me a significant difference to a bug, which is commonly something that just does not do what it should or at least not does it in the context one has tried to use it. That such things often require the users hand is out of question, thats how working with 3rd party tech just is :)
Lazyness (ie not doing your own) has its tradeoff, but if you were able to dev your own you commonly are also able to stretch the tradeoffs :)

At least with iTGB it should definitely be doable for some of the things

#42
08/05/2009 (1:36 pm)
Guys, regarding Apple rejecting apps with OpenFeint chat integrated for having 'mature content'... I just heard that they censored a dictionary. A dictionary. Think about that for a minute.
#43
08/05/2009 (1:57 pm)
Sure, they've rejected apps because you can potentially get the Kama Sutra text edition (a very dry book, by the way - it's not the pictorial guide seen inside Indian temples).
#44
08/05/2009 (2:53 pm)
So if the #ifndef TORQUE_DISABLE_MEMORY_MANAGER code is added will OpenFeint drop in work with the latest version of GCC? I'm thinking of adding OpenFeint, but I'm a little leery of starting down that path at this point if it is going to take a lot of effort.

I had heard of a Bird Call app that had a link to wikipedia about each of the different birds and that because of that link were told they had to select has frequent and intense sexual scenes.
#45
08/05/2009 (7:39 pm)
ifndef ... is the same as not adding it as any optimized iphone build HAS the memory manager disabled (you never would ship an app with it enabled ...)
#46
08/07/2009 (4:18 pm)
Ok guys, I started to integrate Scoreloop into my project just a short while go. Scoreloop seems to be very intelligently written imo, it has been an absolute breeze to integrate thus far. If you're an ok programmer you'll have no problem in getting it up and running.

Im away for the weekend and have a busy week both work wise and personally coming up, so I don't know when I'll be able to get instructions typed up etc - but I will do it when I find the time!
#47
08/07/2009 (10:58 pm)
good to hear. it's better if we had a resource up on TDN, rather than every programmer having to figure out how to integrate.
#48
09/01/2009 (6:38 pm)
I just got OpenFeint integrated into Buggle and it wasn't too hard.

www.topm.com/iPhone/buggle/of.jpg

To get it to link I had to make the change mentioned above to iPhoneMemory.mm:

#ifndef TORQUE_DISABLE_MEMORY_MANAGER
void* FN_CDECL operator new(dsize_t dt, void* ptr)
{
   return (ptr);
}   
#else
#include <new.h>
#endif

I was using landscape mode one thing that was different from a normal call to the open feint init was I needed to pass in settings. I also wanted to disable chat which I set in the settings also. Here is the code snippet (without my actual product keys and secret) that I'm using for passing in non-default settings:

_iPhoneRunTorqueMain( self, window, application );


	NSString *productKey = @"abcdefghijkl";
	NSString *secret = @"abc123457abc12345abc";
	NSString *displayName = @"Buggle";

	NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys:
							  [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight], OpenFeintSettingDashboardOrientation,
							  [NSNumber numberWithBool:YES], OpenFeintSettingDisableChat,
							  nil
	];
	
	[OpenFeint initializeWithProductKey:productKey
							  andSecret:secret
						 andDisplayName:displayName
							andSettings:settings
						   andDelegates:nil];


Notice that I'm making the OpenFeint call after the _iPhoneRunTorqueMain(...) call.
#49
09/01/2009 (9:58 pm)
perhaps we have different iTGB 1.2 because if I try to do that or anything else equal to it I get a really long and non enjoyable list of functions at linktime that all do no longer work because they use the Torque New operator and can't work with this one. (including stuff like dglDrawTextN, t2dPhysics and t2dTextObject and many more)
The project is built against the 2.2.1 SDK, GCC 4.0 naturally with a build where the memory manager is disabled

So I guess you must have more than just this small modification that compensates for it or one of the setups for OpenFeint (-ObjC flag or the cxx setting) was not done which would lead iTGB into death


PS: it should be #include <new>
for standard libraries, the .h has been deprecated basically years ago.
#50
09/02/2009 (12:42 pm)
I'm using iTGB 1.1 - wouldn't think that would make a difference. I made the changes to project settings that they mentioned in the "Integrating the OpenFeint SDK" article on the OpenFeint site.

The only error I got was on "new" in iPhoneMemory.mm - then it almost compiled and linked. Got a link error that was fixed by unchecking "Compile for Thumb". Using GCC 4.0 and 2.something SDK (not on my Mac right now). I haven't made any changes to iTGB that should affect this.

One thing that I was surprised to discover was that "Compile for Thumb" was set in my project. I don't remember ever setting it and now I'm going to go back through my other game projects and see if it is set in them too. Could make frame rate higher in Balls Away! which using lots of floating point in the physics.

Anyway, Buggle is running with OpenFeint, uploading the high scores, unlocking achievements, and also now talking to facebook and posting notifications there.

I'm running landscape so I was able to remove the portrait OpenFeint stuff. The final zipped ready for submission to App Store file size went up roughly 1.5 Mb. So there is a file size cost to OpenFeint that could put people over the 10 Mb that you aim for.
#51
09/02/2009 (5:11 pm)
That's great. how do you control the achievements? did you make consoleMethod for these?
#52
09/02/2009 (7:09 pm)
The only errors I ever got when trying to add 3rd party libraries is the new and the functions that base on this hacked together new overload, which refuse to work with the official GCC new overload.

Compile for Thumb has been disabled since the day I reported that bug which is quite a long time ...
The only things I really changed otherwise on the project settings are those required to integrate openfeint sdk + the missing math optimization compiler flags that are missing by default.


Will have to see if there is anything else that might be required because thats totally fishy and more than just annoying and by now about the 4th time I approach the problem.

Who knows, perhaps some setting on the project or some ifdef / ifndef check changed between 1.1 and 1.2 that makes the difference.
#53
09/02/2009 (7:42 pm)
Here are my code snippets that launch the dashboard, submit top scores, and award achievements. The awardOfAchievement is a big ugly copy/paste if/else/if/else that I haven't cleaned up yet from testing to get things working, but it shows you how it works. That's not Buggle's real leaderboardId in there. You get the leaderboardIds and the achievement defines from the OpenFeint site:

#ifdef OPEN_FEINT
// dashboardType
// 0 		- normal dashboard
// 1 		- achievements page
// > 100    - leaderboard pages
void launchOpenFeintDashboard(S32 dashboardType)
{
	if (dashboardType == 0)
	   [OpenFeint launchDashboard];
	else if (dashboardType == 1)
	   [OpenFeint launchDashboardWithAchievementsPage];
	else if (dashboardType >= 100)
	{
	   NSString *leaderboardId = @"0123455";  // Buggle "Score" leaderboard
	   [OpenFeint launchDashboardWithHighscorePage:leaderboardId];
	}
}


void submitOfScore(S32 score, S32 leaderboardNum)
{
	NSString *leaderboardId = @"012345";  // Buggle "Score" leaderboard
	
	[OFHighScoreService setHighScore:score
					    forLeaderboard:leaderboardId
						onSuccess:OFDelegate()
						onFailure:OFDelegate()];
}

void awardOfAchievement(S32 awardedNum)
{
	if (awardedNum == 1)
		[OFAchievementService unlockAchievement:BUG_BUDDY];
    else if (awardedNum == 2)
		[OFAchievementService unlockAchievement:LONG_CHAIN];
    else if (awardedNum == 3)
		[OFAchievementService unlockAchievement:MULTI_GROUP];
    else if (awardedNum == 4)
		[OFAchievementService unlockAchievement:BUG_DEFENDER];
    else if (awardedNum == 5)
		[OFAchievementService unlockAchievement:BUG_BROTHERHOOD];
    else if (awardedNum == 6)
		[OFAchievementService unlockAchievement:DRESS_OF_DISTINCTION];
    else if (awardedNum == 7)
		[OFAchievementService unlockAchievement:NOT_DIZZY];
    else if (awardedNum == 8)
		[OFAchievementService unlockAchievement:HONEY_POT];
    else if (awardedNum == 9)
		[OFAchievementService unlockAchievement:SUPER_BUG];
    else if (awardedNum == 10)
		[OFAchievementService unlockAchievement:SPIDER_MASTER];
		
    else if (awardedNum == 11)
		[OFAchievementService unlockAchievement:x25000_POINTS];
    else if (awardedNum == 12)
		[OFAchievementService unlockAchievement:x50000_POINTS];
    else if (awardedNum == 13)
		[OFAchievementService unlockAchievement:x100000_POINTS];
    else if (awardedNum == 14)
		[OFAchievementService unlockAchievement:x250000_POINTS];
    else if (awardedNum == 15)
		[OFAchievementService unlockAchievement:HALF_MILLION];
    else if (awardedNum == 16)
		[OFAchievementService unlockAchievement:ONE_MILLION_SUPERSTAR];
}
#endif


And here are the ConsoleFunction to let torques scripts make the calls:

#ifdef OPEN_FEINT
ConsoleFunction(launchOpenFeintDashboard, void, 2, 2, "launchOpenFeintDashboard(leaderboardNum) "
				"launches the open feint dashboard")
{
    argc;

	launchOpenFeintDashboard( dAtoi(argv[1]) );
}

ConsoleFunction(awardOfAchievement, void, 2, 2, "awardOfAchievement(awardNum) "
				"awards the passed achievement")
{
    argc;

	awardOfAchievement( dAtoi(argv[1]) );
}
#endif
#54
09/02/2009 (7:43 pm)
For completeness let me add that I have the following headers at the top of the TGBAppDeleage.mm file:

#ifdef OPEN_FEINT
#import "OpenFeint.h"
#import "OFHighScoreService.h"
#import "OFHighScore.h"
#import "OFAchievementService.h"
#import "OFAchievement.h"
#import "OpenFeint+Dashboard.h"
#endif
#55
09/02/2009 (7:59 pm)
Thank Kevin,
That's very helpful.
#56
09/03/2009 (2:26 am)
Thanks for sharing Kevin. I'll give it a go soon myself.
#57
09/08/2009 (3:12 pm)
Sorry to hijack this thread. Before I push out the new release, I want to double check something about "compile for thumb". This is the most recent thread to discuss it, so I'm aiming here for the fastest answer.

I can no longer find the "compile for thumb" option in the Build settings. I do not want to ship the base projects/targets with this enabled, but it appears to be a deprecated option for 3.x and GCC 4.x.

I would love to know if this is the case, so this issue is not shipped (AGAIN) with the new release. Anyone able to locate it in the build settings?
#58
09/08/2009 (3:33 pm)
Both Project->Edit Project Settings and <target>->Get Info gives me an option window where Compile for Thumb is an available option (annoyingly defaulted to on) in Apple's templates and other source. I have seen cases where it only shows up in one of them.
#59
09/08/2009 (4:26 pm)
Are you on 10.6 Micheal?
Because XCode 3.2 is a bit differently organized than previous xcode and some stuff removed / bound to other settings.
#60
09/08/2009 (4:43 pm)
Xcode 3.2 is still showing it for me:
con.structive.net/thumb.png