PHP - How would you make buildings or such things finish etc? -
so know in browser-games such travian, tribalwars , etcetera, can build building, takes x amount of time , finishes. i'm curious how done?
is cron-job running every second or what? how doing troops, can't have cron-job running ever millisecond, wouldn't resource usage friendly, right?
so i'm curious , have no idea can't have tried. have searched around never found helpful.
thanks.
the easiest way implement simple timestamps. request on front end generates timestamp based on constraints given details of request (what type of building building, level are, if have bought upgrade). timestamp inserted database when completion occurs. then, if want browser refresh when job up, make script on js makes request timestamps in queue , reloads when come up.
Comments
Post a Comment