Best Practices using Firebase (Saving) - firebase

I'm currently making a online mobile game. It's like an online Idle Clicker.
In order to save the data I will use firebase. I'm still deciding if I should use the "Realtime Database" or " Cloud Firestore". (If any of you could help me too I would appreciate).
My main question is: When should I save my data ?
Saving the data every second is crazy because I will spend millions of euros. Even saving the data every minute seems not a viable solution to me.
I have searched and I can save the game everytime the user press the Home Button to leave the app. What if the user is playing and the phone dies?
Is there any other better solution that I am not thinking of ?
Thank you very much, Gonçalo

I would use OnApplicationQuit() for this. It's called whenever your game is closed. It won't be called if the device loses power though, so if you're worried about that you could start a timer when the game is opened and do autosaves every 10 minutes or on certain scene switches (if the player exits to the main menu for example).
This thread has more info on the topic that you may find useful.

Related

Holistic and simplified view for Airflow job status

Sorry if this is a dumb question. I'm still a somewhat novice dev.
I'm interested in creating a holistic view that shows the current status of every airflow job my team maintains. The point would be to simplify the view rather than having the user go into the Airflow UI to check the status. I would be interested in something along the lines of a front-end webpage that has a list of each of the DAGs and kind of a progress bar whose length depends on the number of tasks for each DAG. If a task is currently running, it would be light-green, solid green for success and red for failures. Similar to the Airflow UI but a lot simpler. I would also want the home view to show the current day with a left and right arrow to go through each day if the user is interested. Essentially it would be a airflow monitoring system for less technical users.
What would be a good way to go about this?
I'm also open to any other solutions anyone may have come up that could help with simplify monitoring a large amount of airflow jobs.
Kind of looking for some folks to help me brainstorm. Not sure if Stack is the right place for it. :)
I'll be the developer of this app so no need to pull punches as far as the technical end goes.
Currently, I'm thinking of using a standard web app where the screen will be populated by a log that I'll keep in a backend database that gets populated by a function that gets called whenever a task concludes within a DAG. The view will always show current day and whichever DAGs are scheduled to run during that day with whatever their progress is.
Airflow allows creating plugins to expose web views with FlaskAppBuilder, so you can create a view and add whatever you want in it, then add it to the Airflow UI.

Xamarin.forms how to add Local Reminder

I make a Xamarin.forms app and try to make a reminder. I follow this documentation.
I've created everything and tested and work perfectly fine. Now my scenario is every user can add one or more reminders. Reminder can be called from every hour to every day depending on how the user configure the reminder.
How to organize this? My main question is how to save that list of reminders in the device and depending on time the OS should call it?

Automatically read video and trim

So I am a gamer who loves editing videos and creating montages. I play a game called Apex Legends, and find that when editing long videos (Up to 5 hours long) I follow the same procedure every time. I skip ahead in the video until I see when I get a kill (Displayed in the top right of the screen as seen in picture below).
I then pause the video and begin the trimming process.
So my question is; Is there anything out there that can "read" videos? Assuming there is, is it possible to have a code that can read the screen, identify a change in kills, then trim say 5 seconds before and after that change? I am not asking anyone to write this code, but simply want to know if its possible
(Particularly with Python as that is my strongest language). Thank you all for your time and insight.

Efficiently matchmaking players in firestore

I'm working on a game that requires player matchmaking i.e. putting 2 players into 1 battle room.
While there are few players online in the game this is not an issue, however if we assume scenario of 1,000,000 players online at a time, who are all trying to matchmake, then picture becomes more complex.
Assuming following flow
My first instinct was to
When player clicks "play" call cloud function that checks if "open" battle room exists.
If there is one open, place player in it and start the battle or set battle to be active.
In case there wasn't an open room, we create new one and wait for another player to join.
However I see a lot of issues here given that we have 1,000,000 players who would be performing this action. For example, while performing step 2 and setting room to be "active" we might be pushing more players into it during the time those requests resolve?
If you want to deal with concurrency, I think you should use transactions to perform this action (adding a player to a room). That way, you ensure to check if the room is still open before adding a player in it. If 2 players start a matchmaking at the same time and find the same room, then only one single player will be added to that room
https://firebase.google.com/docs/firestore/manage-data/transactions
As far as I understand I can suggest One way to make it easier is have state of a user itself instead of calling cloud function to create room
Make user state like active, online, offline. When a user press play set its state active.
Call a query to fetch user where state == active , limit to 5(example).
start a transaction to match it with first user if succeed change status to playing for both else if failed ( you got matched to someone else or player you were trying with got matched to someone) check next player.
If during this you should be always observing your own state if it changes to playing because someone else matched to you then straight head to game.

How long should I wait to see a Sprint Burndown chart in RTC? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 5 years ago.
Improve this question
We've just set up a Rational Team Concert v3 system. The data was loaded on Friday, but there was an issue connecting to the report data warehouses that was not fixed until today (Monday). We've fixed it, and the data load operations seem to be finishing correctly now.
I'm desperately eager to see a burndown chart - even though I know that in 24 hours we won't really have enough data to make it useful. I'm also eager to see just about any report from the RTC server, as we want to be able to share as much information as possible with the customer, and this is a trial for RTC as a large team tool.
How long should one expect it to take before RTC is able to show reports relating to work items? We've already cached several data updates - but only within the last few hours.
Should we wait 24 hours? 48? should it show up immediately? Haven't found any good heuristics for this on the Rational site.
You need a few things to happen to get a decent burn down chart in RTC
Run the Data Warehouse job (this happens every 24 hours automatically, or you can trigger it manually from the Reports page in the Admin section.
Get some work done - complete tasks, set Stories to Completed, etc. The burn down is a graph over time of work done.
You should see progress on the chart after the two event above occur.
Another thing to check - is that specific burn down chart set to point to the right project and team?
If that does not work - you may want to raise the question with IBM support (sounds like something is wrong, or raise the question on the RTC forum on jazz.net
Closure - It turns out we had several problems. Problems included:
- incorrect account setup on the account syncing between RTC and the data warehouse - we had to both make a new account and setup more privileges for it.
- a truly messed up set of sprints. I don't know what went wrong with the Sprints that were first set up (by default!) with the project, but they did not ever sync properly. Moving tasks to a newly made sprint caused the tasks to show up properly in reports (after a sync), but the original sprints were simply broken. Eventual workaround - make new sprints, same dates, and move all assigned stories/tasks to them.
The final answer was - the data should show up instantly after a sync. If you think your sync shows new data and you don't see a change in your report, then you have a problem.
Other notes - the data in the selection fields in "edited" reports is based on the data in the warehouse. If you don't see a sprint or release in there, it means that the report search criteria is not showing that there is data in the column that you are looking for. Report business logic seems to vary by report - in some cases, not being able to select a sprint (or not having a sprint in the data that matches the "current iteration") - will cause empty reports.

Resources