0
\$\begingroup\$

I am developing a game in which I want to make a scoring system where the global high score is stored and shared by all players.

I am using Flash and ActionScript 3. Until now I've used SharedObject.getLocal("savename") for saving score individualy but I cant figure out the way to store a common high score for all players.

\$\endgroup\$
  • \$\begingroup\$ Could you explain what you mean by "all players"? Do you mean everyone who's played that specific copy of the game, or all players of the game in all physical locations? Just because the answer is very different in each case \$\endgroup\$ – jhocking Jun 20 '14 at 15:07
  • \$\begingroup\$ @jhocking i mean everyone who have played the game .in his browser when he opens the game he can find the highest score gained by any player \$\endgroup\$ – user3536228 Jun 20 '14 at 15:09
  • \$\begingroup\$ That's... actually still not addressing my question. I'm going to assume you mean "all players in all physical locations", but "in his browser" could mean multiple people using the same computer. \$\endgroup\$ – jhocking Jun 20 '14 at 15:13
1
\$\begingroup\$

You need to store the high score in some kind of shared persistent storage, either one you provide yourself or one provided by the portal hosting your game (if you are going that route, you'll want to consult their developer documentation; for example Kongregate's documentation on their leaderboards et cetera is here).

If you provide this yourself, you typically use a file or a database. There are projects, such as assql, that provide a mechanism to connect to SQL storage (in this case, MySQL) from ActionScript. You can also use ActionScript's methods for working with external data to hit a URL that is backed by a simply PHP script on your server which talks to a database on the server and recovers the high score. There are a surprising number of tutorials and posts about this scattered around the web, for example, this one.

The advantage to the PHP-based approach is that it puts all your database access on the server, rather than connecting to a DB directly from the client, which helps isolate you from a whole host of problems. You will of course want to further lock this down and make sure that users cannot submit bogus high scores simply by hitting, for example http://example.org/submitscore?score=99999999999.

\$\endgroup\$
0
\$\begingroup\$

You're going to need some sort of external server for the players to connect to over the internet. SharedObject means "shared between instances on this computer", but players on other computers have no access to this information.

You could do this with your own highscore server, but there are also third-parties that take care of this. I'm no longer familiar with what all is available; I know Mochi used to have a highscore server you could use but I don't know if that is still the case. You could also use the highscore API provided by Kongregate if you publish your game there.

\$\endgroup\$
  • \$\begingroup\$ yes i am uploading to kongregate but how to use their API \$\endgroup\$ – user3536228 Jun 20 '14 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.