我有一个游戏,当一个动作完成后,我需要给用户一个项目。每个项目将有一个独特的代号。每个行动都在自己的表格中储存和描述。每个行动都有自己的奖赏,但我要一个行动能够给不同数量的项目,也许没有。
迄今为止,我有三个办法:
- Set three columns in each action row for item ids. The downsides is that it leaves redundant empty cells when the act doesn t give three items, but the upside is that it s simple.
- Set only one column that holds multiple values separated by spaces. It s a little less redundant than the above, but it requires a little more processing for separating the values.
- Make a new table for rewards and set each row with an item and an action that the item is for. Then, when the action is completed, it calls all rows with the action id from the rewards table. This has nearly zero redundancy but requires an extra query.
你认为哪一种方法最合适使用?