kwangde7 Posted April 2, 2014 Share Posted April 2, 2014 Hello guys, I am totally new bee to HTML5 development, but have some experience in Web Dev with Node.js.Now, I am trying to build a game that receives data from other API and use it in game. So, I built node.js server to receive data from API using MongoDB. For better performance, I want to use cocoonjs and here is the issue. Because of their parse documentation, it's hard for me to understand how to prep for files to compile using cocoonjs complier. What they says in their documentation to upload to cloud, you need to create one js file(preferably),and zip and upload it. But I have no idea how to prepare for this. My server structure is like this : -Package.json-app.js-settings.json(for clientID and secret for API communication)-------node module-------routes(all js file)-------views(all jade file) and all my game was built on top of one of the views file to interact with data. Here is the link that will show the structure clearly. I am using one of the library called "shakes"https://github.com/jonezy/shakes If any of you have an experience building a HTML5 game with Node.js as backend side and compile with cocoonjs, could you please explain how to prep all files to upload to cloud? Best, Quote Link to comment Share on other sites More sharing options...
Videlais Posted April 3, 2014 Share Posted April 3, 2014 This is probably not going to work. CocoonJS acts like a browser. While it would probably understand most of the JavaScript involved, it does not have the same internal API as Node.js does. Things like require() don't exist natively in it and it wouldn't know to load the necessary node modules to get everything working correctly. However, that doesn't mean you couldn't change things or even use something like Browserify to build all the browser dependencies for you. You would just have to aim at making things work as if you were going to use Chrome or Firefox instead of server-side development. Quote Link to comment Share on other sites More sharing options...
suyashmohan Posted April 19, 2014 Share Posted April 19, 2014 You can Split your game into two parts : Client Side and Server side. CooconJS is like a web browser with better canvas implementation so it will not understand node.js code. Rather you can create a game in a way that it only renders the game and the node.js logic is separately hosted somewhere else. Quote Link to comment Share on other sites More sharing options...
Agnostic Posted April 22, 2014 Share Posted April 22, 2014 I am using NodeJS + Socket.io + MongoDB + Phaser + CocoonJS http://github.com/Agnostic/js-morpg Quote Link to comment Share on other sites More sharing options...
away168 Posted April 25, 2014 Share Posted April 25, 2014 Node.js is the server, and CocoonJS is the client. Unless CocoonJS is created/wrapped using Node.js like node-webkit, which isn't, you can't. A clear understanding between front-end code and back-end code would help you on determining your project structure. This means you may want to separate your project between your Node.js + MongoDB server-side application and your client-side JavaScript application wrapped using CocoonJS, especially when you are talking about API. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.