Cocos engine in node.js

Hi i have developed a game with cocos creator and now i want to make it multiplayer with nodejs.

I want my server can handle object create, destroy, movement and collider event like in cocos creator.

Can u tell me how to use cocos core/engine in nodejs server.

I searched and try cocos engine github but dont know how to use it ( I build it via gulp successfully, play the test unit in browser ok but dont know how to achieve my need)

No Idea, just thought interesting idea. Sounds like will be much fun. I will be getting deep into Node after may :slight_smile:

Let me ask our engineering team to take a look. I think know this info would be beneficial to all Creator developers.

Yes Brilliant - Having your engineers look and comment would be valuable. The Jedi Coders :slight_smile:

You should simulate an editor environment. Search “Editor”, “process”, “electron” in the engine code to see how to achieve it. And try something like

global.Editor = {
    isMainProcess: true
};
process.versions = { electron: "" };

Hi i now can use engine in Editor environment :slight_smile:

global.Editor = {
    isMainProcess: true,
    versions:{}
};
process.versions.electron = "";

var em = require("./engine-master");
for(var i in cc){
    console.log(i);
}

But since it is in environment, there is no node object so i cant use the Node Action rules as i want. I will research about it, but any help is so wonderful.

I have gone to this so far :slight_smile:

require("./engine-master");

require("./engine-master/cocos2d");
require("./engine-master/cocos2d/actions");
require("./engine-master/cocos2d/core/CCScheduler");

var new_node = new _ccsg.Node();
var action = new cc.MoveTo(0.5,cc.p(640,360));
cc.director = new cc.Director();
cc.director.init();
new_node.runAction(action);
console.log(new Date());
setTimeout(function(){
    console.log(new Date());
	console.log(new_node.x,new_node.y);
},2000); 

It doesn’t work yet, but it is still a good signal :smiley:

1 Like