I want to make a kind of online game, completely in JavaScript, using the <canvas> and socket.io. The general How is covered, there are just some minor problems with the design and architecture I want to ask some people with experience (i.e. you).
Can I trust the client?
In a game with a dedicated client (about any MMO), the collision handling and animations are handled by the client. For that, a specialised protocol is employed. My game will not have complex levels, but communicates over HTTP, using JSON. So can I trust the client with collision detection and interaction, or should the server do that? And can I trust the client with executing simple commands like emotions?
Update often vs. Update collected
Using socket.io, I have a communication similar to that of other MMORPG, a steady connection with messages. In my design so far, the client sends the player's position and animation frame with every update frame. When the server gets that message, it broadcasts it to all the clients, which will then move the graphic accordingly. Would it be a better idea to 'collect' these and broadcast them, say, once in 1/10 of a second? Also, should the client send many different messages (exp gained, clicked on item) or rather just one collected?
Different Channels for Game and Socials
I heard that especially 3D-MMORPGs channel their chats over entirely different servers. I can't do that, but maybe convince
socket.ioto employ different ports and thus differentnode.jsserver programs.Useful Persistence
Does it make sense to save the player's coordinates and state with every time they send it? Node.js can do that easily without blocking a response, and I want to employ a Mongo database, but maybe it's more appropriate to do that once a second, in a server-wide event.
Uh, that is what I have in mind for now. I hope these don't seem stupid, I kind of can't discuss them somewhere else.