Keep scores online read/write

Started by Slasher, Sun 01/05/2016 08:15:45

Previous topic - Next topic

Slasher

Hi

I have never used READ/WRITE files before though i know many have.

I have some questions i need a hand with.

At the end of each game the players' score gets written to a file that gets uploaded to a site and is stored there among other players score as one file. All different players' scores get added as well. 

On every new game ags pulls that file from the site and displays all the scores, along with who scored what and going from high to low. It is always updated.

Is this doable and if so how should i go about it?

cheers for all help.

slasher


Snarky

Yes, it is doable (with a plug-in) if you know what you're doing. If you don't, it's not trivial. And it doesn't really have anything to do with reading/writing files.

You need a web server backed by a database. To submit a score, you make an HTTP POST request to the correct URL. The server reads the submitted data and puts it in the database (or updates the relevant entry). To retrieve the scores, you make an HTTP GET request, the server looks up the scores in the database and responds.

All this stuff is standard and very basic web dev stuff.

In order to get AGS to make HTTP requests, you can use the Sockets Plugin (which does TCP/IP) and write a simple version of the HTTP protocol on top. There are some hints about how to do that in the thread.

Slasher



SMF spam blocked by CleanTalk