| 02-20-2004, 08:41 PM | #1 |
I'm using a multiboard in my game to track the number of kills that each player has made. I would like to sort them in descending order so that you can tell at a glance who is winning. What is the best way to do this? I can tell it's not an easy problem because from some screenshots I've seen of a multiboard being used like this, the author of the map did not bother/wasn't able to figure out how to sort the rows. I'm thinking that if I have to code the sort myself that the fastest sort than I could implement using triggers would be insertion sort (which is a fast sort for small n). But that is still n^2 comparisons that I must perform using triggers - is that too slow to do every 10 seconds I update the board? Also, doesn't altering the multiboard generate net traffic? So I probably don't want to be swapping rows of the multiboard until I know the correct order, or I'm gonna be sending a ton of swaps over the net. This is really a mess. I did have another idea... what if I displayed my kill count in a multiboard, but actually sort the player order in a leaderboard that I never show? This might be a really good idea because it's easy to use a leaderboard to track when players leave and subtract a row (I wouldn't want to add that special case to my sort!) Then I could dump the contents of the leaderboard into the multiboard. Is this a good way to do it? I have no doubt that I can cook up some triggers to sort my multiboard, I'm just concerned about it generating lag online. |
