unemployment Posted October 7, 2011 Share Posted October 7, 2011 I'm making a game where you earn points and lose points based on the actions that you take and the actions that your opponents take. What's the best way to create this system. Should I use mysql to store all the data and if so, should I set up the actions in a seperate table or should I just join the actions from all of my other tables. I'm not quite sure what the best method is. Quote Link to comment https://forums.phpfreaks.com/topic/248638-rating-system/ Share on other sites More sharing options...
Psycho Posted October 7, 2011 Share Posted October 7, 2011 There is no way for us to really give you any good advice. There are a multitude of variables that would affect "how" you should set up your database. Besides, this is the PHP Coding forum - not the database forum. Some things that would dictate the appropriate methods: Do specific actions have specific points assigned? Are the points for the actions variable? If so, on what basis are they variable. You will need to give a complete overview of how the point system works to get any useful information. Quote Link to comment https://forums.phpfreaks.com/topic/248638-rating-system/#findComment-1276888 Share on other sites More sharing options...
unemployment Posted October 7, 2011 Author Share Posted October 7, 2011 Essential here is a sample system. Points gain for tasks done - Personal Profile completion = 200 points Created or joined a verified company profile = 200 points Having a company video = 50 points Blog Post = 50 Points Number of friends = 20 points each Number of votes submitted = 5 points each Number of fans your company receives = 10 points each Twitter shares for blog post = 1 points Facebook shares for blog post = 1 points Google plus 1 for blog post = 1 points It would kind of cool if this could be dynamic... If one user has 20500 point and one has 100 points and I become friends with both of themI don't want to be given the same 20 point gain. I should be given more points for the person that has more points because they are a more valuable contact. Any thoughts on how to be code this out? Some of this will be static and some of it will be dynamic. Quote Link to comment https://forums.phpfreaks.com/topic/248638-rating-system/#findComment-1276907 Share on other sites More sharing options...
Psycho Posted October 7, 2011 Share Posted October 7, 2011 It would kind of cool if this could be dynamic... If one user has 20500 point and one has 100 points and I become friends with both of themI don't want to be given the same 20 point gain. I should be given more points for the person that has more points because they are a more valuable contact. Huh? Where in your requirements does it state that the points for friends will be dynamic based upon their points. Your requirements state that the points for friends is 20 points each. That issue aside, looking at some of the "tasks" I would assume some of them will be tracked via existing DB records (friends, votes, blogs, etc.) I would think those tasks could be programmatically determined by the tables for friends, votes, blogs, etc. For other "tasks", if they are not tracked via existing records, you would need to add a separate table (or tables) to track those tasks. Calculating the points based upon fixed points to tasks is fairly stritforward - add up the tasks and multiple by the points. But, this concept of variable points for a friend will need serious analysis. For example, if I become friends with "Bob" and my points for that friendship are supposed to be variable based upon how "valuable" Bob is, are the points fixed based upon how popular Bob is at the time the friendship is made. Or, do my points for that friendship change as Bobs "value" changes. The former would be fairly straitforward. At the time the friendship is made calculate how many points to assign and create a record for that relationship and the points awarded. If you want to go with the latter it will get fairly complex. In fact, it could lead to circular references if my points are partially determined by my friends' values and their values are determined by their points - which are in turn partially derived from their friends values, etc. Quote Link to comment https://forums.phpfreaks.com/topic/248638-rating-system/#findComment-1276925 Share on other sites More sharing options...
unemployment Posted October 7, 2011 Author Share Posted October 7, 2011 Well yes, the points for friends would be dynamic not necessarily 20 points. So the more points my friends earn, over time, not at the point of befriending, the more points I will earn. So this will be a completely live system. That's where the complexity builds in. I'm not sure how to work that out. Quote Link to comment https://forums.phpfreaks.com/topic/248638-rating-system/#findComment-1276958 Share on other sites More sharing options...
Psycho Posted October 7, 2011 Share Posted October 7, 2011 Well yes, the points for friends would be dynamic not necessarily 20 points. So the more points my friends earn, over time, not at the point of befriending, the more points I will earn. So this will be a completely live system. That's where the complexity builds in. I'm not sure how to work that out. Neither do i, because as I said it will cause a circular reference and cannot be done. Take the following scenario: Alan is friends with Bob, Bob is friends with Chris, and Chris is friends with Alan. To Alan's score you have to calculate the points based upon his friendship with Bob (which will be based upon Bob's score). But, to determine Bob's score you first have to calculate the points he will get based upon his friendship with Chris - which required you to calculate Chris's score. To determine Chris's score you have to determine how many points he gets for his friendship to Alan. And THAT requires you to calculate Alan's score which is what you started out trying to determine. The model you are proposing is not possible. You can have a variable scoring model, but you need to come up with something that can be done. As I said, you can do this IF you only calculate the "friendship" score only at the time the friendship is made. But, if the friendship score is to be variable in real-time it just won't work. Quote Link to comment https://forums.phpfreaks.com/topic/248638-rating-system/#findComment-1276983 Share on other sites More sharing options...
unemployment Posted October 7, 2011 Author Share Posted October 7, 2011 Well yes, the points for friends would be dynamic not necessarily 20 points. So the more points my friends earn, over time, not at the point of befriending, the more points I will earn. So this will be a completely live system. That's where the complexity builds in. I'm not sure how to work that out. Neither do i, because as I said it will cause a circular reference and cannot be done. Take the following scenario: Alan is friends with Bob, Bob is friends with Chris, and Chris is friends with Alan. To Alan's score you have to calculate the points based upon his friendship with Bob (which will be based upon Bob's score). But, to determine Bob's score you first have to calculate the points he will get based upon his friendship with Chris - which required you to calculate Chris's score. To determine Chris's score you have to determine how many points he gets for his friendship to Alan. And THAT requires you to calculate Alan's score which is what you started out trying to determine. The model you are proposing is not possible. You can have a variable scoring model, but you need to come up with something that can be done. As I said, you can do this IF you only calculate the "friendship" score only at the time the friendship is made. But, if the friendship score is to be variable in real-time it just won't work. Hmm that really sucks. I see your point. Quote Link to comment https://forums.phpfreaks.com/topic/248638-rating-system/#findComment-1276986 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.