I have an app where I open a HTML5 game in WebView, its a single player game where we match 2 players and who ever scores more wins the game. This has a time limit. There are users who use speed hack X8 Speeder for one. I am trying to find how do I avoid this.
How do I detect if a particular app is installed on the phone. Even if they change the app name
How do it detect if my APK has been patched or modified.
Any help would be great.
Regards
Mitsy
Off the top of my head, I'd try to verify game sessions on the backend. When game completes, your app sends the complete log of what happened to your server which then analyzes it. If the log was generated by a script (like this, for example: https://x8speeder.com/?p=77), it will have very repeated and detectable sequences. You can then discard this score and not put it on the leaderboard.
Related
First, I will confess that I haven't attempted this in code, so I apologize if this is jumping the gun. I realize that adequate effort and research are a prerequisite to posting good questions. But after reading GameKit and Game Center documentation, as well as iOS Developer Cookbooks, I can't seem to find the right functionality in GameKit and was wondering how I might venture outside it API-wise to solve this problem.
At the simplest level, I would like to implement a time-limited two-player game that does not shut down after one player disconnects, accidentally or maliciously (I currently make no distinction and do not know if I technically can). Essentially, once a match is made, and the two-player match begins, I want the match to continue until one player wins, or match time (say, 10 minutes) expires.
The thing that I want advice on is how to keep a match going when one player disconnects. (Currently, both players disconnecting simultaneously and prematurely leads to immediate termination of the match and no visible result, so no problem there.) How do I set the iOS client to select an action randomly if the user is disconnected? Do I need this program to run on the server, or on both iOS clients? Is it best done in Objective-C to match the iOS applications, or should it be server-side code in some other networking language, like PHP? Are there any APIs that handle this behavior well? On each turn, much like rock-paper-scissors, players have a one-minute time limit to select an action like attack or defend, and if the timer expires without a selection, the computer program randomly selects an action for the player. I'd like to treat a disconnected player the same way: If he or she isn't connected to the match to supply the choice of action, then the computer will do it randomly for him or her at the end of a minute, as if he or she were connected. My purpose for keeping matches online like this is to (a.) ensure that players that disconnect shortly before losing will be assessed a proper loss, (b.) players that stay online in good faith will be assessed their deserved win, and (c.) players that disconnect accidentally or haphazardly can still salvage their match by returning in a timely fashion. I'm sure lots of online games do this, but I just haven't found the proper API or past example for iOS, or two players connecting on their iPhones. Game Center seems to drop the match, or in turn-based games, there isn't some enforceable turn timer (to my knowledge); I didn't see a way to tell who disconnected in the documentation, and I also didn't see some obvious way to keep something online in the case of failure, but with a timer continuing to run. Everything in peer-to-peer seemed to simulate a client-server relationship (one peer the client, one the server), where if the server unit disconnects, the match must end, and if the disconnected player reconnects, the match cannot resume.
In short, I will not object to a code solution, but even some pointers or advice about a framework that supports this behavior will be very much appreciated. Thank you!
Did you consider turn-based matches with timeouts? If a remote player does not respond (times out) control could return to the previous player, which could then conduct intermediate random moves as and while necessary. The application of timeouts for similar scenarios is e.g. discussed in a WWDC 2013 session video.
If you've also implemented a mode where the user can start a game with a computer player locally, then it would be trivial to take any GameCenter game that's timed out and reload it as a local game against a UI.
My assumption would be that once you've implemented a local game with an AI whereby you're saving turns locally each time a player acts. Further, I'm assuming you would use the same data format for both types of games (perhaps changing a bit that says "computer player" instead of "remote player").
When the GC player times out, you code your game to swap out one type of player for another. Register in GC as a win/timeout, and allow the player to continue with the local/AI player.
I'm testing a turn based game between two devices. As far as I understand, sending a turn with [GKTurnBasedMatch endTurnWithNextParticipants:], for example, should automatically push a game center notification to the opponent. Sometimes, this works just as expected: the turn is sent and right away a banner notification shows up on the other device. All is well.
What is baffling me is that other times, even though the turn itself is sent properly (I can tell because when the opponent refreshes the matches, the match is up-to-date), there's no push notification coming in.
Are there any holes in my understanding here? If I'm understanding correctly, the inconsistent notifications shouldn't have anything to do with my code, because the issue here isn't how I handle notifications, it's that there is no notification at all. In other words, [handleTurnEventForMatch:] (aGKTurnBasedEventHandlerDelegate method) doesn't have anything to do with it (I don't think) because if no notification is being received, it's never going to be called anyway.
So, I'm just wondering if anyone has had any experience with this. Is it possible that this is due to something in my code? Or, is it possible that the Game Center sandbox is responsible for the inconsistencies, and there's nothing I can do about it?
Any thoughts or ideas would be much appreciated.
It is an issue with GameCenter's sandbox mode. In order for your device to enter sandbox mode you have to open/run your app and authenticate game center. If you say, open a different (published) game after your game is open it will leave sandbox mode and and go back to regular game center mode.
Even if your game is running in the background, as long as it is the last game-center enabled game opened you should get the push notifications as normal. But if you open the game, and then kill the process, you will no longer be in sandbox mode and will not receive the push notifications.
For those who are experiencing similar problems: this turned out to be a Game Center sandbox problem. It had nothing to do with my code, and things were fine in the App Store release. So, read through the comments here and make sure there aren't other things factoring into whatever issues you're having...but know that it's possible that you're simply experiencing some Game Center sandbox issues that are out of your control!
I am also facing the same problem. My game stops receiving turn events and turn notifications from Game Center, I finished my game and was testing, but this week, the problem started to happen. It was working like a charm but suddenly instances started not to receiving turn events for a couple of days.
I am using the iOS7 SDK and targeting iOS7 (turn event handling is different than prior iOS versions, I will need exchanges in upcoming game features, that's why I am using iOS7).
Then I made a test app to check if it was same with iOS6 and prior SDKs, but no help, it was same. So don't waste your time to upgrade your code to iOS7 hoping it would work, the problem is there. I also tried many things, like resetting devices and settings, using new users, etc.
I also tried it with Ray Wenderlich's Turn-Based Gaming with iOS 5 tutorial, by downloading source code, and it doesn't work neither.
The thing is, usually when I launch the game, game receives turn events, but after a few turns, it just stops, and when it stops receiving, stops like forever. If I reload the match, I can get the updated match and it's data is also updated, so I can make the turn. It means match is updated on Game Center. So, either Game Center is not pushing the data to users (possibly this is happening because user cannot receive notifications from Game Center when the game is in background), or the GameKit is not firing the event to the handler.
I don't know why it is happening, or why it started to happen, but I can't release my game like this, hoping that it would work out of sandbox. I will be trying a couple of more things (like maybe trying turn reminders of iOS7, to see if they push it to the user), then I will ask to Apple's support team. One other thing i am planning to do is, putting my test app to App Store and see it if works out of sandbox.
Hopefully it is a sandbox problem.
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.
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.
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!
I'm about to add highscore support to my mobile game and I have a basic understanding problem with leaderboard services like OpenFeint or Apples Game Center:
Suppose I'm logged in to OpenFeint and/or Game Center with my account. Then a pal of mine wants to play, I hand him my device and he gets the best score ever. Is there any way he can get his score listed under his name now? My understanding is that he can't, because when the game is over the score is saved, and it is automatically saved for the current account, which happens to be mine at that moment. Tough luck.
This would mean that if I play the game with my pal in turns we would constantly have to log in and out from both services after each game to get it right in the case that one of us gets a highscore. That seems a bit awkward...
Do I overlook something or is this just the way it works? Or do I have to take care for this situation as a developer? Or do the OpenFeint/GameKit SDKs handle this automatically somehow?
I don't know about Open Feint, but at least for Game Center I think the answer to your question is: Yes, that's just the way it works. Even if you know the Game Center id's for both you and your friend, you don't have the ability to save stats for anyone but the logged in game center player.
It does seems possible that they could have supported this use case, to allow more than one player to be "signed in" on a given device, and then the game could just present a "PlayerA", "PlayerB" button to choose who's playing, instead of having to run the Game Center app to do the switch. But I imagine this use case wasn't a super high priority. (They'd rather have each of you playing on your own devices. And in fact some services like ScoreLoop keep things simple by enforcing a single player per device, period.)
I'm developing a little 1-4 multiplayer jump & run for the iPad and have a problem regarding the synchronization.
The game uses the Game-Center p2p Connection to connect the devices.
Now my problem is,
what data should i send?
-> I have enemies, moving platforms, destructible blocks and Items.
when should I send the data?
Here are my first approaches to sync the PCs (playable characters):
1)
send position (x,y) every frame
--> physics and character don't interact, the character is set to the transmitted position
Problem:
lots of data to send
the PC lags sporadicly
2)
send user input whenever it changes
--> physics and character interact, only the opponents button actions are simulated
Problem:
the latency is not always the same, e.g. the time one button is pressed is not exactly the same on all devices. This means one PC runs longer/shorter on one device.
So what is the best approach to sync a little p2p jump & run game?
Thanks in advance. I appreciate your help.
what data should i send?
Send everything that you would need to know in order to perform the neccesary game logic. Send new locations of enemies, updated health info, etc.
when should I send the data?
Very frequently. You'll want fresh data when you update the screen so that the game appears to be very smooth. Ideally around 30 times per second. Some of the less important data may be able to be sent using the Unreliable method to cut down on network traffic.