Other Is there some script to periodically check...

sorex

Expert
Licensed User
Longtime User
using a service that is doing a plain http call and check the response status? (if the file is plain text you can save it immediatly aswell since it's in the response text)
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
you don't have access to put own php files on it?

then you don't have much options I'm affraid besides what I gave you in my earlier post.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
If (file_exists($myfile)) {echo "1";} else {echo "0";}

that's all you need to figure out if it exists.

I had a look at the other thread but what's the point to download a high score file, change it and reupload?

just send the score to the the php backend and update the database.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
ok, then you need that fileexist check, a rename and upload function to start with.

the periodical part is in the app you mean?

what will you do if 2 people have a highscore and that file is gone?

or even worse, someone gets a highscore downloads the file, file is renamed and the person turns off the wifi/device before it gets uploaded again.

your "simple" idea is not simpler than php/mysql (even worse) and less waterproof.
 
Last edited:
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Those are the problem.

As I wrote in that post (I tried to write, it is not easy in English: this site should be all in Italian :p):

a) the player makes his game on his device, not connected;
b) he thinks his score is high and download the ranking file (.txt);
c) he locks the file in some way (eg by deleting it from the server);
d) he updates the file and uploads it again on the server

But if, for some reason, he did not complete step d), the ranking file is no longer available.

At this point, the server (scripts) should check the duration of the user update and possibly recreate the file.


If you know another method, always using only a standard text file and FTP, much better :D
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
well, if you really want to skip a database you could do it like this

player ended his game (high score or not)
post the score to http://whatever/highscores.php
there you load the txt file
add the score to it
sort the text
strip of the first 10 lines
save the file
echo the file so that the app has the new tables if changed

but it's not adviced if a lot of apps start connecting to it simultanious.
 
Upvote 0

coslad

Well-Known Member
Licensed User
Longtime User
Ciao Luca,

molto semplicemente potresti creare dei semplici file di testo , ognuno per un punteggio del rank .
Tipo punteggio.nome_utente , alla fine della partita l'utente uploada via ftp il proprio punteggio ,cioe' il file del proprio punteggio .
Prima della partita fai un ftp.list metti in ordine crescente i file e ti crei localmente i ranking generale (senza scaricare nessun file)

Hello Luke,
quite simply you create simple text files, each for a score of rank.
For example: punteggio.nome_utente, at the end of the game the user uploada via ftp your score, ie the file of your score.
Before the game do a ftp.list put in ascending order and the files you create locally ranking general (without downloading any files)
(Google translate)
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
that should be only the ranking (for example, the top 10).

If users were thousands, I should have thousands of files.

Also, I should download them all to get ranking.


But many thanks for your help.


If you want, this is the "thread to help".
 
Upvote 0

coslad

Well-Known Member
Licensed User
Longtime User
No Luca , con ftp.list non scarichi i file ma solo la lista , e questo ti basta per mettere in ordine il ranking.
Be' se ci sono migliaia di giocatori fai prima a comprare un rasperry pi o meglio un banana pi e lo usi come server .

No Luke, with ftp.list not download files, only the list, and this is sufficient for you to sort the ranking.
Well 'if there are thousands of players .... you do before buying a rasperry pi or rather a banana pi and use it as a server
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Lo so che con il list elenchi file e directory, ma per metterli in ordine di classifica i nomi dei file dovrebbero contenere il punteggio!
Raspberry mi è stato consigliato giusto ieri (per altri motivi, ovviamente). Probabilmente sarà anche utile, ma non credo sia più potente del mio pc, no?
Certo, mi eviterebbe di usare il mio pc come server, questo si.
----------------
I know the FTP List command shows a list of files and directories, but to sort them, their name should be the scores!
Raspberry can be helpful, but I do not think that it is more powerful than my PC, although it may be useful to avoid using my PC as a server.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
yes, that's what he meant. save/list the 1 byte files as

34343.Sorex
23242.Luca
12323.Coslad
etc.

but it requires serverside scripting aswell so you could stick to the single highscore file method aswell that I mentioned earlier.
(and coslad's no file download is wrong too aswell, ftp gives more overhead due to log in, sending commands and retrieving the list than a simple http get :) )
 
Upvote 0
Top