mongodb - Meteor game laggy when 7+ users on -


i'm making multiplayer jeopardy! clone in meteor , having problems lag when 7 or players playing. example, if user clicks button on game board, should show money value of button instantly, since clicking calls method changes game state. if there's lot of users on takes 4-5 seconds money value show up. i'm guessing might have methods. game designed rooms collection stores information current game, state, current clue users see, etc. users' templates rendered based on 1 room object they're in. in client helpers, there's bunch of statements like

if(rooms.findone({_id: meteor.user().currentroom}).gamestate == 1) {   ....  } 

is using queries in helpers bad , possibly causing lag?

my methods have lots of calls rooms.update , timeout functions change game state. example:

rooms.update({_id: meteor.user().currentroom}, {     $set: {currentstate: 2, ..... }});  meteor.settimeout(function() {     rooms.update({_id: meteor.user().currentroom}, {         $set: {currentstate: 3, ..... }});     }, 3000); 

i thought maybe if several users calling method might reason lag. feel i'm making obvious bad decision in design of game or there's obvious problem i'm not seeing.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -