iPhone游戏暂停和恢复,值得实施吗?

发布于 2024-11-29 13:44:53 字数 787 浏览 1 评论 0原文

请允许我描述一下我的情况:

我想开发一款游戏,是回合制、付费游戏。这意味着您为一轮游戏支付一枚硬币,例如弹球游戏等。

问题是,当出现中断时,理想情况下游戏应该暂停,并在用户需要时恢复。实施这一点似乎是一个挑战。假设我的游戏被置于后台,我会将游戏状态保存在 ApplicationDidEnterBackground 中。然而,游戏在后台可能会或可能不会终止。因此,下一次启动可能是“全新开始”,或者“从上次保存的状态恢复”。

如果应用程序在后台停留的时间足够长,比如 1 周,几乎可以肯定其他应用程序争夺内存会导致游戏在某个时刻终止。当用户再次启动我的应用程序时,他们将从新一轮开始玩,这意味着之前未完成的游戏已经消失。

从客户的角度来看,这是不公平的。

我能想到的是,实现它,以便每当我的应用程序被带到前台时,我都会去检查是否有已保存的游戏。如果有的话,我会继续它。这带来了一个安全问题:

保存的游戏,无论是最原始的 plist 格式还是其他格式,都会被持久化,并带来安全问题。 (如果玩家编辑游戏状态并获得最高分 1000 万分怎么办……等等)

有没有推荐的方法来解决这些问题?

我看到一些应用程序干脆放弃保存游戏,并在恢复时开始新一轮。这些游戏并不是付费的,否则我可以想象用户会非常生气。

我见过一些应用程序可以保存游戏状态一段时间,但是当它终止时,下次启动时,它将开始新一轮。在玩家实际为这一轮付费的情况下,这似乎同样令人无法接受。

当考虑到崩溃的可能性时,我无法想出一个好的解决方案来确保付费客户能够玩整轮游戏。如果有相关经验的人能够分享他们的想法以及他们如何做出决定,这对我真的很有帮助。

Allow me to describe my situation:

I want to develop a game, that is round-base, and pay-to-play. That means you pay one coin, for one round of game, like Pinball etc.

The problem is, when there is interruption, ideally the game should pause, and resume whenever the user desires. Implementing that seems to be a challenge. Say my game was put into background, I would save the game state in ApplicationDidEnterBackground. However the game may or may not get terminated while in the background. So the next launch could be a "fresh start" , or, a "resume from last saved state".

If the app is left in the background long enough, say 1 week, its almost certain that other apps fighting for memory will cause the game to be terminated at some point. When the user starts my app again, they would be playing from a new round, meaning that the previously unfinished game, is gone.

From a customer point of view, this is unfair.

What I can think of is, to implement it so that whenever my app is brought to the foreground, I would go check if there was a saved game. If there was, I shall resume it instead. This poses a security issue:

Saved game, either in most primitive plist format or other formats, are persisted, and poses security problems. (What if players edit the game state and score 10 million points as top score... etc)

Are there any recommended ways to tackle these problems?

I see some Apps simply give up on saving the game, and a new round will be started on resume. Those are not paid to play games, otherwise I can imagine users getting very angry.

I have seen some Apps that saves the game state for a while, but when it got terminated, when next launched, it will start a fresh round. Which seems just as unacceptable in the case where players actually paid money for the round.

And when taken into account the possibility of crashes, I cannot come up with a good solution that ensure paying customer will get to play a full round of game. It would really help me if someone with relevant experience could share their thoughts, and how they make their decisions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无妨# 2024-12-06 13:44:54

这里有一个很棒的教程使用 NSCoding 来保存游戏状态。玩家编辑文件不会有任何问题,就像在 NSCoding 中完成的那样。如果用户真的想弄清楚如何取消文件编码并更改内容(这很疯狂),您可以做一些在将数据写入文件之前对其进行加密,因此用户无法更改它。希望有帮助!

Here's a great tutorial on using NSCoding to save game states. It won't have any problem with the player going in a editing the file, as it is done in NSCoding. If a user REALLY wants to figure out how to un-encode the file and change the contents, which is crazy, you could do some kind of encryption on the data BEFORE you write it to file, so there would be no way the user could change it. Hope that helps!

最美的太阳 2024-12-06 13:44:53

为什么不将回合结束与付款挂钩?如果该回合没有完成,则不收取任何费用。如果用户的积分在回合结束时不足,您可以让他们选择立即购买更多积分(通过应用内购买)以完成当前回合。

这简化了开发人员的任务,并且还提供了一种以不令人讨厌的方式提示用户额外付款的方法。

Why not tie the round finishing to the payment? If the round doesn't finish, no payment is taken. If the user's credits are insufficient at the time the round finishes, you could give them the option to purchase more credits immediately (via in-app purchase) to finish the current round.

That simplifies your task as a developer, and also provides a way to prompt the user for additional payment in a non-obnoxious way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文