Skip to content
Sign upLog in
← Back to Community

online leaderboard python

Profile icon
CholsreaMMOS

I've seen a few games that have leaderboards from other users and would like to implement that to my own game. I've looked around and haven't found any answers and was hoping you guys could help.

basically I would like a way of taking an end score from every user, compare to find the lowest (or highest) and print the top 3 (or more) when it starts, ends or access leaderboard ect.

it would be really useful for almost ALL of the games I make and would really appreciate if you can tell me how, or if they are fake.

Answered by PattanAhmed [earned 5 cycles]
View Answer
Voters
Profile icon
CholsreaMMOS
Comments
hotnewtop
Profile icon
PattanAhmed

@CholsreaMMOS
Hi,
They are not fake dude...
They use something called Database...

If you know, then you can use it there
Else no then, Learn it from this website:-
Click here

You will find all tutorials from the left side of that website:-
01

That's it for me.
Thanks!

Hope this helps

Profile icon
CholsreaMMOS

Thanks

@PattanAhmed

I didn't know about this and it really helps

Thanks again

Profile icon
PattanAhmed

@CholsreaMMOS
Welcome!
Happy to help you.

Please mark my answer if that helps
Thanks!

Profile icon
Bookie0

hi!

you could do this with dicts: adding a user's name and their score, then maybe sort the dict from highest to lowest, and print it. however that will save locally; meaning that once you press run again, all the data will be erased.

thats probably not what you want. in that case, you can use database to store information.

you can use ReplDB, a database already implemented on your repls. Check out Coder100's tutorial here: https://repl.it/talk/learn/Replit-DB/43305

you can also make a nodeJS server with the leaderboard; some tutorials:

https://developer.okta.com/blog/2019/03/11/node-sql-server

https://www.tutorialsteacher.com/nodejs/access-sql-server-in-nodejs

https://hackernoon.com/setting-up-node-js-with-a-database-part-1-3f2461bdd77f

https://www.w3schools.com/nodejs/nodejs_mysql_create_db.asp (w3 schools good ;)

you can also use MongoDB if you're using python:

https://www.tutorialspoint.com/mongodb/index.htm

https://docs.mongodb.com/manual/tutorial

https://beginnersbook.com/2017/09/mongodb-tutorial/

https://www.guru99.com/mongodb-tutorials.html

Profile icon
Codemonkey51

Hai

@Bookie0
1) Coder isn't the only one to make repldb docs check the official ones out here
2) you can maybe link a client next time for example the official python client: https://pypi.org/project/replit/ with docs here: https://replit-python-docs.scoder12.repl.co/#module-replit.database

Profile icon
Bookie0

Hai

@Codemonkey51
1) cool, i only knew coder's tutorial

  1. ok thx for info ;)
Profile icon
Codemonkey51

Lmfao ur welcome and hai

@Bookie0

Profile icon
Codemonkey51

Also my client is ded now :( bc the officail one, but I did contribute to that one

@Bookie0

Profile icon
Bookie0

:] and hai

@Codemonkey51

Profile icon
Bookie0

oof and hai

@Codemonkey51

Profile icon
Codemonkey51

:))))))

@Bookie0

Profile icon
Bookie0

(lets take this to discord enough pings to the asker already lmao)

@Codemonkey51

Profile icon
CholsreaMMOS

Thanks

@Bookie0
you and
@PattanAhmed
have shown me database, its really usefull know that i know about it

Profile icon
PattanAhmed

@CholsreaMMOS
Welcome!

Profile icon
CholsreaMMOS

Thanks

@Bookie0
turned on my phone and it actually crashed from all the notifications

Profile icon
Bookie0

Lmao sorry about that I know how annoying that is ;)

@CholsreaMMOS

Profile icon
CholsreaMMOS

lol np

@Bookie0
even though I'm continuing it

Profile icon
Bookie0

lol

@CholsreaMMOS

Profile icon
Coder100

Are you going to use a database or no?

Profile icon
CholsreaMMOS

Yeah

@Coder100
the other comments pointed it out, i didn't know what it was before hand