Answer the question
In order to leave comments, you need to log in
How to start processing the game quest correctly?
Good afternoon.
There is a database where quests are stored: It is
necessary to register for each quest (for example, registration will be 3 hours in one quest, and 5 hours in another) => I do it this way: I go through the crone once an hour and check the registration time, if any it turned out, then I change the status of the quest to "launched"
The essence of the quest: players walk around the map and click where they want to go + fight. There will be a table for the data of this map and another cron will run the script for example once every 10 seconds to update the data in this table + I will pull the data to the front and update the visualization.
Question: I can't figure out exactly how to run cron that will update the data table. The cron should only run when the quest status is "running". That is, one cron should go through quests and change statuses, and the second should start updating the table with the data of each quest. But the second one should start only when the quest is active and not just in time. The activity of the quest can be checked by pulling the data from the database and checking the status. Accordingly, if the status has changed to inactive, the second cron should slow down the work
There is an idea: both krone are launched at once, for example once in 1 hour, the second time in 10 seconds. In the second, the status (php) is constantly checked and if it is inactive, we end the script. There will be a lot of quests, so inside the php script you need to check which quest to execute and, through include, hook up the necessary logic of each quest and execute (change the data lines for each quest) But I don’t know how correct this is.
All the best!
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question