I'm developing a multiplayer game with Nodejs which will have a Lobby where I'll have all the logic related to hosting and connecting.
Actually I have three files server.js, lobby.js and game.j, the last one is where I want to do the logic of the game, which will run on the server.
When I initialite the server I require both lobby and game.
var Lobby = require("./server/lobby");
var Game= require("./server/game");
And after on creating a room I use a method inside the Lobby object.
socket.on('createRoom',function(roomName){
Lobby.createRoom(roomName);
});
But into the Lobby when I create a new object game
createRoom: function(name){
var game = new Game();
It tells me that Game is not defined and shut downs the server... What do I have to do to use the module Game inside Lobby??? it's my first time using nodejs and I'm still a newbie and I don't know how to make it work. :/
Thanks 4 your help!