Some records about game development data update

      It has been 7 months since the blogger started working on the game. The framework is skynet. During this period, I mostly wrote about game activities and tasks. These things have a validity period limit.

      For example, the activity is recounted every day, the daily task is recounted every day, and the weekly task is recounted every Monday at 00:00. Then it takes a specific time to reset the user's data.

 

      What I just started was to reset the player’s daily activity data and daily task data at 00:00 every day. When I asked my manager for some questions, he looked at my code and his evaluation of my code was probably: There is nothing wrong with your writing this way, and there is no problem, but there may be a lot of unnecessary calculations. For example, if a player logs in today, he will not log in for three or four days, but you will also reset his data during these three or four days. If a player logs in once, he will never log in again. Will reset his data. There will be a lot of unnecessary db operations in this way. As the number of players increases, the processing volume will be large. When I heard it, I felt that tm was too reasonable, and the manager was really different ==! , Niubi, then he gave me some pointers and made the following records:

      1. Lazy update (it seems to be so called), when you need to reset data, go to reset, which can reduce a lot of db operations.

      2. Daily tasks, daily activities record the player’s participation time (task time). When the activity or task is to be updated, judge whether the current time and the activity time (task time) are the same day, if it is the same day , There is no need to reset. If it is not the same day, reset the player’s activity and task data, and update the player’s last activity time (task time).

      3. In the same way, if the time when the player triggers the event is greater than or equal to the time when the data needs to be updated, the data in the player db will be reset.

    

   

Guess you like

Origin blog.csdn.net/banfushen007/article/details/103107858