Jump to content

Ranking system


onthespot

Recommended Posts

Hello everyone.

Before I get started, I want to assure you all that I am not looking for a free pass here and I don't expect anyone to write the code for me.

 

The problem

 

My website is based on football (soccer), and when someone wins a match against their opponent they submit it to the other player to accept and it goes through the system.

For my website, I want to create a ranking system based on points.

So say everyone starts on 500 points and then depending on who they beat, they take points off one another when submitting a winning result. The higher ranked player you beat, the more points you take.

 

I have no idea where to start with this, could anyone point me in any direction?

Give me some ideas about how to develop such a system.

Thankyou

Link to comment
Share on other sites

The first thing to do, is to decide how you want the data to look in terms of the database tables, where you can store current score, wins, losses etc.

 

When you have an idea of how you are going to store the data, then you can start on the logic to handle the updates

Link to comment
Share on other sites

I already have all the data stored, I am looking to add the ranking system to it.

There is a table with wins draws losses etc in it.

Each row is for a different user.

 

Why not define the ranks first?

Rank 1: 500
Rank 2: 650
Rank 3: 800
Rank 4: ...

 

If you don't store the rank along with the user, there's no need for pointless data retrieving as it'd be dynamic. If there is a win, authenticate it, update the user's table with the score IF the current opponent has enough to give etc.

 

Kinda straightforward.

Link to comment
Share on other sites

Thanks for the feedback.

I am looking for everyone to start on 500 points.

There arent going to be ranks in particular.

Just points. So people will get get points for winning and lose points for losing.

Users could have say 564, 345, 876, 512 and 643 points.

Thats just 5 randoms points totals that would be for 5 different users depending on how well they do.

Do you understand what I mean?

Link to comment
Share on other sites

Thanks for the feedback.

I am looking for everyone to start on 500 points.

There arent going to be ranks in particular.

Just points. So people will get get points for winning and lose points for losing.

Users could have say 564, 345, 876, 512 and 643 points.

Thats just 5 randoms points totals that would be for 5 different users depending on how well they do.

Do you understand what I mean?

 

Is that all you're using for ranking? Then you can use SQL's limit and desc commands in your query to list the top 5 players for example. It's the only ranking in your example that would make sense.

Link to comment
Share on other sites

How would the points be worked out though?

All users start on 500 and when they win against each other, they take an amount of points from each other depending on how high their opponent is ranked.

 

Then work out a pseudo-rank method of how many points they take out of the other player.

$opponent_ponts = 600;
$your_points = 700;
$winning_points =   floor($opponent_points / ; //You win: Equates to 75, So give that to winner, take that from loser.

$opponent_ponts = 1000;
$your_points = 650;
$winning_points =  floor($opponent_points / ; //You win: Equates to 125, as opponent has higher points, more is taken

$opponent_ponts = 1000;
$your_points = 650;
$winning_points =  floor($your_points/ ; //You lose: You only lose 81, as you're lower level etc. etc..

 

Many games use this method to calculate EXP delta per level. I'm not sure if you want to take less points away if they're higher in score or not. But this is a fairly straightforward example math wise.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.