Results 1 to 10 of 17

Thread: How to implement an online high score table?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    How to implement an online high score table?

    I wonder how to implement an online high score table. I think I could use a PHP script on the server side and communicate with my Pascal game. I have no clue about PHP, though. Has anyone a hint? Maybe even a ready-to-use script? Or am I totally wrong?
    Best regards,
    Cybermonkey

  2. #2
    I once did this for Alexland. Since I didn't really want to dwell into how to send proper HTTP requests and send data via POST, I used some unit for simple web fetching and passed all the data through GET. So it was kind like

    Unit.ConnectToSite('http://mysite.com');
    Unit.GetDocument('http://mysite.com/scores/mygame/script.php?data1=value1&data2=value2');

    I had three scripts on the server side:
    info.php - this one returned the modification date of the high-scores - no need to download them if nothing changed, eh?
    get.php - as can be guessed, this one returned the high-score table
    submit.php - used to send the scores

    Whereas what info.php and get.php should return is obvious, my submit.php returned one of the following:
    <a number> - means the score you submitted made it into the table and holds the <number> place
    sorry - the score did not make it to the table
    error - the score is lacking data or somehow else damaged
    gtfo - the score has already been submitted or it's checksum is wrong - you're probably cheating
    version - wrong game version

    'error' and 'version' could also be returned by info.php and get.php, to signalize errors.

    If you want, I could send You the script I used, of course after modyfing it a bit (so I won't give out much of the game ) and adding some comments.

  3. #3
    I think that's exactly what I need. If you would be so kind to send me the script(s), I'll be more than thankful.
    Oh, another question: on the Freepascal side, do you use Synaptic or anything else? (SDL_net?)
    EDIT: Sorry, I meant Synapse ...
    Last edited by Cybermonkey; 15-08-2012 at 01:15 PM.
    Best regards,
    Cybermonkey

  4. #4
    Sorry for the delay, I was a bit busy yesterday evening.

    http://svgames.pl/trash/netscores.zip
    I hope everything's commented clearly enough. As for the FP side, the game was made using SDL, so I went with SDL_net.

  5. #5
    Quote Originally Posted by Super Vegeta View Post
    Sorry for the delay, I was a bit busy yesterday evening.

    http://svgames.pl/trash/netscores.zip
    I hope everything's commented clearly enough. As for the FP side, the game was made using SDL, so I went with SDL_net.
    Okay, thanks a lot. I will have a look into it at this evening.
    Best regards,
    Cybermonkey

  6. #6
    Did you take security into account, so that not anyone can open the link and add nonsense-scores?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •