I am wanting to create an idle component for my rpg game where the player can collect resource over time.
I am wanting to implement some social features that will make use of these resources so I would like to keep track of this resource server side. My question is what is the best practice for such games when structuring it.
For example, if I was to increment the resource every second, I wouldn't be wanting to have the server run such code for every players and send out updates to resource count every second right?
What I am thinking of is to have the client receive the timestamp and resource count from the server initially, and handle the increment on player for the game play, and only when the resource UI needs to be refreshed or some action requiring the resource to be spent happens, I could calculate how much resource should have been accumulated server side to verify and confirm the usage of that resource.
Would there be any problems with the method I have thought up or any better way of carrying it out?