I have 2 arrays of JSON objects, actions and game objects.
At any time a user can make a request from the client which can add an action to the actions array.
I have a setInterval(function(){ }, 1000);
that runs every second and first loops through all of the actions, doing them in order then dumping emptying the array. Then it for loops (on the length of the array) through all the objects and does change processing such as healing, repairing, consuming resources, updating location of travelling objects, etc.
Each game object is tied to a user and when it is done being modified it will push out to them using socket.io all the data they need for their current view (assuming they are in an active session still).
Is this right? Am I not taking advantage of the node.js event loop as well as I could for this?