Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: search / filter for decks that I already have all the cards and dice for #63

Open
golike opened this issue Dec 21, 2016 · 7 comments

Comments

@golike
Copy link

golike commented Dec 21, 2016

Subject line says it all. I'd love to be able to easily see a list of decks that I can make now with the cards and dice I currently own.

@stopfstedt
Copy link
Contributor

this seems rather complicated to implement and problematic from a performance-perspective. great idea tho!

@fafranco82
Copy link
Owner

Yes, a great idea that I've already thoguh, but as stopfstedt said, I need to think a way to this without harming performance.

@stopfstedt
Copy link
Contributor

So i looked into this some more, and I believe player decks can be compared using bitmasks and bitwise operators. This would require some database denormalization - bitmask values would for collections and decks would have to be calculated and stored in columns on their respective tables.

See here for a formatted braindump on the subject https://gist.github.com/stopfstedt/6f094b9c9d03702754ed56cff6141553

The same approach, simplified, could be applied for battlefields and player-deck dice.

Now, this will not work for character cards that are selected for each deck, because the rule of two max does not apply.

Perhaps this could be a possible compromise:

Instead of "show me all decks that can be build from my collection" a search feature "show me all decks that i can build with character/dice X" can be added.
Another take on this would be a "show me similar decks that I can build" on published decks (assuming that the user has all the characters-cards/dice for a given deck, which would have to be checked beforehand).

CAVEAT The approach outlined above has some issues regarding scalability - as new sets are added, more bitmask columns will have to be added. the SQL query for retrieving them will also have to grow. Performance will degrade over time.

@fafranco82 if there's any interest then I would have a stab at this over the holidays.

@fafranco82
Copy link
Owner

Commented on Gist (I've read gist doen't notify you whe someone comments :S)

@stopfstedt
Copy link
Contributor

@fafranco82 thanks for the feedback. i'll try the separate table approach first, seems more manageable. query performance remains to be seen...

@thecoolestguy
Copy link

👍

@golike
Copy link
Author

golike commented Dec 27, 2016

For posterity, another approach I was thinking of would be to pull the barebones decklist (deck id, deck name, card id, card quantity, dice quantity) and user card collection (card id, card quantity, dice quantity) down to the client, and then process the filter in javascript. Would likely be easier on backend performance, though at the cost of some increased bandwidth. Also, it shouldn't require any db denormalization.

Just a thought. Thanks for jumping on this idea, guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants