How do replenish game currency in intervals in my iphone app. - iphone

I'm making a game app in X Code. The users win and lose "coins" as they play. I understand that Apple requires that you make sure they eventually get more currency for free if they run out. I am going to have in IAP. However I want to put in some kind of time or other method to give them say 100 additional coins every day. So that if they run out they come back and will have a little more currency to play.
I'm very new and if anyone can suggest a simple way to do this it would be greatly appreciated.
Currently I store the currency in a long long variable called "coins". I am also using NSUserDefalts to store the amount of "coins". I am going to use that for the IAP.
Thank You!

Store the last time that you have given the user his free coins along with the remaining coins in the user defaults. Whenever you check the remaining "balance" of the coins, look at that additional variable, and compare it to the current time. If the difference is greater than 24 hours, give the user additional coins, and store the new value in the defaults.

Related

Create anonymous highscorelistor in unity

I have simple game on Google Play and Apple App Store that I have created in Unity. Now I am thinking about creating a global high score, so if you are in top 10 for example you can enter a made up user name.
The thing is I do not want the users to sign in since I want the game to be easy to access. One user can also enter a new username each time a record is beaten. So you can for example have the first three positions.
In principle, the app should read the high score from database and one should be able to write to it with {userID, new_score}, but no data is connected to any particular user. I am used to work with Firebase, what would be the easiest way to achieve this?
Thanks,
Erik
Well, the fact that you don't have data connected to any particular user do not means that you can't store the highscores. Cause one user can beat himself.
So if your database (I don't know if it's realtime or firestore) knows which are the top scores, when a user (indpendently of his ID) beats the score threshold, you can give him the option to put a name on that highscore, and update your database with this new score.
I will also recommend to bind users with data, his highscore or the name it's using to register the highscore, but you can achieve the same result without it.
You could try having a read and create only set of records, where write requires a valid anonymous auth key. I haven't tried that setup with Anonymous only auth before though.
Otherwise you could also try setting up a cloud function to validate and write the high score records.

Storing daily data in a mongoDB database using Parse

What would be the best way to store daily health related data (height, weight, calories burned, hours of sleep) in a Parse (MongoDB) database? The user will update their health data up to 10-15 times a day and I am unsure how to track their data in real time without having to create a new record every time they update only a certain piece of information. Currently I have a User class and a HealthProfile class, which contains basic information about height, weight, etc.
I could collect the data over the course of the day and then save it in the database at night however this will not work for database driven charts I want to display.
Data Interaction will be as follows: throughout the day a user inputs how much exercise they did, food they ate, etc. and the app will display a line/bar chart showing their progress/calories burned (or other health figures) for the day, week, and month. It will also include things like blood pressure and other measurements and I want to be able to store all of these things for a user and allow them to view their history, as well as input new data, at any time. It is a similar concept to how Apple's Health app works.
I will need to make sure the user's data is always persisted in a database so if they login on their phone or the website, their data is always up to date, so writes to the database will need to be upon user input and reads will take place any time the user view a chart or figure.
You really need to work out how you want to interact with the data. That will determine the best way to store it.
Once you have a clear picture of the different ways you want to read/write/use the data come back and ask clear questions to get help... currently it isn't clear what sort of help you want.

Tracking stock prices and email alerts

I have a google spreadsheet which helps us to track some stocks prices from the NASDAQ and DOWJONES. When I open the spreadsheet the prices automatically refresh via google finance built-in functions.
That is, for instance, the Apple price in a certain cell:
=GoogleFinance("AAPL";"price")
So far so good. Now we have a target buying price for each value and when the price falls below our target price we get an alert. I have written a script so that when this happens it sends me an email notification. Moreover, I have also configured a time-driven trigger which executes the script every 5 minutes.
But WHAT I really need is the WHOLE spreadsheet to open every 5 minutes not just only the script so that the Google finance funcions load and get the updated stock prices.
Is there a way to do that?
Not sure if this is the best approaching for a stock tracking spreadsheet so any ideas will be highly appreciated.
A standalone script will open a spreadsheet but it does not wait for the functions like GoogleFinance to complete so you may need to put in an explicit wait or loop until complete

How to make a demo game in Unity3d?

I have developed a game in unity3d for pc and mac. I want to publish the game with 30 days trial period.
How do I make it? How do I write into the system registry. What things that I should keep in mind while developing this trial version.
Whenever I search in google, I get trial version of unity3d not about how to make a trial game in unity3d.
The following article has a lot of information, but is pretty long.
Writing to Registry
Regarding saving to the registry, only do this if you have a big game and will be writing other values to the registry. If it's just a small indie game, then rather avoid the registry. People don't like it when small indie games write values into their registry, as most developers will never remove that value.
There are 2 ways. You could either make the user "login" to your server every time, also called "Online Validation". This way is more secure, but does require the user to login which is not ideal. You could use the following offline method. Please note that I just thought about this, so there might be small flaws.
Offline Method
You could get the current system date and time. Encrypt the date and time and save it to disk. Then every time the game starts up, get the system date and time again and check this "new" time to the date and time you have stored on disk. This check will more be to make sure the user has not modified the system date and time. Obviously overwrite the date and time every time the game is started, but obviously first check the value.
You'll know if the user has modified their time if the "new" date and time you got is not more than the old stored date and time. You could also get the date and time, just before the game exits. Then when the game starts up again, you can make sure that the current date and time is more than the date and time you stored to disk.
Also get the date and time when the game first starts up and save that. As you can then check exactly how many days until their trial runs out.
What you should keep in mind
Allow the user to keep their saved game (if they can save). So that when the buy your game, they do not have to start all over again.

iPhone app launching tips?

I just finished my first iPhone app. It's a little game and I want to launch it for 99 cents.
So my concerns is, how long usually does an app stay on the new released list. ALso, is there any launching tips on timing etc?
Thank you
These days apps stay on the new app list for hours rather than days. It used to be that updates gave you better visibility but but my last update caused barely a blip in sales so I don't think it is true anymore. This will probably depend on the categories you are in though.
The goldrush is sadly over. It used to be that merely being in the app store generated hundreds or thousands of sales. That is definitely not true any more. Now you need either luck or marketing.
Things you can do:
Provide review copies to as many
sites as you can find. Most will
have limited visibility but if you
can get onto a bigger site you may
get some sales out of it.
Provide a free limited version.
Build a mailing list on your website
Pimp it everywhere. In your sig, on your website
Start writing the second game
ASAP - why wait, right? In reality, your true launch date is going to be determined by Apple anyways depending on how long it takes them to review and approve your app.
One tip I've heard is to update reasonably often.
When you update, your app may reappear on some of the category lists as being recently added/updated. This can give you some extra visibility which might just be what gets you ahead.