onthespot Posted January 26, 2010 Share Posted January 26, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/189839-ranking-system/ Share on other sites More sharing options...
jl5501 Posted January 26, 2010 Share Posted January 26, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/189839-ranking-system/#findComment-1001785 Share on other sites More sharing options...
onthespot Posted January 26, 2010 Author Share Posted January 26, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/189839-ranking-system/#findComment-1001788 Share on other sites More sharing options...
oni-kun Posted January 26, 2010 Share Posted January 26, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/189839-ranking-system/#findComment-1001792 Share on other sites More sharing options...
onthespot Posted January 26, 2010 Author Share Posted January 26, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/189839-ranking-system/#findComment-1001814 Share on other sites More sharing options...
oni-kun Posted January 26, 2010 Share Posted January 26, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/189839-ranking-system/#findComment-1001817 Share on other sites More sharing options...
onthespot Posted January 26, 2010 Author Share Posted January 26, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/189839-ranking-system/#findComment-1001820 Share on other sites More sharing options...
oni-kun Posted January 26, 2010 Share Posted January 26, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/189839-ranking-system/#findComment-1001827 Share on other sites More sharing options...
onthespot Posted January 26, 2010 Author Share Posted January 26, 2010 This is awesome, really great. Is there a way to take into account both scores, opponent and your own? Quote Link to comment https://forums.phpfreaks.com/topic/189839-ranking-system/#findComment-1001848 Share on other sites More sharing options...
onthespot Posted January 26, 2010 Author Share Posted January 26, 2010 Yeah was hoping to be able to take away more score from a higher ranked player in the user who wins is lower ranked. And if the high user wins against a lower user, he would receive less points. Quote Link to comment https://forums.phpfreaks.com/topic/189839-ranking-system/#findComment-1001851 Share on other sites More sharing options...
onthespot Posted January 26, 2010 Author Share Posted January 26, 2010 Anyone? If not, the other solution was great. Quote Link to comment https://forums.phpfreaks.com/topic/189839-ranking-system/#findComment-1002055 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.