As I'm creating a 3D Tic-Tac-Toe game, I'm having several modules inside my JavaScript application. For example, there is a 3D module which handles perspective calculations, whereas a Multiplayer module manages everything with relation to online playing.
Is it good practice to put functions of each module in its separate object?
I currently have:
multiplayer.js:
var Multiplayer = {
socket: new Socket("ws://192.168.0.100:123/test"), // Relevant variables concerning multiplayer stuff
createSession:
function() {
//...
}
}
renderer.js:
var Renderer = {
f: 200, // Relevant variables concerning 3D rendering stuff
g: 200;
render:
function() {
//...
}
}
and so on.
Is this a good practice of organising my project? Or is there a more efficient way?