kpetsche20 Posted August 12, 2008 Share Posted August 12, 2008 I have a clone of gamercoliseum dot com. Everything is done except the tournament system. It is a bracket system setup for 1v1. So if there are 8 players 4 games would be setup and each winner would advance and this would go on until there is only 1 winner. Any advice on how to make this work with a MySQL database would be helpful How it works: 1. All tournament games are 1v1 and all will have a max player setting, 4 being the minimum players allowed. 2. Each time a player signs up they auto-matically need to be assigned an opponent. After each game, each user reports the win. Once a win is reported, only a loss will be able to be recorded for the opponent. If they feel this is un-fair then they will email us with proof of their win. 3. Tournament games are all 1v1 and will not end until there is only 1 winner. Each winner advances to the next round, until there is only one. Quote Link to comment Share on other sites More sharing options...
mikeschroeder Posted August 12, 2008 Share Posted August 12, 2008 so its a single elimination setup like this? Quote Link to comment Share on other sites More sharing options...
Psycho Posted August 12, 2008 Share Posted August 12, 2008 Not enough information here. I think you need to go back and really examine the overall design. For example you state "Each time a player signs up they auto-matically need to be assigned an opponent". That's not possible, who would the first player be assigned to, or the third (assuming the first and second are assigned. Also, at what point does the tournament get locked? If eight players have signed up and one or more of the first round matches have been played, can other players join? I would assume that add'l players would not be able to join once the 2nd round matches have begun. What are you going to do when there are a number of players that do not equal a factor of 2 (2, 4, 8, 16, etc.). If you only have 6 teams youwould have to give one of the initial three winners a bye for the 2nd round. As you can see there are lots of questions that need to be answered. I would simply allow players to sign-up until some point in time when the tourney will be locked - either by reaching a max limit (such as 16) or where an admin locks it because a set amount of time has expired. You would also want something to cancel a tourney if there are not enough players. I don't have the time to write all the code that will "build" the brackets, but the following should help you: $players = 6; $rounds = ceil(log($players, 2)); //Result 3 $byes = pow(2, $rounds) - $players; //Result 2 (8 being a perfect bracket) The calculations above will determine the number of rounds needed and the number of byes (for the current bracket) Quote Link to comment 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.