is there any possibility to get exact time spent on a certain level in a game via firebase analytics? Thank you so much 🙏
I tried to use logEvents.
The best way to do so would be measuring the time on the level within your codebase, then have a very dedicated event for level completion, in which you would pass the time spent on the level.
Let's get to details. I will use Kotlin as an example, but it should be obvious what I'm doing here and you can see more language examples here.
firebaseAnalytics.setUserProperty("user_id", userId)
firebaseAnalytics.logEvent("level_completed") {
param("name", levelName)
param("difficulty", difficulty)
param("subscription_status", subscriptionStatus)
param("minutes", minutesSpentOnLevel)
param("score", score)
}
Now see how I have a bunch of parameters with the event? These parameters are important since they will allow you to conduct a more thorough and robust analysis later on, answer more questions. Like, Hey, what is the most difficult level? Do people still have troubles on it when the game difficulty is lower? How many times has this level been rage-quit or lost (for that you'd likely need a level_started event). What about our paid players, are they having similar troubles on this level as well? How many people have ragequit the game on this level and never played again? That would likely be easier answer with sql at this point, taking the latest value of the level name for the level_started, grouped by the user_id. Or, you could also have levelName as a UserProperty as well as the EventProperty, then it would be somewhat trivial to answer in the default analytics interface.
Note that you're limited in the number of event parameters you can send per event. The total number of unique parameter names is limited too. As well as the number of unique event names you're allowed to have. In our case, the event name would be level_completed. See the limits here.
Because of those limitations, it's important to name your event properties in somewhat generic way so that you would be able to efficiently reuse them elsewhere. For this reason, I named minutes and not something like minutes_spent_on_the_level. You could then reuse this property to send the minutes the player spent actively playing, minutes the player spent idling, minutes the player spent on any info page, minutes they spent choosing their upgrades, etc. Same idea about having name property rather than level_name. Could as well be id.
You need to carefully and thoughtfully stuff your event with event properties. I normally have a wrapper around the firebase sdk, in which I would enrich events with dimensions that I always want to be there, like the user_id or subscription_status to not have to add them manually every time I send an event. I also usually have some more adequate logging there Firebase Analytics default logging is completely awful. I also have some sanitizing there, lowercasing all values unless I'm passing something case-sensitive like base64 values, making sure I don't have double spaces (so replacing \s+ with " " (space)), maybe also adding the user's local timestamp as another parameter. The latter is very helpful to indicate time-cheating users, especially if your game is an idler.
Good. We're halfway there :) Bear with me.
Now You need to go to firebase and register your eps (event parameters) into cds (custom dimensions and metrics). If you don't register your eps, they won't be counted towards the global cd limit count (it's about 50 custom dimensions and 50 custom metrics). You register the cds in the Custom Definitions section of FB.
Now you need to know whether this is a dimension or a metric, as well as the scope of your dimension. It's much easier than it sounds. The rule of thumb is: if you want to be able to run mathematical aggregation functions on your dimension, then it's a metric. Otherwise - it's a dimension. So:
firebaseAnalytics.setUserProperty("user_id", userId) <-- dimension
param("name", levelName) <-- dimension
param("difficulty", difficulty) <-- dimension (or can be a metric, depends)
param("subscription_status", subscriptionStatus) <-- dimension (can be a metric too, but even less likely)
param("minutes", minutesSpentOnLevel) <-- metric
param("score", score) <-- metric
Now another important thing to understand is the scope. Because Firebase and GA4 are still, essentially just in Beta being actively worked on, you only have user or hit scope for the dimensions and only hit for the metrics. The scope basically just indicates how the value persists. In my example, we only need the user_id as a user-scoped cd. Because user_id is the user-level dimension, it is set separately form the logEvent function. Although I suspect you can do it there too. Haven't tried tho.
Now, we're almost there.
Finally, you don't want to use Firebase to look at your data. It's horrible at data presentation. It's good at debugging though. Cuz that's what it was intended for initially. Because of how horrible it is, it's always advised to link it to GA4. Now GA4 will allow you to look at the Firebase values much more efficiently. Note that you will likely need to re-register your custom dimensions from Firebase in GA4. Because GA4 is capable of getting multiple data streams, of which firebase would be just one data source. But GA4's CDs limits are very close to Firebase's. Ok, let's be frank. GA4's data model is almost exactly copied from that of Firebase's. But GA4 has a much better analytics capabilities.
Good, you've moved to GA4. Now, GA4 is a very raw not-officially-beta product as well as Firebase Analytics. Because of that, it's advised to first change your data retention to 12 months and only use the explorer for analysis, pretty much ignoring the pre-generated reports. They are just not very reliable at this point.
Finally, you may find it easier to just use SQL to get your analysis done. For that, you can easily copy your data from GA4 to a sandbox instance of BQ. It's very easy to do.This is the best, most reliable known method of using GA4 at this moment. I mean, advanced analysts do the export into BQ, then ETL the data from BQ into a proper storage like Snowflake or even s3, or Aurora, or whatever you prefer and then on top of that, use a proper BI tool like Looker, PowerBI, Tableau, etc. A lot of people just stay in BQ though, it's fine. Lots of BI tools have BQ connectors, it's just BQ gets expensive quickly if you do a lot of analysis.
Whew, I hope you'll enjoy analyzing your game's data. Data-driven decisions rock in games. Well... They rock everywhere, to be honest.
I've built a model in which a fleet of trucks delivers multiple orders to different customers. This model works fine when I perform one simulation experiment. However, when I try to run a parameter variation, the following error occurs: 'Error in the model during iteration x'. A snapshot of that particular error can be found in 2.
A question about this topic is earlier asked here:
NullPointerException during Parameter Variation Experiment with agent statistics
I have tried the tips given in that post but none of them seems to solve the problem.
I have replaced all the conditional transitions with messages in my state chart (see figure).
My data sets are stored in the database, so that cannot be the problem.
I can't get my head around why the model works with some seed values and with some not. I understand that finding the modelling flaw from just the snapshot is hard, but any tips on how I could find the mistake could be helpful.
PS: I have the learning edition so there is no debugger
Edit:
The error happens at a specific line of code written in the transitions pointing towards the state from the state "movingToClient1". The line that seems to cause the error is:
Order order = orderStore.myOrdercollection.get(0);
the iterations seem to work. However, I need it to be equal to one (to specifically measure certain KPIs of the last route). Hopefully, this helps in finding a solution.
The most likely thing to cause the problem is that your arraylist called collectionOfOrders is missused.
so at some point on the "on enter" of one of your states, you do :
collectionOfOrders.get(something)
when collectionOfOrders is actually empty.
sometimeswhat happens is that multiple things happen at the same time in your model, and when you ask if collectionOfOrders==1, another of your truck agents does the same and they both return true, which means that one of them will get the issue.
This happens only with certain seeds, because it occurs with a very low probability.
This is my guess, with the current information provided
Due to the insight given by Felipe and Benjamin, I found the problem in my model. My model starts with an import order with a specific arrival rate of one in a source block. The rate of 1 is equivalent to exponentially distributed interarrival time with mean = 1/ratedefined (https://anylogic.help/library-reference-guides/process-modeling-library/source.html). This means that it is possible for some seed values that the orders are generated at the same time. Therefore, changing the setting from 'rate' to 'interarrival time' solved the problem.
I have a problem where I have several events that are occurring in a project, the events happen semi-concurrently, where they do not start at the same time but multiple can still be occurring at once.
Each event is a team of people working on a linear task, starting at the beginning and then working their way to the end. Their progress is based on a physical distance.
I essentially need to figure out each events start time in order for no teams to be at the same location, nor passing eachother, at any point.
I am trying to program this in MATLAB so that the output would be the start and end time for each event. The idea would be to optimize the total time taken for the project.
I am not sure where to begin with something like this so any advice would be greatly appreciated.
If I understand correct, you just want to optimize the "calendar" of events with limited resources (aka space/teams).
This kind of problems are those called NP and there is no "easy" way to search for the best solution.
You here have two options:
Greedy like algorithm: You will have your solution in a resonable time but it won't be the best one.
Brute force like algorithm: You will find the best solution but maybe not in the time you need it.
Usually if the amount of events is low you can go for 2nd option but if don't you may need to go for the first one.
No mather which one you choose first thing you will need to do is to compute if a solution is valid. What does this mean? It means to check for every event wheter if it collisions whith others in time, space and teams.
So lets imagine the problem of making the calendar on a University. There you have to think about:
Students
Teacher
Classroom
So for each event I have to check if another event have same students, teacher or classroom at the same time. First of all I will check the events that match in time with the actual event. Then I will compare the actual event with all the others.
Once you have this done you could just write a greedy algorithm that starts placing events on time just checking if it collides with some other.
Hey pretty new to optaplanner. What I have is a process planning entity that has an "availability zone" and set of computers that also have an assigned availability zone. Since a process can only be put on a computer with the same availability zone I wanted to use the ValueRangeProvider to narrow down the possible selections to include only those computers (similar to how the example in the documentation narrows down rooms based on the teachers department). But there is no direct connection from availability zones to the lower level entities (i.e. computers) the object I am working with currently only points up.
I was thinking that I could just pass in the list of computers to every process and just create a valuerange list based on that similar to what I did below, but I was hoping for a more elegant solution. I was looking at filters but I could not figure out how to create a filter to restricted a possible move based on the planning entity and that entity's planning variable.
#PlanningVariable(strengthComparatorClass = ComputerStrengthComparator.class)
public Computer getComputer() {
return computer;
}
#ValueRangeProvider(id="computerRange")
public List<Computer> getPossibleComputers(){
return computers.stream().filter(computer -> computer.getAvalibilityZone().equals(this.getAvalibilityZone())).collect(Collectors.toList());
}
If anyone knows of something I missed or has any ideas I would much appreciate the help.
That code actually works as far as I can tell. See docs "Value Range Provider from entity" (as opposed to "from solution").
That being said, it does have limitations: some features do not support it and will fail fast if combined with value ranges "from entity" - most do these days so I wouldn't worry about it. Furthermore, it prevents the Local Search from breaking that hard constraints to escape a local optima, but that's usually not a problem.
Hello all!
I have a question about where should the seats be assigned to keep track if it's booked for a showtime.
There is currently two way i thought of.
1) Assign the seats to the showtime instead of cinema. However this means that for each showtime it may have a different number of seats( which should not be true).
2) Check if the seat is assigned by accessing moviergoer->booking-> movieticket->seat number.
This method is tedious and uses more processing time. But i feel it's the right way as it will mean that the seats will be fixed.
I'm sorry if any other part of my diagram is wrongly drawn. However please guide me through this main question! I will be glad to get feedback for other part of my diagram too.
I really hope to learn more from this scenario.
Your design seems ok so far. Just a few observations:
you should remove the navigation in general since it does not add much value
the association from Booking to ShowTime seems superfluous as the Ticket already holds the needed information
re-think about duplicating cinema/movie:string in ShowTime as it adds unwanted redundancy
why do you have a <<use>> iso. an association in Review?
A seat is related to the cinema and the cinema offers show times. So 1) is ok.
Edit: You would map the ticket like this:
The both ID roles would map the ids in ShowTime and Seat. I would use an artificial integer for the seatID and likely some HHMM format for the showTimeID.