Ana səhifə

Tracking Stats for Individual Players


Yüklə 12.93 Kb.
tarix12.06.2016
ölçüsü12.93 Kb.

Tracking Stats for Individual Players
Version 1.0
Monday, October 09, 2000

Overview
There are two GameSpy SDKs that provide long-term game data storage. These are the Stats and Tracking SDK and the Persistent Storage SDK. The Stats and Tracking SDK allows the statistics and results of games to be stored, possibly for use in rankings, ladders, or tournaments. The Persistent Storage SDK allows any binary or ASCII data to be stored with any player profile. The player accounts/profiles used by both of these SDKs are managed by the Presence and Messaging SDK.


The accounts used by the Presence and Messaging SDK, which allow data to be tracked per-player, are designated by the combination of an e-mail address, password, and nickname. Each e-mail address represents a “user”, and there is a password associated with that user. Each user then has one or more nicknames associated with it. Each nickname represents one of the user’s “profiles”. There is an ID for every profile that is unique across the entire account system, called the Profile ID (or pid). So if a game wants to track data for a player, it must first determine the correct pid, using an e-mail address and nickname. This can be done using the Presence and Messaging SDK. Then, it can authenticate the player using the pid and the password for that user. Alternatively, games launched by GameSpy Arcade can have the pid and password (and other info, such as nick or e-mail) passed in as command-line parameters. The accounts that are used are shared between GameSpy Arcade and all games using the Presence and Messaging SDK.

Accounts
The accounts used by the Presence and Messaging SDK (GP), typically referred to as “GameSpy Arcade accounts”, are made up of users and profiles. A user is identified with a unique e-mail address – no two user accounts can have the same one. There is also a password associated with the user. The user then has one or more nicknames, each identifying one of that user’s profiles. The nicknames do not need to be unique across the whole system, they only need to be unique for that user. In other words, multiple users can each have a profile with the nickname “Bob”, but one user cannot have two profiles both named “Bob”. Each user has a unique User ID associated with it, and each profile has a unique Profile ID (pid) associated with it. GP can be used to create users and profiles, and to get a pid for a given e-mail address, nickname, and password. Account management can also be left to GameSpy Arcade, which uses the same account system and can pass the pid, e-mail, nick, password, or any other account info, to any games it launches.



Creating an Account


Before creating an account, you must first initialize GP. This is done with the gpInitialize function. After initializing GP, you can now create a new account with the gpNewUser function. The function takes a nickname, e-mail address, and password. It then creates a user with the given e-mail and password, and creates a profile for that user with the given nickname. If the e-mail identifies an existing user, and the password is correct, then the function will create a new profile for that user with the given nickname. The function is called like this:
result = gpNewUser(connection, nick, email, password, GP_BLOCKING, ConnectResponse, NULL);
Because GP_BLOCKING was passed in, this function will not return until the attempt to create the new user finished. On completion, the ConnectResponse callback will be called, with a pointer to a GPNewUserResponseArg passed in as the arg. If the result member of the arg is GP_NO_ERROR, then the profile member of the arg is the pid for the new user. If result is anything else, then there was an error creating the new user. The actual error code can be checked with gpGetErrorCode.

One possible error code is GP_NEWUSER_BAD_PASSWORD, which indicates the e-mail address provided is already in use by a user account, but the password provided is not that user’s password. This could result for a mistyped password, a forgotten password, or if the user is trying to use an e-mail address that’s already in use. In this situation, the user should be able to retype the password. There can also be an option to have the password for that user mailed to the e-mail address. To have the password mailed, just open the URL:

http://gamespyarcade.com/software/reqemail.asp?email=user@company.com

replacing the “user@company.com” with the correct e-mail address. If the e-mail address matches up with a user account, that account’s password will be sent to the address. This call can be made using GameSpy’s HTTP SDK.

The other error code is GP_NEWUSER_BAD_NICK, which is the result when the user tries to create a profile that already exists. In this case, the profile member of the GPConnectResponseArg passed into the callback contains the pid of the existing profile. The application can give the user the option of using the existing profile or creating a new one by calling gpNewUser with a different nick.

Getting the Profile ID for a nick, e-mail, and password


The Stats and Tracking SDK and the Persistent Storage SDK both use a pid to identify each player. So unless the pid is passed in on launch by GameSpy Arcade, then it is necessary to get it from the player’s nick, e-mail address, and password. This can be done with the GP call gpCheckUser:
result = gpCheckUser(connection, nick, email, password, GP_BLOCKING, ConnectResponse, NULL);
The password is optional for this function. If a password is passed to the function, it will be checked, but if no password is provided, then just the e-mail and nick will be checked.

Because GP_BLOCKING was passed in, this function will not return until the attempt to login has finished. On completion, the ConnectResponse callback will be called, with a pointer to a GPCheckResponseArg passed in as the arg. If the result member of the arg is GP_NO_ERROR, then the profile member of the arg is the pid for the user. If result is anything else, then there was an error logging in the user. The actual error code can be checked with gpGetErrorCode.

One possible error code is GP_CHECK_BAD_EMAIL. This is the result when the e-mail address does not match any existing user accounts. In this case, the user may have mistyped the e-mail address, or they may have never actually created an account.

Another error code is GP_CHECK_BAD_PASSWORD. This results if the e-mail address identifies a user account, but the password does not match that account’s password. This could be because the user mistyped the password or because the user forgot the password. In this case, the password can be e-mailed to the user by opening the URL:

http://gamespyarcade.com/software/reqemail.asp?email=user@company.com

replacing the “user@company.com” with the correct e-mail address. If the e-mail address matches up with a user account, that account’s password will be sent to the address. This call can be made using GameSpy’s HTTP SDK.

The other possible error code is GP_CHECK_BAD_NICK. This error is generated if the e-mail and password match up with a user account, but the nick does not match any of that user’s profiles. If this happens, the gpGetUserNicks function can be used to get a list of that user account’s nicknames.


Page

Copyright 2000 GameSpy Industries, Inc.

Please send questions and comments to wrightd@gamespy.com

Updated documentation may be available at http://developer.gamespy.com




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©kagiz.org 2016
rəhbərliyinə müraciət