Hello,
Can anyone give me an advise about a tool that allows me to enable social features into my game?
I want a tool like OpenFeint. But I prefer that have a C++ API.
Thanks!
Hello,
Can anyone give me an advise about a tool that allows me to enable social features into my game?
I want a tool like OpenFeint. But I prefer that have a C++ API.
Thanks!
If you’re on ios, that’s easy to invoke OpenFeint objc interface from .mm file, you can reference to “how to play video in cocos2d-x games”, google these keywords or find it on this forum.
If you’re on android, you had to invoke OpenFeint from JNI layer, several works to do.
I think that I can use web access to OpenFeint.
See: http://support.openfeint.com/dev/openfeint-restful-api-settings/
What do you think?
I find a company that have this service totally free:
http://gammeta.com/
http://gamecloudservices.com
I can use this through a C API
http://d1wuntg2qcl80h.cloudfront.net/SLS-Dev-Guide-2010-09-01.pdf
http://code.google.com/p/ggc-sdk/
Awksome.
First you need to add ggc-sdk to your project.
Then to add Gammeta to your game:
extern “C”
{
#include “ggc.h”
#include “utils.h”
}
To send score to Gammeta:
const char* game_id = “853245345345729”;
const char* test_key = faGefShrHSasJMohClh2UFT1kE“;
const char* player = pTextField->getString();
const char* email =”gamer@gmail.com“;
unsigned int points = score;
char player_hash[32] = {0};
char salt_source[255] = {0};
sha1_base64(email, player_hash);
sprintf(salt_source,”s\nu\n%s“, player, points, player_hash);
ggc_init(&context, GGC_SERVICE_SLS, game_id);
{
ggc_set_headers(&context,”SDK/C“, test_key, salt_source, TRUE);
ggc_sls_submit_score_simple(
&context,
player,
player_hash,
points);
}
ggc_cleanup(&context);
To get sorted list of scores:
const char* game_id =”853245345345729“;
const char* test_key = faGefShrHSasJMohClh2UFT1kE”;
json_object_t* json_result;
GGC_CTX context;
ggc_init(&context, GGC_SERVICE_SLS, game_id);
{
ggc_set_headers(&context, “SDK/C”, test_key, NULL, TRUE);
json_result = ggc_sls_get_world_scores(&context);
json_object_put(json_result);
}
ggc_cleanup(&context);
Result of get_world_scores:
[ { AchievedAt “2011-06-12 12:44:03Z”, CountryCode “EC”, PlayerHash “h6w\/lzj\/lv6efqltxcyj68hnc6y=”, PlayerName “gorgak”, Points 8646, Region “Azuay”, Tags [ “UserAgent:SDK\/C” ], WorldRank 1 },
{ AchievedAt “2011-06-12 12:29:51Z”, CountryCode “EC”, PlayerHash “h6w\/lzj\/lv6efqltxcyj68hnc6y=”, PlayerName “quicroller”, Points 6257, Region “Azuay”, Tags [ “UserAgent:SDK\/C” ], WorldRank 2 },
{ AchievedAt “2011-06-12 00:52:55Z”, CountryCode “EC”, PlayerHash “h6w\/lzj\/lv6efqltxcyj68hnc6y=”, PlayerName “martin”, Points 828, Region “Azuay”, Tags [ “UserAgent:SDK\/C” ], WorldRank 3 },
{ AchievedAt “2011-06-12 12:20:25Z”, CountryCode “EC”, PlayerHash “h6w\/lzj\/lv6efqltxcyj68hnc6y=”, PlayerName “perillita”, Points 753, Region “Azuay”, Tags [ “UserAgent:SDK\/C” ], WorldRank 4 },
{ AchievedAt “2011-06-12 00:48:12Z”, CountryCode “EC”, PlayerHash “h6w\/lzj\/lv6efqltxcyj68hnc6y=”, PlayerName “buchito”, Points 750, Region “Azuay”, Tags [ “UserAgent:SDK\/C” ], WorldRank 5 },
{ AchievedAt “2011-06-12 13:09:24Z”, CountryCode “EC”, PlayerHash “h6w\/lzj\/lv6efqltxcyj68hnc6y=”, PlayerName “buche_plumas”, Points 349, Region “Azuay”, Tags [ “UserAgent:SDK\/C” ], WorldRank 6 },
{ AchievedAt “2011-06-12 12:15:37Z”, CountryCode “EC”, PlayerHash “h6w\/lzj\/lv6efqltxcyj68hnc6y=”, PlayerName “grafeno”, Points 71, Region “Azuay”, Tags [ “UserAgent:SDK\/C” ], WorldRank 7 } ]
As you can see Gammeta save your Country, Region, Tags, Player name, Points, WorldRank, and optionally your geolocation.
Fun with Gammeta!
PD: this post is to use Gammeta on test mode, to use on live mode you need a SLS subscription, use your live key and set FALSE on ggc_set_headers
ggc_set_headers(&context, “SDK/C”, test_key, NULL, FALSE);
On windows and android for use live mode you need to change, because libcurl cocos2d-x integrated library seems dont have zlib support
#define LIBCURL_HAS_GZIP 1
to
#define LIBCURL_HAS_GZIP 0
Awesome! Thanks Diego!
I’m getting ready to launch Gammeta in public beta in a few weeks. Working on a brand new website, which is why the old one is down for the moment. Stay tuned!
kgriffs
gammeta
oh my god, the author of Gammeta appears here, cool! #CCHandshake