GPWiki.org
GPWiki.org
It is currently Wed Jun 19, 2013 12:19 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Question regarding Lua
PostPosted: Mon Jun 29, 2009 11:35 pm 
Harmlessness does no harm
User avatar

Joined: Tue Sep 14, 2004 8:37 pm
Posts: 3854
Location: Ferriday, LA, US
Hey guys, today I got a little introduction into Lua. I know a little bit about what it can do, but I'm left wondering if I can script things like cutscenes.

For example, the cutscenes in my game will consist of game characters moving into position, doing animation sequences, etc. Also, there will be text dialogue, symbols (such as speech bubbles), and other things going on.

I'm wondering how applicable Lua would be to this kind of thing. The deepest I've gotten into Lua so far is writing very simple scripts and retrieving variable values from a C++ app. I was wondering if I could write scripts to closely control these kinds of actions within a game.

Thanks for any input! :)

_________________
What most people don't understand about "enlightenment" is that it is not an end-goal; but where you find yourself just before taking a new "first step."


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 30, 2009 2:36 am 
Elder Statesperson

Joined: Thu Mar 09, 2006 5:15 pm
Posts: 217
Location: Wellington, New Zealand
Lua can do anything that your host program can do as long as you export the appropriate functions.

All functions that can be exposed to Lua have the same signature in C which is a problem when trying to mix functions that will be called from Lua and ones that will be called in C, and I found it takes a while to get your head around it (could just be me!).

Also as I was using C++ I wanted to keep some concept of classes which isn't really included in Lua. There are a number of ways around this which are effective.

The approach I found the easiest in my latest project was to create a set of intermediate classes in C++ where the only public methods are specifically for exporting, and then use Lunar to export the classes as lua tables with methods.

Once you get it all working it really pays off being able to script in Lua and see changes without recompiling. As long as you expose enough functions to control what you need there aren't any limits in what you can do with it.

I have a modified version of Lunar which has had a lot of help from the lua mailing list, something i'd recommend signing up to. I found documentation a bit sparse on a number of things I was trying to do but got comprehensive help within 24 hours from the mailing list.

_________________
www.littlemonkey.co.nz


Top
 Profile  
 
PostPosted: Wed Jul 01, 2009 9:52 pm 
Level 22 Norse Warrior-Librarian
User avatar

Joined: Fri Aug 20, 2004 1:58 pm
Posts: 538
Location: UK
theraje wrote:
I'm wondering how applicable Lua would be to this kind of thing.
Lua can do as much as you let it really. While I can't offer advice on linking it to your C code I will say that it's fine for cutscenes and the like.

After all - the minigames in two of the recent games i've worked on had all of their logic and level code written in lua.

Though it does have it's peculiarities -might just be our interpreter but it was possible for part of the script to die and the rest of it keep running, for a while at least, before crashing somewhere unrelated to the broken code.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group