Lua / Corona?

Discussion in 'Public Game Developers Forum' started by NickFalk, Dec 8, 2009.

  1. NickFalk

    NickFalk Well-Known Member

    Posted this over at macrumors as well, but maybe I'll have better luck here?

    Hi, there. I've recently become aware of the above mentioned language and SDK but fail to see the benefits the developers are claiming. Is their claim regarding speed of development simply down to the syntax of Lua or is there any bigger benefits?

    Has anyone here tried Corona? If so, can it be combined with objective-C code? Thanking you all in advance for any feedback. :)
     
  2. Flickitty

    Flickitty Well-Known Member

    Oct 14, 2009
    761
    1
    0
    iPhone Dev
    #2 Flickitty, Dec 8, 2009
    Last edited: Dec 8, 2009
    I don't know anything about Corona, however I know a LOT about Lua. My game, Flickitty is basically written in Lua with over 26,000+ lines of Lua Code.

    What benefits are you talking about?

    Lua runs extremely fast on mobile hardware. In fact, we get about 60 FPS on 2nd Gen iPod Touch, which puts it at among the fastest running Platformers/Ragdoll/Physics games out there.

    Lua has a very small footprint, also making it great for mobile hardware.

    Lua is very flexible, with hundreds of mods available and easy linking to different libraries.

    Lua allows quick prototyping- just like any scripted language, Lua does not require compiling so minor changes can be made very quickly and tested. This is the biggest benefit that we saw with Flickitty- I was able to test hundreds of control schemes in a matter of days (not weeks).

    Lua is Object Oriented, which allows you to apply a single script to an object and let it run on its own. Flickitty has hundreds of objects in-game, all running simultaneously with full physics. Each object has its own script.

    Lua has a very simple sytax, without redundancies nor bloat. You don't have 300 different ways to manipulate a string. Porting code from ActionScript to Lua is pretty easy, even though the languages are not similar in syntax.

    Lua is used in World of Warcraft, among thousands of other projects.

    Lua does have a few things that may take a bit to get used to. Arrays start at 1, not 0. Actually, there isn't a such thing as an array, they are in fact tables, but you can insert/push data into the table like an Array. Lua also makes all variable GLOBAL by default, unless you explicitly declare them LOCAL.
     
  3. ElectricGrandpa

    ElectricGrandpa Well-Known Member

    Sep 5, 2009
    344
    0
    0
    Game Developer
    Brampton, Ontario
    Hey Flickitty, do you have any links or anything that describe how get set up with Lua for doing development? You don't use Corona, do you? I'm just curious about your workflow.
     
  4. Flickitty

    Flickitty Well-Known Member

    Oct 14, 2009
    761
    1
    0
    iPhone Dev
    No, we don't use Corona. I had never heard of it until this thread.

    I haven't checked the official Lua Site for a while, but they might have some information there: http://www.lua.org/

    As far as workflow goes, do you mean maintaining the two seperate code environments while maintaining documentation/bug reports and testing?
     
  5. tukun

    tukun Well-Known Member

    Oct 7, 2009
    241
    0
    0
    or you can have a look at Squirrel scripting language. I use it at work n its awesome, very similar to Lua
     
  6. ElectricGrandpa

    ElectricGrandpa Well-Known Member

    Sep 5, 2009
    344
    0
    0
    Game Developer
    Brampton, Ontario
    #6 ElectricGrandpa, Dec 9, 2009
    Last edited: Dec 9, 2009
    Yeah I guess I'm just wondering what IDE you write the code in. It seems like an interesting approach... I assume it doesn't go against Apple's "no runtime scripting" policy because you can actually compile lua, is that right?
     
  7. NickFalk

    NickFalk Well-Known Member

    Strangely befitting as I hadn't heard of Lua at all until you mentioned it in another thread. It was googling Lua + iPhone that made me aware of Corona. I guess you must use yor own custom-code then?
     
  8. Flickitty

    Flickitty Well-Known Member

    Oct 14, 2009
    761
    1
    0
    iPhone Dev
    Apples runtime scripting policy is widely misunderstood. For the most part, what they DON'T want is an interpreter that downloads scripts- they want strict control over the code on the device. This is one reason why Flash isn't available in Safari (or elsewhere).

    Lua isn't compiled, nor is it hidden when we submit. The extention on the files are very plainly *.lua and there are several dozen of them. We do encrypt the files in order to prevent tampering.

    My workflow is wildly unexciting. I use Crimson Editor, upload the files directly to my Jailbroken phone using iPhoneBrowser, and archive my work manually. My code is fairly well documented, and I don't keep bug reports.

    However, since the 1.05 update was so massive, I kept a log of changes and bugs, and stepped through the list one item at a time until it was done.

    Dan East coded the game engine with about 99% C/C++. He uses Windows for this (Visual Studio?) and only links the necessary components for MacOS. Of course he uses a Mac to build Release and Distribution builds.

    Dan sends the Windows and iPhone builds to me for testing. I send content, including the Lua script, back to Dan so that he can fix bugs/debug or whatever based on my needs or analysis.

    Our two environments are completely separate.

    The game engine provides only the very basic functionality. To give you an idea of how flexible this is, our 1.05 update required only Lua to program. A small internal bug fix was done on the engine. This is my list of additions to 1.05 via Lua:

    * Mini Game- Snowball Challenge
    * In-Game Map Editor
    * Holiday Elite Hat
    * Elite Hats now have map/player modifiers
    * Breakable Tiles
    * Keys and Locked Tiles
    * Coin Collecting
    * Vending Machine (dispenses map/player modifiers)
    * Weather Effects
    * New Items and Objects

    As it is now, I could write a different game written entirely in Lua. It could be an RTS, RPG, Isometric, Top-Down, Puzzler, Touch Adventure, Classic Platformer... pretty much anything except 3D. Our 3D components were removed since they weren't needed.

    Wow, that was long-winded.
     
  9. TheBunny

    TheBunny Well-Known Member

    Nov 8, 2008
    205
    0
    16
    MMO Mac Lead ZeniMax Online
    Baltimore
    1. Mouse House 1 and 2 and BANG engine are about 20K lines of Lua also.

    Games run as MODS for the core engine all games are written in Lua and the engine runs on 5 platforms from iPhone, Wii, Mac, Win, Linux

    2. SOI2 free engine uses Lua

    3. http://www.stonetrip.com/
    Is a Lua based game IDE... works on iphone... windows only tho :p

    4. Apple changed the license to read that non scripts would be run.
    They took out the down load and run wording.

    5. That being said many many games in the app store use Lua.
    A number of the best selling games ever on the phone in fact.
    No I won't list them.

    Anyhow over the last year I have never heard of any app being rejected for usiung Lua or any scripting language.

    The only app Im aware of that was rejected was teh C64 emulator... and that was only after someone hacked it and found a way to load and run their own script or get to a command line like shell.
    This was later fixed.

    6. The best over view of Lua and what it looks like and what it can do is actually the wikipedia article and not the main site.

    http://en.wikipedia.org/wiki/Lua_(programming_language)

    7. Squirrel is a neat scripting language inspired by lua but with C /C++ style
    syntax, stricter syntax and some interesting and somewhat useful additions like highly controlled GC.

    I believe squirrel actually used parts of lua's runtime internally for tables etc. Tho Im not sure if the code was used or just the design.

    8. Lua has a much bigger community then Squirrel, Better support etc
    hundreds of add ons... I find Squirrel tempting but the trade offs vs the very active Lua community might not be worth it.

    /me stops babbling
     

Share This Page