Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / AGK Online High-Score Toolkit [alpha] (AGK to PHP+MySQL)

Author
Message
Daniel TGC
Retired Moderator
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 9th Nov 2012 21:05 Edited at: 10th Nov 2012 20:32
Update 10/11/2012


Download


I decided there wasn't really enough to this to be worth making into a commercial product so I've decided to release it for free.

Requirements

Shared web hosting or server with FTP/SFTP/SSH and HTTP access
PHP 5.2 or higher
phpMyAdmin
(you can preform local tests using WAMP, LAMP or MAMP server bundles)
Windows (to run the SSG program)
App Game Kit
Internet Access

Pack Includes

Copy of filezilla portable so you can upload your scripts
SSG.exe server script generator, this generates your config file
phpMyAdmin tutorial video showing how to populate tables
PHP scripts needed to write data to and from the database
AGK program example showing how to populate your database and retrieve back to your game.
Documentation showing how to use the toolkit.

Attachments

Login to view attachments
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 9th Nov 2012 21:38
An email has been sent.

Cheers,
Ancient Lady
AGK Community Tester
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 9th Nov 2012 22:23
Fantastic idea.
mr_d
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Mar 2007
Location: Somewhere In Australia
Posted: 10th Nov 2012 06:45
I'm sensing future competition - I was waiting for AppGameKit T1 to allow custom modules/libraries to expand my offering in this space, but this hasn't happened and may not for a quite a while...

Seriously; good idea and good luck!

Alain91
13
Years of Service
User Offline
Joined: 20th Aug 2011
Location: France
Posted: 10th Nov 2012 08:18
A very good news!

By the way, would you extend this to online multiplayer server ?
Daniel TGC
Retired Moderator
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 10th Nov 2012 20:31
There is zero chance of an online multiplayer server.

I'm releasing the project for free, just download it from the first message. I've tested it and it provides a reliable way of getting your game scores to your site.
Daniel TGC
Retired Moderator
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 11th Nov 2012 02:27
I don't think there's enough interest in this one to develop it further. So I'll just leave what I've created up on this forum and let it gently slide into obscurity onto my next project idea!
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 11th Nov 2012 03:46
Too late to look at this now, but I thank you for this in advance, as I am sure it will be very helpful. I have been struggling with this on and off for awhile, so will be very interested to see if I have more success with this now!

Jeku
Moderator
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Vancouver, British Columbia, Canada
Posted: 11th Nov 2012 10:05
I would be interested in looking at the code, but it seems weird to put it into a Setup executable. Simple having a code file should be good enough.


Senior Developer - CBS Interactive Music Group
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 11th Nov 2012 17:07
The setup creates some directories and installs a couple of apps. One app is a free FTP program and the other creates the file used that supplies information to the two other PHP files that give them access to the database that you set up on your site.

If you use the setup.exe file, don't run it when it finishes. The setup runs the configuration information gathering program. You need to create your database on your site so that you have the information to provide the program first (or at least know exactly what the database name, user name and password are and then use exactly that when you set up the database).

I went through the process and (after a couple of false starts), it all worked the way it was supposed to.

Cheers,
Ancient Lady
AGK Community Tester
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 13th Nov 2012 15:16
Well, I had a few hours wondering what I was doing wrong again, but I have finally got a highscore table working with this. I was using my web address for the host, which wasn't what I needed. Should have checked out the help on my site provider quicker lol.

Thanks for this, as I have been on and off trying to get something working several times with no success!

DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 15th Nov 2012 16:25
I am back. Just a couple of questions for those in the know.
First, after testing this today I have noticed that the sql database is larger than the limit size. Is this correct? If I had thousands of people use this would the database have thousands of entries? I have altered the limit of 9 up to 30, but perhaps I have misunderstood the php script.
Secondly, and this may be the problem with the first question. I deleted a few of the entries as I was getting some blank entries with my initial tests, via my webpage. So now a few id numbers are gone and not been replaced as I expected. So for example id 1, 10, ans 28 are now missing. Will this cause issues? I cannot seem to see a way to reset it without deleting and starting over. Which I can do, but if it makes no odds I may as well leave it.

I am mostly concerned with the potential database size at the moment. Is there a way to limit the amount it can store in the sql database without getting too complicated?

xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 15th Nov 2012 18:25
I haven't reviewed how this kit works closely as I created my own HTTP online scoring system for several games in the past. But I can try to help:

Quote: "First, after testing this today I have noticed that the sql database is larger than the limit size. Is this correct? If I had thousands of people use this would the database have thousands of entries? I have altered the limit of 9 up to 30, but perhaps I have misunderstood the php script."


The "LIMIT" portion of the query in PHP simply retrieves the top 10 from the list of all saved records (or whatever value is specified there). So, by changing that to 30 you will actually be fetching the top 30 results which would only be necessary if you are also displaying the top 30 scores in your game.

There are a few ways you can control how many records are created in your database. The most direct way is to simply compare the user's score to the lowest saved score in the online top 10 (or however many you are displaying) before making a call to save it. Only make the HTTP request to save the score if it is greater than the lowest in the top 10. This will still create more records each time a new score is made, but it won't be submitting any scores that don't already beat the existing top ones. Note that MySQL can easily handle hundreds of thousands of records assuming your database storage limit isn't too small.

Another manual option is to periodically call the "DELETE" command in SQL with a range of rows specified. There are a bunch of different ways to do this depending on what records need to be deleted. If you'd just like to delete a range of records based on their ID, I'm attaching a simple PHP script that is compatible with those Daniel posted. Just upload it to the same directory as config.php and call it from a Web browser using: http://yourdomain.com/dir/deletescores.php?startid=0&endid=50 This will immediately delete any records that have an ID between 0 and 50. ONLY use this script if you are following the advice above and only saving scores that are higher than the existing top 10, otherwise the IDs won't necessarily correlate to the top scores and by deleting a range like this you may be deleting some of the top scores. A more advanced solution would be to sort the records by score descending and then delete the total count minus 10 (or whatever) but I did not do that here.

Quote: "Secondly, and this may be the problem with the first question. I deleted a few of the entries as I was getting some blank entries with my initial tests, via my webpage. So now a few id numbers are gone and not been replaced as I expected. So for example id 1, 10, ans 28 are now missing. Will this cause issues?"


Nothing is wrong with this, the IDs are simply unique identifiers of the records and have no other effect.

Attachments

Login to view attachments
Daniel TGC
Retired Moderator
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 16th Nov 2012 00:56
I have a limit of 49,000 kb and each record takes about 0.89kb that's a potential 54700 scores I can hold in that database. If it gets too large I will likely just dump the top 100, wipe the table and then reintroduce the top 100 back into it. This can be done pretty easily with a php script. When I have time I'll write one up.
Daniel TGC
Retired Moderator
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 16th Nov 2012 12:54
Before you do this Backup your database!

Go into phpMyAdmin click on SQL and type in the following code then click on Go and accept the warning:



This SQL script should organize your records by highest to lowest score, then limit your database to 100 records.

Replace the word "MyGame" with the name of your table to make this work.

This is experimental, if it works for you as well it's easy to convert into a PHP script. Let me know if it does the job for you!
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 16th Nov 2012 17:45
Nice one Daniel, and also xCept. I will report my progress when I have something to report!

DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 18th Nov 2012 15:04
Just letting you know that script seemed to work okay. Not tested it with loads of scores in yet though as I have an android problem now Locks up at semi random places when the highscore runs. It runs fine on both my PC and netbook, but the android phone is having issues. It does however manage to send a score off as well as crash, so I know it connects up okay at some point in the process lol.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Nov 2012 18:18
DVader, if you happened to update your Android to version 4.2, join the rest of us who got messed up. There are many many problems in 4.2. My game worked fine and then, after the update, would randomly die and other stuff. My 'Reader by Sony' app worked great, but after the update could not log in.

Cheers,
Ancient Lady
AGK Community Tester
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 27th Nov 2012 13:42
@ Ancient lady, still on 2.35 on my phone, so probably not a specific issue with android updates. At first I thought it was the exit bug, but after changing that it still crashes, even on an 1076. It just seems to get stuck in a loop while waiting for the file to upload/download. I must admit after messing about for a couple of hours with it with no success, I have not done much with it since posting last time. I really have no clue as to why it doesn't work on android but runs fine on PC and my netbook.

Daniel TGC
Retired Moderator
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 27th Nov 2012 23:12 Edited at: 27th Nov 2012 23:13
I've not tested this on Android at all I'm afraid, again there was such little interest in this project I never took it beyond a quick windows run.

I'm deep into writing Teach Yourself App Game Kit, at the moment. Once that's done I'll try to remember to take another look at this.

Login to post a reply

Server time is: 2024-11-24 04:50:25
Your offset time is: 2024-11-24 04:50:25