Livecode Multiplayer Leaderboard
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Livecode Multiplayer Leaderboard
I am trying to make an online multiplayer leaderboard, I've searched for it all over the internet and I only found one thing that's in the forums and its links doesn't work anymore because it's from 2014.
Please help,
Fest
Please help,
Fest
Re: Livecode Multiplayer Leaderboard
Hello Fest, could you perhaps give a bit more information about what exactly you are trying to create? For instance, a picture would be helpful, but, lacking that, maybe a short textual form describing what you want as far as looks and functionality go?
The following is an example:
Are you looking for something like this display wise...
Or something more like this....
Or something altogether different?
What information are you looking to display? Does someone need to be logged in to view it? Something else altogether?
The following is an example:
Are you looking for something like this display wise...
Or something more like this....
Or something altogether different?
What information are you looking to display? Does someone need to be logged in to view it? Something else altogether?
Re: Livecode Multiplayer Leaderboard
Hi Bogs,
Thanks for answering so fast,
I am trying to make something like shown in the second picture. I already own a MySQL server that I'm controlling on phpMyAdmin. Also, in the game main screen, I programmed a 'name pick' button which you can pick your name into global _PlayerName.
Thanks,
Fest
Thanks for answering so fast,
I am trying to make something like shown in the second picture. I already own a MySQL server that I'm controlling on phpMyAdmin. Also, in the game main screen, I programmed a 'name pick' button which you can pick your name into global _PlayerName.
Thanks,
Fest
Re: Livecode Multiplayer Leaderboard
Ok, now we have a look your shooting for, while I don't normally recommend this route, it looks like what your shooting for would be a good fit for a form version of a datagrid.
I *think* this lesson should get you started nicely on creating the form style grid you want-
https://lessons.livecode.com/m/datagrid ... -of-people
In your OP you mentioned this would be online, which I am guessing means you store the information online and want the data read back into the application run locally. That part of it (I would hope) some others that do stuff along those lines would chime in for, but I don't foresee any great difficulty in accomplishing it.
I *think* this lesson should get you started nicely on creating the form style grid you want-
https://lessons.livecode.com/m/datagrid ... -of-people
In your OP you mentioned this would be online, which I am guessing means you store the information online and want the data read back into the application run locally. That part of it (I would hope) some others that do stuff along those lines would chime in for, but I don't foresee any great difficulty in accomplishing it.
-
- VIP Livecode Opensource Backer
- Posts: 9867
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Livecode Multiplayer Leaderboard
Unlike most languages, LC has an uncommonly good track record of maintaining backward compatibility. Where is that earlier discussion, and what part of it didn't work?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Livecode Multiplayer Leaderboard
Thank you so much!bogs wrote: ↑Mon Jun 21, 2021 6:53 pm
In your OP you mentioned this would be online, which I am guessing means you store the information online and want the data read back into the application run locally. That part of it (I would hope) some others that do stuff along those lines would chime in for, but I don't foresee any great difficulty in accomplishing it.
Re: Livecode Multiplayer Leaderboard
For some reason I can't send linksFourthWorld wrote: ↑Mon Jun 21, 2021 7:37 pmUnlike most languages, LC has an uncommonly good track record of maintaining backward compatibility. Where is that earlier discussion, and what part of it didn't work?
-
- VIP Livecode Opensource Backer
- Posts: 9867
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Livecode Multiplayer Leaderboard
Does it have a title? What section is it in?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Livecode Multiplayer Leaderboard
Guessing it's this one viewtopic.php?f=22&t=19380#p99792
I'm not sure exactly what you would find in the original stack
I'm not sure exactly what you would find in the original stack
-
- Posts: 253
- Joined: Wed Aug 19, 2015 4:29 pm
Re: Livecode Multiplayer Leaderboard
The high score board of that space shooter stack was powered by a simple mysql database. From my memory it was basically just two columns - name/score.
edit: I'm not exactly sure how helpful this is, but that stack was definitely using a simple mysql database with a table named "highscores" with two columns "name" and "score". I dug this stack out and copied the relevant script, but you should definitely NOT do it this way. It is way more secure to put a script like this on your server as middleware, than to hard code the credentials/functionality into your app itself.
edit: I'm not exactly sure how helpful this is, but that stack was definitely using a simple mysql database with a table named "highscores" with two columns "name" and "score". I dug this stack out and copied the relevant script, but you should definitely NOT do it this way. It is way more secure to put a script like this on your server as middleware, than to hard code the credentials/functionality into your app itself.
Code: Select all
global AMiConnected
put "yourSQLhosthere" into vScoreDatabaseHost
put "yourDataBaseNameHere" into vDataBaseName
put "yourDataBaseUserHere" into vDataBaseUser
put "yourDataBaseUserPasswordHere" into vDatabasePassword
put revOpenDatabase("MySQL", vScoreDatabaseHost, vDataBaseName, vDataBaseUser, vDatabasePassword) into tResult
if tResult is a number then
put tResult into AMiConnected
put "HighScores" into vScoreTable
put "Name,score" into vNewPlayerInfo
put fld "score" into vPlayerScore
put "INSERT INTO " & vScoreTable & " (" & vNewPlayerInfo & ") VALUES (:1, :2)" into tSQL
revExecuteSQL AMiConnected, tSQL, "vPlayerName", "vPlayerScore"
put "HighScores" into vScoreTable
put "SELECT * FROM " & vScoreTable into tSQL
put revDataFromQuery(tab, cr, AMiConnected, tSQL) into ScoreData
if item 1 of ScoreData = "revdberr" then
answer error "Unable to post high score"
else
put ScoreData into field "Data"
sort lines of fld "data" descending numeric by word 2 of each
replace"_" with " " in fld "data"
repeat with w= 11 to the number of lines in fld "data"
put empty into line w of fld "data"
end repeat
repeat with p=1 to the number of lines in fld "data"
put (p&".") before line p of fld data
end repeat
set the textcolor of line 1 of fld "data" to green
end if
if AMiConnected is a number then
revCloseDatabase AMiConnected
put empty into AMiConnected
end if
end if
-
- VIP Livecode Opensource Backer
- Posts: 9867
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Livecode Multiplayer Leaderboard
Does the leaderboard show the scores of all players, or just the leaders?
If the latter, does it need a database? Might a simple text file do?
If the latter, does it need a database? Might a simple text file do?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Posts: 253
- Joined: Wed Aug 19, 2015 4:29 pm
Re: Livecode Multiplayer Leaderboard
I guess I had assumed that multiplayer leaderboard meant there would potentially be multiple concurrent users (who may try to save their high score) at any given time.FourthWorld wrote: ↑Tue Jun 22, 2021 4:05 pmDoes the leaderboard show the scores of all players, or just the leaders?
If the latter, does it need a database? Might a simple text file do?
-
- VIP Livecode Opensource Backer
- Posts: 9867
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Livecode Multiplayer Leaderboard
The moment of writing to disk is rarely if ever truly concurrent. The question is how we handle the need to momentarily lock that part of the storage file.ClipArtGuy wrote: ↑Tue Jun 22, 2021 4:27 pmI guess I had assumed that multiplayer leaderboard meant there would potentially be multiple concurrent users (who may try to save their high score) at any given time.
When what's being stored is small, locking the entire file may cost less than a single millisecond.
MySQL's InnoDB storage engine locks at the record level, and its MyISAM engine locks entire tables.
Combined with the overhead of both IAC and LC's externals interface, not to mention the internal b-tree traversal, sometimes locking a small flat file is more efficient.
Little things add up, and using a relational DB engine involves *lots* of little things.
And then there's development and maintenance time...
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 125
- Joined: Tue Apr 11, 2006 7:02 pm
- Location: Seattle, WA
- Contact:
Re: Livecode Multiplayer Leaderboard
Years ago, we made a sample game that demonstrated how to store a player's score and generate a High Score Leaderboard.
The game is written in LiveCode and uses LiveCloud for the backend. The code is simple to read and easy to port to another database.
You can see a quick demo of it on youtube:
https://www.youtube.com/watch?v=wjXHt8MqYNY
Feel free to download the working code here:
https://www.livecloud.io/downloads/Dropper/Dropper.zip
*Please note that this code requires a paid edition of LiveCode because it relies on encryption features found in Indy or Business.
** You do not need a LiveCloud account to play.
The game is written in LiveCode and uses LiveCloud for the backend. The code is simple to read and easy to port to another database.
You can see a quick demo of it on youtube:
https://www.youtube.com/watch?v=wjXHt8MqYNY
Feel free to download the working code here:
https://www.livecloud.io/downloads/Dropper/Dropper.zip
*Please note that this code requires a paid edition of LiveCode because it relies on encryption features found in Indy or Business.
** You do not need a LiveCloud account to play.
Mark Talluto
--
Canela
design - develop - deploy: https://appli.io
Database and Cloud for LiveCode Developers: https://livecloud.io
Company: https://canelasoftware.com
--
Canela
design - develop - deploy: https://appli.io
Database and Cloud for LiveCode Developers: https://livecloud.io
Company: https://canelasoftware.com