Answer the question
In order to leave comments, you need to log in
Implementing an infinite user profile level?
I didn’t find open source projects to see how they do it, I want to ask you for advice, dear readers of the question. How?
I imagine it like this, in the users table there are columns: level, current_experience , next_level_experience . Let's consider a situation, a user of the 2nd level posted an article, he was given 50 exp. You need 25exp to the next level. The table will look something like this: level = 2, current_experience = 0, next_level_experience = 25 . After the posted post, we carry out the calculation and approximately the following actions:
- get exp for the action and if exp >= 25, then level ++
- now increase next_level_experience + 15%, before that it was 25, add + 20% the next level now with next_level_experience = thirty
- we still have 25 exp left from the last action, so if exp > 0 another sql query, where we write that the user received +25 to current_experience .
After all, we have the following layout in the table:
level = 3, current_experience = 25, next_level_experience = 30
I wonder if this is true? Is everything correct? Will there be any problems in the future with such an algorithm? Perhaps someone has advice or ready-made developments, open source projects?
Answer the question
In order to leave comments, you need to log in
I'm wondering if that's the case? Is everything correct? Will there be any problems in the future with such an algorithm? Perhaps someone has some advice or ready-made developments, open source projects?
I imagine it like this, in the users table there are columns: level, current_experience, next_level_experience.next_level_experience will only be needed if for all users the number of exp. to the next level - different, i.e. one needs 100exp for level 5, the other needs 200exp until level 5, and so on, respectively, to the level column - about the same, as applied, it is needed only if we cannot manually calculate this number for the current specific user.
When reading diagonally, it seemed that one entity lives in two places and there is a risk of mismatching the value ...
By
the
way, I would look at something like:
accumulating points,
level
+ separately:
a grid of levels the transition from level to level will be "late" from points, for example, by the frequency of recalculation, but the level grid can be developed and supplemented with a bunch of rules and conditions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question