SOLVED: Don't let client write to minimongo, wait for server to calculate? (promise?)

Hi all, I’m having a neat problem where Meteor is too awesome.

I have a video game that updates the player X Y, works GREAT on Localhost.

On production, or even my other PC on the network, it ‘lags’.

I call the function, and MiniMongo does it’s thing and updates the player position. Great! Except… it’s actually a bit wrong. It’s off by a small amount that the server calculated.

The problem is that the X of the player goes to 8, and the server calculates 10.

The players position in the browser goes to 8, and then very quickly to 10. It ‘jumps’.

So how do I tell Meteor NOT to update mini mongo during this function: movePlayer(mouse.x, mouse.y)


Oh. Duh.

Wrap your function with if(Meteor.isServer){ }

Solved! COOL.

1 Like