Skip to content

Instantly share code, notes, and snippets.

@defHLT
Created October 30, 2013 14:51
Show Gist options
  • Save defHLT/7233962 to your computer and use it in GitHub Desktop.
Save defHLT/7233962 to your computer and use it in GitHub Desktop.
2013-10-29 22:44:55 icedp hi
2013-10-29 22:45:11 icedp is it true that JS binding work both on -x and -html5 ?
2013-10-29 23:09:30 -- PuffTheMagic_ is now known as PuffTheMagic
2013-10-30 00:23:24 riq_ icedp, yes
2013-10-30 00:24:13 riq_ if your JS game uses the cocos2d JS API, or the Chipmunk JS API, or the WebGL API it will run on top of cocos2d-x + JS bindings, or on top of cocos2d-html5
2013-10-30 00:27:10 icedp is there any overhead for using JS on phones? I'm more interested in developing for android/ios, but cross platform with html looks cool
2013-10-30 00:28:22 icedp or should I go C++ in this case?
2013-10-30 00:36:50 riq_ icedp, it depends on your game
2013-10-30 00:37:18 riq_ match-3 games, puzzle games, simple arcade games could run with cocos2d-x + JSB at 60 FPS on an iPhone 4S
2013-10-30 00:37:50 riq_ But super CPU intensive games might not be suitable for pure cocos2d-x + JS
2013-10-30 00:37:59 riq_ what I recommend is:
2013-10-30 00:38:05 icedp but it's still much faster then html since rendering's being done through C++?
2013-10-30 00:38:35 riq_ - Develop your game in JS... and profile it... if you main loop is slow, then write in C++ and add JS bindings to it
2013-10-30 00:38:42 riq_ yes, correct.
2013-10-30 00:39:04 riq_ All the rendering, cocos2d animations, even physics are run in C++
2013-10-30 00:39:29 riq_ you pay a small price when you call C++ calls from JS.
2013-10-30 00:39:46 icedp oh so you can write only part of the game in C++?
2013-10-30 00:39:51 riq_ yes
2013-10-30 00:40:01 icedp that makes a lot of sense
2013-10-30 00:40:12 riq_ you can write 100% in JS, or 90%, or 50%... or 0%... it depends on your game and needs
2013-10-30 00:41:26 icedp or the 90% in JS and the other 90% in C++ ( :) )
2013-10-30 00:43:05 icedp ok then let's say I'm going to write in cocos2d-x in JS, should I look API refence for Cocos2d-html5 on this page? http://www.cocos2d-x.org/wiki/Reference
2013-10-30 00:45:42 icedp riq_: thank you for intro btw, very helpful
2013-10-30 00:47:33 riq_ yes, the cocos2d-html5 API is a good starting point
2013-10-30 00:47:47 riq_ icedp, also, take a look a the pre-built games that are bundled with cocos2d-x
2013-10-30 00:47:52 riq_ - MoonWarriors
2013-10-30 00:47:57 riq_ - CrystalCraze
2013-10-30 00:48:03 riq_ - Wateremlon With Me
2013-10-30 00:48:08 riq_ - Cocos Dragon
2013-10-30 00:48:34 riq_ Those 4 samples are written in JS, and they work on cocos2d-x + JS bindings, and on top of cocos2d-html5 as well
2013-10-30 00:53:13 icedp formats seems different
2013-10-30 00:53:15 icedp some has src
2013-10-30 00:53:22 icedp some has Source and Platform folders
2013-10-30 00:57:21 icedp whoa.. scenes? that means that was done by CocosStudio?
2013-10-30 00:57:41 riq_ icedp, yes... it is because we have been improving the code
2013-10-30 00:58:00 riq_ the the oldest example is Moon Warriors, a pure JS game
2013-10-30 00:58:21 riq_ then came Watermelon With me: Pure JS, with Chipmunk JS, plus a little of CocosBuilder
2013-10-30 00:58:30 riq_ then CocosDragon: JS + CocosBuilder
2013-10-30 00:58:39 riq_ then CrystalCraze: JS + Cocosbuilder
2013-10-30 00:59:01 riq_ CocoStudio doesn't support JS yet
2013-10-30 01:01:02 icedp CocosBuilder for iPhone and iPad it says
2013-10-30 01:01:07 icedp I need Android as well
2013-10-30 01:01:14 icedp I'm a little confused at this point
2013-10-30 01:01:24 riq_ CocosBuilder is a Mac editor, but generates code for cocos2d-x
2013-10-30 01:03:27 icedp I'm on linux
2013-10-30 01:04:03 riq_ you can create JS games (cocos2d-x + JSB / cocos2d-html5) without using any editor
2013-10-30 01:04:19 riq_ So, use Moon Warriors as an example
2013-10-30 01:04:31 icedp JSB?
2013-10-30 01:04:32 riq_ it is a pure JS game (no data generated with editors)
2013-10-30 01:04:39 riq_ JSB = JavaScript Bindings
2013-10-30 01:04:43 icedp oh ok
2013-10-30 01:23:44 icedp I looked examples and it works on html
2013-10-30 01:23:53 icedp but I can't compile -x
2013-10-30 01:24:01 icedp ../physics/CCPhysicsBody.cpp: In constructor ‘cocos2d::PhysicsBody::PhysicsBody()’:
2013-10-30 01:24:01 icedp ../physics/CCPhysicsBody.cpp:80:20: error: ‘UINT_MAX’ was not declared in this scope
2013-10-30 01:24:01 icedp , _categoryBitmask(UINT_MAX)
2013-10-30 01:34:08 riq_ are you using cocos2d-x v3.0 ?
2013-10-30 01:34:15 riq_ if so, yes, there is a bug
2013-10-30 01:34:25 riq_ it will be fixed in a few hours, or days
2013-10-30 01:38:04 icedp git://github.com/cocos2d/cocos2d-x.git
2013-10-30 01:38:23 icedp this one
2013-10-30 01:40:49 icedp recommend to switch to 3.0-alpha at least?
2013-10-30 01:50:57 icedp on the other hand I should use 2.2
2013-10-30 01:51:09 icedp since I want JS as well..
2013-10-30 01:55:03 riq_ both of them are good
2013-10-30 01:55:18 riq_ the only issue right now is that the v3.0 branch is not compiling for Linux
2013-10-30 01:58:11 -- n8o- is now known as n8o
2013-10-30 02:12:59 icedp a little confused http://cocos2d-javascript.org/demos/box2d-physics this is not the same as cocos2d-x JBI?
2013-10-30 12:47:09 k1t [04:20:12] icedp: No it is not the same
2013-10-30 12:47:09 k1t [04:20:54] Aside from the Box2d library that codebase is totally different
2013-10-30 12:47:09 k1t [04:24:26] its a different port
2013-10-30 12:47:09 k1t [04:24:34] of teh codes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment