2
\$\begingroup\$

I'm trying to understand the most logical way of creating an iOS game that runs continuously in the background.

For example.. you have tower and enemy waves. The game has endless enemy waves even when the game exits. When you open the game again, it will retrieve the data that occurred when the app was closed.

I assume a database on a server would be the best solution. The values continuously increment on the server. The game connects to the server and retrieves the specific user's updated game data.

\$\endgroup\$
4
\$\begingroup\$

If the enemy waves only effect one player (the one that plays the game), then I really see no need to put this logic on an external server. Having a server would also require an internet connection which can't be taken for granted (especially on iPods and iPads).

You could simply store the time when your game exits or goes to the background. Upon relaunch get the time that passed and fast-forward your game by that time-amount. Of course you need to implement your game in a way that will allow you to run the simulation at a much higher speeds so that the user doesn't have to wait for ages until your simulation is up to speed.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Thank you for the response. However, are there ways to prevent users from simply changing their game time to manipulate the system? \$\endgroup\$ – user2913669 Oct 29 '13 at 11:00
  • \$\begingroup\$ i would echo this if it is a single player game you should be able to simulate what occurred in the time period between exit and restart \$\endgroup\$ – RoughPlace Oct 29 '13 at 11:00
  • \$\begingroup\$ in RE: to your comment, do not use system time, make a call to a clock service and store that time if people really wanted to get around it they could but you could compare the system time with the service time both before and after to check (as well as any older exits/restarts) \$\endgroup\$ – RoughPlace Oct 29 '13 at 11:02
  • \$\begingroup\$ @user2913669 There are always ways to manipulate a system. If they gain resources over time, they could just as well increase the resources directly instead of manipulating the time. But your question wasn't about cheat-protection. There are several questions on this site about stopping cheaters already, so you might want to read up on these. \$\endgroup\$ – bummzack Oct 29 '13 at 11:05
  • \$\begingroup\$ Thank you for the responses! @bummzack The goal of the app would be to offer in app purchases such as speed up the time using a boost. So my question is actually, which way is the most feasible way to create a game centered around continuous gameplay while offering secure in app purchases that can't be easily hacked. \$\endgroup\$ – user2913669 Oct 29 '13 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.