writing games in JavaScript Vs Cocos2d

Discussion in 'Public Game Developers Forum' started by iphonica, Aug 13, 2009.

  1. iphonica

    iphonica Member

    Aug 3, 2009
    12
    0
    0
    hey..
    I'm considering whether to develop my 2d game by using:
    a. cocos2d for iphone
    b. JavaScript (and connecting the player to my website).

    what other downsides(besides the need for an internet connection..) are there for using javascript as my main code for the game?

    It seems that javascript can run really nice&cool 2d games .. so why not use it? why should i prefer cocos2d? :confused:

    please share your experience..
    cheers.
    :cool:
     
  2. First of all, JavaScript is a computer language but Cocos2d is not. Cocos2d is an engine for making games. It isn't really a programming language; it is a tool to help programmers make games more quickly.

    The main programming language of the iPhone is called Objective C. You can also use other programming languages, like C or C++ to write games for the iPhone.

    One reason why you would not want to use JavaScript is because it is very, very slow compared with these languages. It also does not have many of the features of these languages. So, for example, if you wanted to have an image of a ball rolling across the screen based on how someone's finger touched the screen...that would be very hard, if not impossible, to do in JavaScript. It is something you should do with Objective C or another programming language.

    Also, if you make a game with JavaScript on your website, people who do now have the internet can't use it. You also can't sell it in the App Store.

    To put it simply, JavaScript is really made for doing web sites. You can make simple games with it, but it is not nearly as powerful as languages like Objective C.
     
  3. drunknbass

    drunknbass Well-Known Member

    Nov 8, 2008
    128
    0
    0
    actually js isn't a bad idea if you know it. Sure you won't be doing 3d and really amazing OpenGL things, but you might not need them.
    Js and HTML could be saved locally in a native app, executed it a webkit view. Could remotely update your code where that'd be impossible without a scripting language.
    With css3 and now html5 you can do amazing stuff. Things you can't do like sound effects etc could be hooked via your app "wrapper".
    That could leave you with a VERY portable game that could probably move to mojoSDK/pre easily.





     
  4. kohjingyu

    kohjingyu Well-Known Member

    Mar 20, 2009
    1,770
    0
    0
    Student/Developer
    Singapore
    Oh and btw, you don't have to connect it to your website. You can access a local .js file. I think.
     
  5. Stroffolino

    Stroffolino Well-Known Member
    Patreon Silver

    Apr 28, 2009
    1,100
    8
    38
    Software Engineer
    Pennsylvania
    For games that don't need accelerometer, multitouch, or 3d, JavaScript is underrated as a vehicle for creating games on the ipod/iphone. You can actually do some fairly compelling stuff in JavaScript - there were a number of excellent proofs of concept before the AppStore emerged, including a high quality Bejeweled port.

    The big downside is that without a native iphone shell you have no good way to make money from a pure web app, and you probably won't get much attention, either. Even if you don't care about making money, users are accustomed to using the AppStore to find and play free games.
     
  6. grid

    grid Well-Known Member

    Feb 17, 2009
    122
    0
    0
    iPhone Game Dev
    Minneapolis, MN
    Don't forget about phonegap! (phonegap.com) It'll let you get access to a lot of that stuff that js doesn't normally have access to (accelerometer, etc.). Also, it's a cool project.

    I'm not sure I'd ever write a game in .js, but more and more it's actually feasible in terms of performance and stuff. I saw a perfectly good tetris implementation not that long ago.
     
  7. schplurg

    schplurg Well-Known Member

    You can program in Unity3D using a form of javascript, or a number of other languages. It is compiled to something many times faster when the game is ...uh...compiled.
     
  8. iphonica

    iphonica Member

    Aug 3, 2009
    12
    0
    0
    Hey,

    Thank u all for the replies.... very interesting

    I guess I'll need to see if JavaScript capabilities meet my games needs..:)


    Does anyone know any iphone games done using JavaScript?


    Cheers
     

Share This Page