Why I Use CocosIDE and Lua to Develop a cocos2d-x game

Hello everyone I am a game developer like you guys.

I like developing games very much.
I believe that developing game must be an art.

You need to t practice in many ways and test all kinds of new stuffs as an Ascetic monk.

Finally, You must find the great wisdom to perform it more Convenient and Magic .

Are you still using Xcode to Develop your game on macOS

or Microsoft’s Visual studio to develop your game on windows.

How can you bare it. when you face the two Absolutely different style IDE just for one game?

Have you tried to make a crasy “Flappy bird” game?
Come on. Keep up with the trend!

so when my friend Full of ambition try to use whole day to write a “Flappy bird” game with c++.

I just finished it in a hour with lua language and drive out to enjoyed my time.

Today I’ll tell you
1,what is the Lua language?
2,why we need to use lua but to avoid use c++ to develop a game directly.
3,how can I get a Cross-platform magical IDE to help you Debug and quick finish a game.

What is Lua

Lua is a powerful, fast, lightweight, embeddable scripting language.

Why choose Lua?

Lua is fast

Lua has a deserved reputation for performance. To claim to be “as fast as Lua” is an aspiration of other scripting languages. Several benchmarks show Lua as the fastest language in the realm of interpreted scripting languages. Lua is fast not only in fine-tuned benchmark programs, but in real life too. Substantial fractions of large applications have been written in Lua.

If you need even more speed, try LuaJIT, an independent implementation of Lua using a just-in-time compiler.

Lua is portable

Lua is distributed in a small package and builds out-of-the-box in all platforms that have a standard C compiler. Lua runs on all flavors of Unix and Windows, on mobile devices (running Android, iOS, BREW, Symbian, Windows Phone), on embedded microprocessors (such as ARM and Rabbit, for applications like Lego MindStorms), on IBM mainframes, etc.

For specific reasons why Lua is a good choice also for constrained devices, read this summary by Mike Pall. See also a poster created by Timm Müller.

Lua is embeddable

Lua is a fast language engine with small footprint that you can embed easily into your application. Lua has a simple and well documented API that allows strong integration with code written in other languages. It is easy to extend Lua with libraries written in other languages. It is also easy to extend programs written in other languages with Lua. Lua has been used to extend programs written not only in C and C++, but also in Java, C#, Smalltalk, Fortran, Ada, Erlang, and even in other scripting languages, such as Perl and Ruby.

Lua is powerful (but simple)

A fundamental concept in the design of Lua is to provide meta-mechanisms for implementing features, instead of providing a host of features directly in the language. For example, although Lua is not a pure object-oriented language, it does provide meta-mechanisms for implementing classes and inheritance. Lua’s meta-mechanisms bring an economy of concepts and keep the language small, while allowing the semantics to be extended in unconventional ways.

Lua is small

Adding Lua to an application does not bloat it. The tarball for Lua 5.2.3, which contains source code and documentation, takes 246K compressed and 960K uncompressed. The source contains around 20000 lines of C. Under Linux, the Lua interpreter built with all standard Lua libraries takes 182K and the Lua library takes 244K.

Lua is free

Lua is free open-source software, distributed under a very liberal license (the well-known MIT license). It may be used for any purpose, including commercial purposes, at absolutely no cost. Just download it and use it.

Code Editor

Code Editor is a component of CocoStudio, which targets on excellent coding experience with Cocos2d-x Lua & Javascript API, and a seamless workflow with other editors of CoocStudio. You can create projects, write code, debug and publish cocos game in javascript or lua.

Features ready today (1.0.0.beta):

Create cocos2d Lua and Javascript project easily.
Prompt cocos2d-x Lua and Javascript API when coding.
Debugs cocos2d-x Lua and Javascript code in your iOS/Android/Windows player, either in iOS/Android simulator or device works ok.
Run Lua and Javascript script WITHOUT native compiling.
Update the modified scripts into player via CTRL+S. In other words, when you save your script file, the IDE upload it to player immediately.
Package and publish android apk.

DownloadEdit

Cocos Code IDE

Platform Full Test Version Download For Global Users Download from Chinese CDN
Mac OS X 10.9 Mac OS X 64 Mac OS X 64
Windows Win7/Win8 Windows x86 64Bit, Windows x86 32Bit Windows x86 64Bit, Windows x86 32Bit

How to install

Basic Requirements:

Install JDK. If you are using Mac OS X 10.9, please get this Apple modified Java package. /bin path must be added to the system path.
Install Python, Python 2.7 is best(On Windows, python path should become added to environment path).

**Note : **

1、Cocos Code IDE(1.0.0.beta) is base on cocos2d-x 3.0 rc2/cocos2d-js alpha2, and other version of engine will not work, so for using IDE please download corresponding engine.

2、The path of engine and project created by IDE can not include non-English character or sign.

For more detail you can reference

http://www.cocos2d-x.org/wiki/Code_Editor#Cocos-Code-IDE

How to Debug Cocos2d-x Lua Game Using Code IDE

basic settings

In Preferences/Cocos/Lua page, select the folder of cocos2d-x based on cocos2d-x 3.0 you have downloaded.

additional settings

If you need an Android runtime to replace prebuilt runtime we provided, you should tell IDE where the tools it need. In Preferences/Cocos page, select the folder where the tools be located.

Run and Test Game

  1. Create a new Cocos Lua Project named CocosLuaGame

  2. Right click the project in the Cocos Explorer

  3. In the pop-up menu, select “Debug As->Cocos Luabinding”, this will create a debug configuration with your project name

  4. Open “Debug Configurations” via Menu ** Run->Debug Configurations **, debug configuration we providing you is like this:

  5. As default, it will run the project’s lua script on the Mac prebuilt app. For convenience, I won’t change anything for this config. If you want to debug on other target platform, check the How to debug on other target platforms section.

How to Debug

##Breakpoints

  • Add breakpoints to lua source files, for examples, line 73 in main.lua

  • When the spriteDog arrive at the right edge of the screen, the breakpoint will be triggered

  • Select “Yes” button to open Debug Perspective, and you will find many useful debug views, Callstack view, Variables view, * Breakpoints view, etc.

  • Step over, Step into, Step out are also supported

You can also debug on other target platforms like IOS and Android. if you want to know more detail please move to here

http://www.cocos2d-x.org/wiki/How_to_Debug_Cocos2d-x_Lua_Game_Using_Code_IDE

Amazing pictures. :stuck_out_tongue: