MArcomage

Free multiplayer on-line fantasy card game

Please log in

Progressor on 12:27, 8. Jul, 2010
I found this information useful to see there.
Why is it removed?
Mojko on 12:55, 8. Jul, 2010
Due to performance issues. To calculate this information for each player is too expensive. This information can be found at player's details section (for the selected player).
Lord Ornlu on 18:03, 9. Jul, 2010
Maybe we can allow the system to calculate which players have 2 or less free slots and show them in different colour? A simple If/Then query shouldn't be too expensive on the system
dindon on 21:18, 9. Jul, 2010
[Progressor: Removed redundant quotation]

Why would that be any easier than listing the number of free slots? The system has to fetch the exact same information.

The reason it's expensive is that the number of free slots is not stored as a column in the player table. To find out how many free slots someone has, the system has to basically look through every game being played and ever challenge, and count the number of them that involve that particular player. Multiply that by 50 users, and you can see why it would be expensive.

Incidentally, I think it would make sense to have free game slots be a column in the player table. I don't actually have an intuitive sense of whether it would be more efficient though; looking up a player's free slots would be much cheaper, sending a challenge and ending a game would be slightly more expensive.
DPsycho on 23:16, 9. Jul, 2010
Perhaps only have it show the free slots (and make the necessary calculations) when limiting the search to online players? People are probably only going to be looking for that bit of information when looking to challenge someone to play immediately, and if it's only doing it for those who are online, it's rarely going to be calculating for more than 25 people.
Progressor on 23:33, 9. Jul, 2010
So if I understand correctly, the number is calculated at the moment of a visit by any player to the players section.
It may be a silly idea, but what if you calculate it per player at some point*, store the number, so that the system only has to retrieve the number.
Maybe it will simply shift the load,
Maybe it gives you a good idea. XD

*If this point is the point of game creation / challenge, you don't have the 50 user calculate time issue, but only 2 users take the time. If then a player goes to the list, the values are retrieved (not calculated) from the list with the most recent numbers.
dindon on 23:40, 9. Jul, 2010
[Progressor: Removed redundant quotation]

Yep, that's basically exactly what would be involved in making it a column in the player table. I think it would probably be a smart idea, but it would involve rewriting a decent amount of code and altering the database, which might not be worth the time.

I mean, it's pretty rare for a player to have 0 free slots, right?
Lord Ornlu on 09:52, 11. Jul, 2010
dindon wrote:
Why would that be any easier than listing the number of free slots? The system has to fetch the exact same information.


You are right. Another suggestion I have (similar to Progressor's) is to calculate the number of free slots for a player, every N amount of refreshes of the Games section. N could also be represented by time, e.g. every 1 hour
Progressor on 12:45, 11. Jul, 2010
So the information is expected to be outdated...
I don't know if this is better in load, but if you choose a time it should be 5 minutes-ish to be functional.
DPsycho on 15:25, 11. Jul, 2010
Dindon had the best suggestion, really. Have it be a stored number for each player that is only changed when a challenge is made/accepted, when leaving a game, and when leveling increases the number of slots. That way, there's never any reason to run any calculations, let alone several players' at once.
Mojko on 18:54, 11. Jul, 2010
I agree that having free slots information in the players list is handy, but as Dindon explained, it's too expensive. On the other hand, if you want to challenge someone, you have to go to player's details and there you will see his number of free slots (and also it's true that most player have free slots).

Anyway, the only acceptable solution is the derived column (Dindon's idea). We currently have this implemented in forum - number of posts in a thread are not counted, but are stored as a table column and are updated every time a post is created/deleted. In this case we are pretty sure that this trade-off is worth it, because post creation/deletion are rare operations.

In case of free slots, it's different I think. Free slots would have to be recalculated each time something from these changes:

- incoming challenges
- outgoing challenges
- hosted games
- active games

Also, because of multiple cases the changes would be more significant compared to number of posts.
theultramage on 19:15, 11. Jul, 2010
One of the reasons why we decided to remove the overall free slots listing was the fact that everyone had at least one free slot, and only 3-4 people had less than 4 slots free. Under these circumstances it made the most sense to move the value into the player details, to accomodate people that still for some reason wanted to view that number.

I will not consider re-adding this information to the players listing until there's a need for it. Knowing if a player had empty slots would be useful if we had an over-saturated environment where everybody was playing everybody else. But even then we'd probably add it as a non-default search filter. Also, can't you still challenge someone even if they have no free slots? And can't you host games instead of challenging if you don't care who you play against?

: )