How do I save the amount of cash a player has when they leave and rejoin my roblox game? - roblox

I need to have a cash system where when a player leaves the game, and joins on another day, the amount of "Cash" they have saves. Could I have some help. Thanks.

You cant do it locally on Roblox. You will need to have a database online that will save the state of cash to that player when he leaves, and also get it when the same player joins. Authentication is very important here

Related

Stop Game Speed Hack

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.

iPhone Game pause and resume, is it worth implementing?

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!

OpenFeint, Game Center and multiple users

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.)

iphone multiplayer game design

i've searched and read many articles and looked at the GKTank apple sample (can't see any specifics about my problem, seems to process events as they occur) but i can't see a sample or tutorial that seems to answer the following
in a multiplayer game over bluetooth/internet (maybe) how do you synchronise player interactions so that the correct game outcome occurs taking into account latency etc ...
for example:
A button is displayed to each player A & B on two separate devices connected via bluetooth
Player A presses the button (Player A is hosting the game and so latency is not an issue)
Player B presses the button just before Player A but his connection to Player A's device has at least a 200ms network latency
problem: the game needs to know Player B pressed first even though Player A's touch request would reach the game code first - i.e. no advantage to the hosting player.
i know the touch event has the timestamp and so i could ensure that the actual time of the press was sent from Player B to the game code... but not sure if thats the right approach and if it is where to go from there..
i expect the answer lies in some game time cycle where touches aren't processed immediately but within a game cycle...
any help on this or pointers to tutorial or specific source code that handles this would be appreciated.
adam
You might want to ask this question on https://gamedev.stackexchange.com/ , as it's a general question about multiplayer lag or latency, and not particularly specific to the iPhone.
You might be able to use timestamps to order the action messages. I think iPhones are synchronized to a date time server maintained by AT&T.
Well I have no actual experience with creating multiplayer games. But as is the case with most game developement questions, I suppose there is no wrong or right, so some logic thinking should do the trick.
Here are some thoughts you might want to consider:
Even if no latency is occuring on Player A's device, you'll have to introduce some to compensate for player B (and vice versa, since from Player B's point of view Player A is late too)
Thus, you'll need to introduce some kind of a "command stack" to buffer input from both players and execute the commands once both Players had the opportunity to contribute their inputs for a given point in gametime
You may want to introduce ping commands to measure the actual latency from time to time
Only one Device (the host) should be measuring the latency and announce it to the client
Based on the measured latency, calculate a time offset (relative to the hosts time) or delay for the commands in the stack (use the latency to convert Player B's timestamps to "local" time)
Keep the delay dynamic if possible, to compensate for varying latency (keep measuring latency throughout the session
If the actual latency peaks beyond the calculated one, commands from Player B may be put onto the stack late - make sure they will be executed anyway (lag may be experienced at this point)
You'll actually need two "layers" - the input layer, which exchanges, buffers and synchronizes the actual input, and a game layer, which receives the delayed commands from the input layer
So far, my 2 cents ;-)

Game Center API + In-App Purchases API = Two different user accounts for a single app?

If I have an app that supports Game Center and I'd like to provide Achievements for completing a puzzle pack that's sold as an in-app purchase, how do I sync the iTunes account that's being charged for the in-app purchase with the Game Center user account that's doing the buying? As I understand it, they're two separate user accounts that are accessed in two different locations (The Game Center account is accessed in the Game Center app and the iTunes account is accessed in the Settings app).
How do I avoid this from happening...
Game Center Player1 logs in, runs my app and purchases a puzzle pack
Game Center Player1 logs out, Game Center Player2 logs in, runs my app and plays to completion the puzzle pack that Player1 purchased and Player2 is awarded the Achievement.
Game Center Player2 logs out, Game Center Player1 logs in and finds the puzzle pack he/she purchased as already completed, so Player1 is unable to gain that same achievement.
Am I misunderstanding something with how these user accounts work? If not, is there a way to sync a Game Center account with an iTunes account as players log in and out of my game? Is there any kind of a work around for this problem? This seems like it would be a fairly common issue with any multiplayer games that sell content.
Thanks so much!
That is a good question. :) As far as achievements go, I guess you could store them on the device with the playerId from the logged in GKPlayer, and once an achievement has been finished for a logged in player, you synch with Game Center.
As far as synching iTunes and Game Center accounts I really don't know. Usually you store some information on whether a purchase has been made (i.e. a feature available) on the device. Would it be logical that using that feature (or being allowed to use it) should be device dependent, not GC user dependent? But then what happens if someone uses their account to just download your content again and again to their friends' devices?
Hmm... I hope some other people will share their thoughts on this. But I found that Game Center questions receive very low views and answers :(
So here's how I'm going to do this, it's actually a fairly straightforward approach. I'm going to locally track users progress in the purchased puzzle packs using core data, since it's quick to get up and running. Each time a new GC user logs in, I'll create a new user object and track their progress in the puzzle packs and report the achievements in GC when needed. When that GC user logs in later, I'll just adjust the state of the puzzle packs to match their current progress defined in core data. This way, any iTunes account can purchase the puzzle packs and they'll inherently be available to anyone using the device. Whenever any GC users log into GC and play my app, they'll all have access to the same purchased puzzle packs, but their progress and achievements will be maintained independently of other GC users.
If GC isn't installed on the device, I can disable all GC features and just init the app as tho there's only one default player.
Should be simple to do.
I am trying to come up with the solution to resolve this issue as well. If using the server product delivery mode, the problem could be largely resolved. The application sends the purchased items to server;sever deliver the item to application after checking credentials. There are some corner cases I still don't know how to resolve, basically to handle the case when the whole flow is interrupted, which depeneds on the implementation of IAP. Still not 100% sure yet.
Could you keep a record on the phone about which achievements have been bought by particular users, and then check which user is on and either enable or disable the purchased content - you'd have to have a means of keeping track of different players progress (I can see potential problems where a user might not be logged in to GC, etc etc). I haven't done this yet, tho I'm planning it for my next game.