How to handle cheating
So I have an iPhone game that I'm working on in which I would like the player's health to be replenished over time. The problem I have is that if I do it based on time the player can pause the game, change the system time, and then re-enter the game with full health and pick up where they left off. I have a few ideas, but could use some suggestions. The first was just to shorten the time that it took to refill so that it wasn't a big deal to wait a few minutes while playing. The second was to create some mini-game that would allow the player to fill up their health meter by playing instead of just waiting. Any ideas on an easy to code mini-game? What are some other ways I could handle this type of cheating?
Check out my current project on Kickstarter: Genegrafter
When you say "over time" do you mean in-game time, such as playing the game for 60 seconds, or do you mean real-life time, such as putting the phone in their pocket for 60 minutes?
If the former, then system time should be irrelevant. Most games that I've seen use their own internal time, not the system clock - so any changes to the system clock will not be reflected in the in-game timer.
If the former, then system time should be irrelevant. Most games that I've seen use their own internal time, not the system clock - so any changes to the system clock will not be reflected in the in-game timer.
. 22 Racing Series .
Nope, I meant real-time. And the problem with the iPhone is that you can't run background processes so the only way you could put it in your pocket and have it work is if you left the application open.
Check out my current project on Kickstarter: Genegrafter
Doesnt the iphone track like the number of seconds since 1970 or anything like that?
--------------------------I present for tribute this haiku:Inane Ravings OfThe Haunting JubilationA Mad Engineer©Copyright 2005 ExtrariusAll Rights Reserved
Just let them do it. If your player is willing to go to that much effort to get their health back in your game then why not let them have their fun?
Disregard the previous if your game is multiplayer-competitive, otherwise I think you're doing nothing but putting off potential players by going to undue effort to prevent this or similar cheats.
Disregard the previous if your game is multiplayer-competitive, otherwise I think you're doing nothing but putting off potential players by going to undue effort to prevent this or similar cheats.
- Jason Astle-Adams
I guess the real question is why does restoring health need to be related to the amount of real time that has passed since the player turned the game off? How does that promote the flavor of the game?
I mean I see that allowing the character in the game to regenerate overnight or whatever is somewhat more realistic than collecting hearts or something and suddenly being back to 100% normal health-wise but this seems like an overall bad design choice. You're almost punishing the player when they get in situations where they lose a lot of health and then forcing them to NOT PLAY for several hours in order to recover. I can see why you are asking about cheaters given this situation....
I mean I see that allowing the character in the game to regenerate overnight or whatever is somewhat more realistic than collecting hearts or something and suddenly being back to 100% normal health-wise but this seems like an overall bad design choice. You're almost punishing the player when they get in situations where they lose a lot of health and then forcing them to NOT PLAY for several hours in order to recover. I can see why you are asking about cheaters given this situation....
Your application runs on the user's iPhone anyway. He is free to temper with the code and cheat.
It's a game, after all. Board games don't prevent you to cheat either when you play without the watch of a referee.
It's a game, after all. Board games don't prevent you to cheat either when you play without the watch of a referee.
Why do you care about cheating in a single-player game? If someone is cheating in a SP game, then it's making them happy.
But also, your algorithm seems flawed. It sounds like you're putting a timestamp on the "when to heal to full" instead of just adding a deltaTime in each frame. So normally you'd have something like:
Since, when you're paused, update doesn't get called (because you are properly handling applicationWillTerminate and applicationWillResignActive [smile]) then you can't cheat health regen.
[EDIT: you could also just in applicationWillTerminate and applicationWillResignActive set a flag that the user exited, then when the user comes back you get another call i think called applicationWillBecomeActive. In that function then just add to your timestamp the delta between the current time and the new time. But the other way is a much cleaner architecture; generally system clock queries are expensive, much cheaper to pass a dt]
-me
But also, your algorithm seems flawed. It sounds like you're putting a timestamp on the "when to heal to full" instead of just adding a deltaTime in each frame. So normally you'd have something like:
float secTillRegen;float helthPerTick;//delta time is secondsSinceLastFramevoid update( float deltaTime ){ secTillRegen -= deltaTime; if ( secTillRegen <= 0.0f && health < MAX_HEALTH ) { health += healthPerTick }}
Since, when you're paused, update doesn't get called (because you are properly handling applicationWillTerminate and applicationWillResignActive [smile]) then you can't cheat health regen.
[EDIT: you could also just in applicationWillTerminate and applicationWillResignActive set a flag that the user exited, then when the user comes back you get another call i think called applicationWillBecomeActive. In that function then just add to your timestamp the delta between the current time and the new time. But the other way is a much cleaner architecture; generally system clock queries are expensive, much cheaper to pass a dt]
-me
In Fable 2 you could so the same thing - just go forward a hundred years on your 360 and you could buy anything you want. But as other users have said, if it is single player, it doesn't really matter. Providing it feels like cheating (ie, not just a button that the user can press), then only people who want to cheat will, and if they want to, whose it hurting?
-thk123botworkstudio.blogspot.com - Shamelessly advertising my new developers blog ^^
I think that any recharge system that actually makes you want to change the time is a bad one - it slows down gameplay, and probably doesn't achieve what you want (or you simply didn't think enough about all the implications, or about the kind of gameplay you want).
How about a recharge system that speeds up after the player is not being hit for a while? It'll encourage the player to find a safe spot every now and then to recharge. Or a recharge system where you can upgrade the recharge speed, among other upgrades - this requires the player to make careful choices.
Either way, I would first think about what kind of gameplay you want to achieve, and then about what recharge system would fit in best.
How about a recharge system that speeds up after the player is not being hit for a while? It'll encourage the player to find a safe spot every now and then to recharge. Or a recharge system where you can upgrade the recharge speed, among other upgrades - this requires the player to make careful choices.
Either way, I would first think about what kind of gameplay you want to achieve, and then about what recharge system would fit in best.
Create-ivity - a game development blog Mouseover for more information.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement