Forum QuickConnect Storing Data for simpleUsers?

Discussion and help relating to PlayerIO's QuickConnect feature, including Facebook Connect and Kongregate Connect.

Storing Data for simpleUsers?

Postby Normero » November 25th, 2010, 4:17 pm

Hello,

For my cardgame I'd like players to be able to login with a username and password.
I figured QuickConnect would be a convenient way.

But I don't get how I save data for these users.

I would like to save simple extras like experience, matches played, times won etc.

Can someone turn me into the right direction to do this?

Thanks. :D
Normero
 
Posts: 20
Joined: August 14th, 2010, 1:26 pm

Re: Storing Data for simpleUsers?

Postby Henrik » November 25th, 2010, 4:50 pm

You need to use BigDB, and if it's simple extras the easiest way to do it is to use the PlayerObject. There are two simple examples on that page that should get you started.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Storing Data for simpleUsers?

Postby Normero » November 25th, 2010, 5:15 pm

Thanks for the reply.

Is there a way to combine Simpleusers and bigDB?

I don't really get how the playerObject works, it isn't password protected, is it?

I'd like to have a user database with password protection, if the playerObject is, I just don;t get it and have to dig in deeper i guess :P
Normero
 
Posts: 20
Joined: August 14th, 2010, 1:26 pm

Re: Storing Data for simpleUsers?

Postby Henrik » November 25th, 2010, 5:45 pm

They are already "combined", i.e. you get a separate PlayerObject for each SimpleUser.

If you read a bit about BigDB you'll see that it consists of tables, objects with keys, and access rights. The most common usage is that you want to store some data for each user, users shouldn't be able to read or modify each others data, you need a table to store the objects in, you need a unique key for each user, and you typically want to load the object when a user logs in. The PlayerObject feature gives you just that as a convenience.

What you want to do is to use SimpleUsers for registering and logging in. That gives your players a username and password. When a player has logged in to your game, you get a Client object back that is tied to that player. On that Client object you can then call loadMyPlayerObject to get the PlayerObject that is tied to that user. On that database object you can then do the regular BigDB operations such as set, get and save to manipulate the data for that user.

Does that help?
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Storing Data for simpleUsers?

Postby Normero » November 25th, 2010, 5:57 pm

Yes yes, that helps a lot. Thank you!

I needed the part where you call the loadMyPlayerObject with the client object, I missed that.

Thanks alot!
Normero
 
Posts: 20
Joined: August 14th, 2010, 1:26 pm

Re: Storing Data for simpleUsers?

Postby Normero » November 30th, 2010, 2:05 pm

How do I retrieve someone's facebook name after loging in with facebookOAuthConnectPopup?

And someone's username after loging in with simpleConnect?
Normero
 
Posts: 20
Joined: August 14th, 2010, 1:26 pm

Re: Storing Data for simpleUsers?

Postby Oliver » December 2nd, 2010, 4:03 pm

You have to query the facebook platform for information about the current user, for instance you can use our AS3 graph API. Be warned though; the facebook platform is huge and complex and it takes time getting into it.

http://http://developers.facebook.com/
https://github.com/playerio/Facebook-Graph-As3

Best,
Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Storing Data for simpleUsers?

Postby Normero » December 2nd, 2010, 4:42 pm

Thanks for that. I might dig into the facebook API.

But how about retrieving someone's simpleUsername? Can I retrieve it somehow or do I have to make a name attribute in the BigDB for the players PlayerObject?

Thanks :D
Normero
 
Posts: 20
Joined: August 14th, 2010, 1:26 pm

Re: Storing Data for simpleUsers?

Postby Oliver » December 2nd, 2010, 4:56 pm

you can remove the prefix "simple" from the connectUserId
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Storing Data for simpleUsers?

Postby Normero » December 2nd, 2010, 5:22 pm

Sounds logic :p
Normero
 
Posts: 20
Joined: August 14th, 2010, 1:26 pm

Re: Storing Data for simpleUsers?

Postby Benjaminsen » December 3rd, 2010, 11:39 am

When you have initialized the FB api Oliver linked you can get information about yourself by this FQL query.
Code: Select all
FB.Data.query('SELECT uid, first_name,last_name, pic_small FROM user WHERE uid=me()' ).wait(function(rows:*) {
   for( var x:String in rows){
      trace(x, rows[x])
   }
})
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Storing Data for simpleUsers?

Postby Normero » December 3rd, 2010, 3:55 pm

Awesome, I'm going to try that then, thanks.

Got to give kudo's for being helped by 3 people in 1 topic :D
Normero
 
Posts: 20
Joined: August 14th, 2010, 1:26 pm

Re: Storing Data for simpleUsers?

Postby Normero » December 16th, 2010, 3:45 pm

Benjaminsen wrote:When you have initialized the FB api Oliver linked you can get information about yourself by this FQL query.
Code: Select all
FB.Data.query('SELECT uid, first_name,last_name, pic_small FROM user WHERE uid=me()' ).wait(function(rows:*) {
   for( var x:String in rows){
      trace(x, rows[x])
   }
})

When I execute this query I get this:

Code: Select all
FB: REST call result, method=fql.multiquery => {request_args=[{value="fql.multiquery", key="method"}, {value="c", key="callback"}, {value="{"v_0":"select uid,first_name,last_name,pic_small from user where uid=me()"}", key="queries"}, {value="json-strings", key="format"}, {value="114583408608649|2.jKgIESYrKR6THtmP1Mj0Qw__.3600.1292515200-670020629|ZdrtZflUB1JBOcUYnk2asZp1dPQ", key="access_token"}, {value="null", key="api_key"}], error_code="101", error_msg="Invalid API key"}


I tried some stuff But I really can't figure it out

What API key?
Normero
 
Posts: 20
Joined: August 14th, 2010, 1:26 pm

Re: Storing Data for simpleUsers?

Postby Benjaminsen » December 16th, 2010, 3:48 pm

Hey, the API key is your facebook API key (It needs to be defined by the code)

I suggest you watch this video toturial that shows how to configure the API and facebook
http://playerio.com/showcase/seedlings-sitebox-example/

/Chris
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Storing Data for simpleUsers?

Postby Normero » December 16th, 2010, 3:56 pm

Ok, I'll do that, thanks.
Normero
 
Posts: 20
Joined: August 14th, 2010, 1:26 pm


Return to QuickConnect



cron