addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwchatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgoogleimageimagesinstagramlinklocation-pinmagnifying-glassmailminusmoremuplabelShape 3 + Rectangle 1outlookpersonplusprice-ribbonImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruseryahoo

Scripting your Game with Lua

Sarah Smith has kindly agreed to share her knowledge of Lua with us next meetup.  I'm a long time fan of Lua having worked with it several times for various companies. It is easy to integrate and has good performance. Lua is fun and simple, yet it is a surprisingly powerful language.  And if you are into compiler development I highly recommend tracing through the Lua source code for a real world understanding of parsers and interpreters.

Scripting your Game with Lua

Lua is the scripting language of choice for lightweight & high-performance integration of scripting capability into otherwise compiled binary apps, especially games.  It's great for adding complex or customisable behaviour to your game objects, and for a host of other uses.  But how do you get started with making your game scriptable?  This talk will start with a basic iOS game written in Objective-C, and do scripting both ways - exposing objects in the game as scriptable elements, and having your game call out to scripts to perform customisable functionality.  The talk will be mostly absent of slideware and will comprise in large part a live coding demonstration.  Although the demonstration will be done using Objective-C, the techniques are directly portable to any C or C++ based environment.  Similar techniques work with C# (for Unity) and Java, although I won't cover the integration part here.  Note that although Corona and other toolkits have promoted Lua to a full development environment for your game, I won't be covering developing your game in Lua, beyond what is needed for this demonstration.  I'll make the source code and graphics used in the demonstration available.

Sarah Smith has been developing software for well over a decade, mostly in C++ on mobile devices.  Places she has worked include Nokia & Trolltech on the Qt framework, and Google.  She has spoken at Qt Dev Days in Munich and San Francisco; at Linux.conf.au & OSDC in Australia.  Currently Sarah and her partner Raymond run Smithsoft Pty Ltd based in Brisbane.  For 2013 she is devoting all her energies to iOS game development.  Check her blog http://indiegamecodingconfessions.blogspot.com for some of her latest work.

Join or login to comment.

  • Sarah S.

    For those working their way through the (very long) video, you might find a screen cast that I did of the same material easier to digest: http://indiegamecodingconfessions.blogspot.com.au/2013/06/script-your-game-with-lua.html -- its broken into parts as well, with a description of the content for each part.

    July 25, 2013

  • kris

    I'll admit I have not watched the entire presentation, but I've perused the source code and I'm curious as to your thoughts on extending functionality through something like SWIG? Its easy enough to create several small functions that bind to lua but can become very time consuming if you are producing a larger api.

    July 24, 2013

    • kris

      Okay, so I've now started more into the video and you used SWIG directly as an example. So the con you propose is that it's not very light weight. I'm still trying to make up my mind if that's the route I'd like to go because of the maintainability aspect. It feels cumbersome to me to add new features without some form of wrapper generator.

      July 25, 2013

    • Sarah S.

      Hey Kris - thanks for the comment. I know bindings generation looks attractive. My issue with binding generators is the intent is to basically generate bindings right across every method - that is not light weight, but its also often not what you want, unless you've been careful to somehow separate your game logic into an underlying framework that you can then happily say "all of this API I want to expose via scripting". In my game I just bound my 14th Lua function, and I found an approach of "the simplest thing that could possibly work" was best for this. Especially if you have level designers or some other folks like that in the pipeline, you often do not want absolutely all your methods bound - some could be dangerous, or prone to change. YMMV.

      July 25, 2013

  • Ashley D.

    Thanks Sarah for an excellent talk.

    The video is now online:
    https://www.youtube.com/watch?v=lMrI2kKccPs

    June 4, 2013

  • Tom P

    Impressive live coding! That was brave. And you made it look so easy.
    Now I want to see another presentation on using how you used that Lua foundation in an actual project - to see what it made easier.

    June 3, 2013

  • Sarah S.

    Hey guys, thanks for coming along and for the great comments. Slides are here: http://www.slideshare.net/sarah_jane_smith/lua-tut

    The slides are *very* brief talking points. Most of the talk was a hands on demonstration. My goal there was to show how quickly you can get Lua into your game and to demystify the process.

    If you're keen to check out the content having not been able to make it to the presentation, I suggest going to https://github.com/sarah-j-smith/LuaTut, downloading that and having a play with it - or at least browsing the LuaEngine.mm file at that location: https://github.com/sarah-j-smith/LuaTut/blob/master/LuaTut/LuaEngine.mm

    Also check Ash's video upload which should come soon. Regarding licensing - if you want to use the Lua integration boiler-plate from LuaEngine.mm please feel free to do so: the code is placed into the public domain as per README.md here: https://github.com/sarah-j-smith/LuaTut

    June 3, 2013

  • A former member
    A former member

    Thanks Sarah, that was a great demo, especially impressed with the live coding, which is always difficult :)

    June 2, 2013

  • Christopherys A.

    Thanks a lots to Sarah for exhibition about LUA in advanced cheers ^_^

    June 2, 2013

  • A former member
    A former member

    Sorry I can't make it guys, but I'd love to see slides or even better, a video of this meet up.

    May 6, 2013

11 went

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy