Original Post
Hello everyone,
I've been working on a trading card game for quite a while and there's a question that has been bugging me for so long. I went with one design but I keep questioning my choice. The issue is about how do I handle the cards that belong to a player. I have 2 choice.
Method 1 - Keep a list of how many cards he owns per card type. For example "player x has 17 card of type abc". This is the easiest way, takes little space in my sql database and can grows with no problems. However it is very hard to spot bugs that would create (dupe) cards and I believe it might be an issue. Since a single card has no real id, cards can be created and destroyed -very- easily. That is the main reason why I went with the second method.
Method 2 - Every card has a unique id, so I can track informations like: when was this card created and why ? To whom was it created for. I can also follow the trading history of any particular card. I have a lot of data on every card to cover any needs I might have. However the downside, and it is a major one, is scaling. I will have so muchhhhhhh data to handle it's unbelievable. For instance, every time I want to get the list of cards of a particular player, if that player has 10k cards, it's 10k rows instead of say, 500 (assuming that's the number of different cards he owns). Multiply this by the number of players and the numbers are huge.
I'm afraid if my game ever becomes popular and I stick with method 2, I could have big problems. If I am to switch methods I would rather do it sooner than later.
I've been working on a trading card game for quite a while and there's a question that has been bugging me for so long. I went with one design but I keep questioning my choice. The issue is about how do I handle the cards that belong to a player. I have 2 choice.
Method 1 - Keep a list of how many cards he owns per card type. For example "player x has 17 card of type abc". This is the easiest way, takes little space in my sql database and can grows with no problems. However it is very hard to spot bugs that would create (dupe) cards and I believe it might be an issue. Since a single card has no real id, cards can be created and destroyed -very- easily. That is the main reason why I went with the second method.
Method 2 - Every card has a unique id, so I can track informations like: when was this card created and why ? To whom was it created for. I can also follow the trading history of any particular card. I have a lot of data on every card to cover any needs I might have. However the downside, and it is a major one, is scaling. I will have so muchhhhhhh data to handle it's unbelievable. For instance, every time I want to get the list of cards of a particular player, if that player has 10k cards, it's 10k rows instead of say, 500 (assuming that's the number of different cards he owns). Multiply this by the number of players and the numbers are huge.
I'm afraid if my game ever becomes popular and I stick with method 2, I could have big problems. If I am to switch methods I would rather do it sooner than later.