STFinancial / Minecraft

0 stars 0 forks source link

Add Ladder to dataManager #12

Open Boxxy opened 10 years ago

Boxxy commented 10 years ago

Will need to be performance senstitive, ranking system by elo for the top teams on the server. Command /arena top will display the top 5 teams, /arena who [teamName] will include information based off of team ranking vs teams on server

STFinancial commented 10 years ago

Right now, the ladder only updates a single time on server reload. We need to define exactly when we want to update the ladder (on team create, on team deletion, on match end) so that the ladder can be consistently updated. One of the best ways I see of doing this is having the team store its ladder position for quick swapping around when a team wins or loses... it would also make deletions easier.

Boxxy commented 10 years ago

Yeah add team ladder position to the ArenaTeam. on Server Load, Match End and New Team creation I would make sure to update the ladder (as well as every position variable in the Teams)

On Thu, Jul 31, 2014 at 12:35 AM, STFinancial notifications@github.com wrote:

Right now, the ladder only updates a single time on server reload. We need to define exactly when we want to update the ladder (on team create, on team deletion, on match end) so that the ladder can be consistently updated. One of the best ways I see of doing this is having the team store its ladder position for quick swapping around when a team wins or loses... it would also make deletions easier.

— Reply to this email directly or view it on GitHub https://github.com/STFinancial/Minecraft/issues/12#issuecomment-50714495 .

Boxxy commented 10 years ago

We need to test this but I think the code is in

qsik commented 10 years ago

You can make a custom ladder class that acts like a linked list but allows for insertions into the list

Boxxy commented 10 years ago

it's already been coded as far as I know

STFinancial commented 10 years ago

I could do a ladder class

STFinancial commented 10 years ago

I don't think that the update methods have been done though. Arena team creation, and match finish need to call the update ladder function. Arena team creation might need to rebuild the ladder altogether or we can do an insert and sort.

qsik commented 10 years ago

You could. The problem with lists, sets, etc. is that you need a good way to insert an element into a different position in the list. Also, you can't simply use swap because of large elo swings

STFinancial commented 10 years ago

Yes, I would think we can call update which will just re-sort the whole thing. Otherwise, if efficiency is really an issue we can create a more efficient method than that. You don't really need to "insert" to the list, you just add and re-sort.

qsik commented 10 years ago

Or you could make a custom list class where you just replace the references to an object so that it is effectively "inserted" into a different position. This would avoid having to continuously sort the list.

STFinancial commented 10 years ago

The problem with that is that we don't really know where a team is going to be on the ladder until we sort it. It's completely dependent on how many teams there are, how many points the team lost, etc. You're better off just doing ladder.update(). When a team is created we can do ladder.add(team); ladder.update();

Now theoretically we would want to have passed the team to a class that can make use of the filemanager before it gets to the ladder. The ladder should not even know that file manager exists and there shouldn't be a trace of it in the ladder class. Theoretically all the ladder should need to do is:

add(team) remove(team) update()/sort() get(int n) //returns top n people

All it needs to be is a linkedlist/array list that is wrapped in this class. Nothing else. That's how you keep a system loosely coupled and prevent it from causing bugs elsewhere.