需要有关如何在 mysql 中保存 rpg 游戏的所有库存更改的建议
我一直在创建角色扮演游戏,现在我正在为我的玩家做股票市场,他们可以买卖股票。股票价格是随机的,股票价格每 20 分钟变化一次。因此,我必须将每一项更改保存在 mysql 的一个字段中,因为我想向玩家显示上个月更改的图表。例如。第一个股票价格是 100 美元,然后,2 小时后字段看起来像:“100-105-98-125-149-135”。因此,对于整个月来说,它将是 3*24*30 = 2160 个随机数。我想我可以做得更优化,也许你有什么想法?因为我不知道过了月后该怎么办等等。非常感谢。
顺便说一句:我的英语很差,所以我不能很好地告诉你我所有的想法,所以很抱歉。但我仍然希望你能理解。如果没有 - 询问。我们将很高兴回答。
I've been creating rpg game and now I'm doing stock-market for my players that they could buy and sell shares. Stock prices are random and stock prices changes every 20 minutes. So, every change I have to save in mysql in one field because I want to show players graph of last month's changes. For example. first stock price is 100$, then, after 2 hours field looks like: "100-105-98-125-149-135". So, for whole month it would be 3*24*30 = 2160 random numbers. I think I can do more optimal, maybe you have any ideas? Because I'm not sure what to do when month pass and etc. Thank you very much.
btw: my English is quite poor, so I can't tell you all my minds very properly, so sorry. But still I hope you understood smth. If not - ask. It will be pleasure to answer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会推荐一张包含股票信息的表,然后使用另一张表作为交易日志,将每次股票价格变化作为记录。您可以提取股票的所有行以获取历史记录,并提取最近的行以获取当前价格。
I would recommend one table with the stock information and then another table as a transaction log with each stock price change as a record. You can pull all the rows of a stock for the history and the most recent for the current price.