|
From: Ben C. <cro...@ne...> - 2000-02-12 21:58:28
|
Comrades, Here's an e-mail from one of the guys I asked (about Lua scripting). Later, Ben -- "The ultimate measure of a man is not where he stands in moments of comfort and convenience, but where he stands at times of challenge and controversy." -- Martin Luther King, Jr. ---------- Forwarded message ---------- Date: Fri, 11 Feb 2000 00:17:27 +0100 From: Vincent Penquerc'h <ly...@ke...> To: Ben Crowder <cro...@ne...> Subject: Re: [AGP] Lua scripting On Wed, Feb 09, 2000 at 04:44:10PM -0700, Ben Crowder wrote: > Since you've actually used Lua, would you be willing to answer a few > questions? Yup > 1. What kind of game(s) have you used it for, and how did you use it? Only one, a RPG. I expose my game internals in a form that Lua can call (it has a custom way to pass parameters most notably) and then a Lua script can call them directly. The other way round is possible too. > Did you notice any limitations that would be an obstacle in its use > with any certain type of game or any gaming feature? Well, not *that* much :) But I did not get too far with it anyway. I have it running in my game, but this is a simple implementation for now. I still have to do something more complex. But the good thing is that Lua offers a way to enhance its semantics: you can write routines to handle cases not originally handled by Lua (a little like C++ operator overloading, but much more powerful). This really helps in building complex Lua scripts, altough I did not write those in conjunction with my game. > 2. How well does it integrate with C? Are the scripts runtime > (interpreted) or compiled? Will I be able to control most of my game > logic with Lua? Once wrappers are written for your game's internals, those can be used in Lua scripts as easily as if they were builtins. There is a tool (toLua) that can be used to generate those wrappers from a cleaned C++ header file. Lua is higher level than C++, and provides a general purpose hash table facility, that can be used to simulate OOP, in parallel to game classes. Lua scripts are interpreted, but can be precompiled as Lua byte code. There is no such thing as a direct machine code compilation. It is fairly fast though, as long as you don't try to do too much with it :) > > 3. Are there any open source games you're aware of that use Lua? I know > Grim Fandango and Baldur's Gate do, but not having the source available > -- you get the idea. ;) I knew of these two too. I think the port of MDK 2 by Bioware will use it more extensively than BG. I know of no open source ones though. Try asking on lua-l :) > Thank you very much! You're welcome. -- Vincent Penquerc'h Windows NT - Nuke That ! |
|
From: Ben C. <cro...@ne...> - 2000-02-12 21:58:56
|
Comrades, Here's another one (there's one more, for a total of three). Later, Ben -- "The ultimate measure of a man is not where he stands in moments of comfort and convenience, but where he stands at times of challenge and controversy." -- Martin Luther King, Jr. ---------- Forwarded message ---------- Date: Wed, 9 Feb 2000 19:34:13 +1100 From: Peter Wang <tj...@al...> To: Ben Crowder <cro...@ne...> Subject: Re: [AGP] Lua scripting Ben Crowder <cro...@ne...> wrote: > > Has anyone here had any experience with the Lua script engine -- > specifically, experience with it as a scripting engine for games? I'm > considering it for a project but wanted to get some input first. Only one thing to say: try it. It's fast, small and the best bit, the API is simple and to the point. Personally I've tried three or four different interpreters, and this one's the best of the lot. Your mileage may vary, of course. Peter -- tj...@ps... - http://www.psynet.net/tjaden/ "There are no passengers on spaceship Free Software - we are all the crew." |
|
From: Ben C. <cro...@ne...> - 2000-02-12 21:59:16
|
Comrades, And the last one... Later, Ben -- "The ultimate measure of a man is not where he stands in moments of comfort and convenience, but where he stands at times of challenge and controversy." -- Martin Luther King, Jr. ---------- Forwarded message ---------- Date: Thu, 10 Feb 2000 22:06:39 +1100 From: Peter Wang <tj...@al...> To: Ben Crowder <cro...@ne...> Subject: Re: [AGP] Lua scripting Ben Crowder <cro...@ne...> wrote: > Peter, > > Assuming you've used it, then, would you mind answering a few questions? Of course I've used it, otherwise I wouldn't be suggesting it. :-) I don't have any games ready to show yet, if that's what you mean. > 1. What kind of game(s) have you used it for? Did you notice any > limitations that would be an obstacle in its use with any certain type > of game or any gaming feature? I used it in an early version of Red Pixel II (networked platform kill-your-friends), but that was scrapped because it was too slow (I was doing too much in Lua -- see below). Right now I am using it to drive a GUI system, and I will be writing my map editor and a new version of Red Pixel II in Lua. (At least the map editor is possible; I did one using the Netscape JavaScript engine and Lua is equal or faster). My brother is in the early stages of an RPG system, but it's working well so far (meaning the bottleneck is not Lua). It should work with any type of game as the data types it gives you are a lot more flexible than in C, plus it supports OOP concepts more easily. If you need more speed, do more in C. Whenever I think "scripting might be too slow for this project", I remind myself that Quake used QuakeC :-) > 2. How well does it integrate with C? Are the scripts runtime > (interpreted) or compiled? Will I be able to control most of my game > logic with Lua? Integration with C is the easiest out of the interpreters I have tried, except for SeeR[1]. You will probably end up writing little function wrappers to mediate between Lua and C (different data types, sharing structures, etc.) This is quite easy since the API is stack-based, and there is also a toLua utility to help you if you get sick of it. You will occasionally need to read the source, however, as the docs don't cover *everything*. [1] SeeR is different, as the data types and function calling semantics are the same as C, meaning little/no conversion is necessary. However, you lose the benefits of a higher level language. Scripts are precompiled into byte codes, then interpreted (like Java, Python, etc). This makes it fairly fast, but retains the dynamicism of an interpreted language. You should be able to control most of your game logic with Lua, but of course this depends on your design. Experiment. IMHO one of the hardest things to do when using a scripting language is deciding how much you do in compiled code, and how much you do in scripts, trading off flexibility for speed, etc. (I still have problems getting this exactly right.) Hint: You should not be using many low-level Allegro functions in your scripts (e.g. doing your render loop in Lua). That is probably a sign that things will become too slow later (although it should be okay for RPGs and other sich games). > 3. Are there any open source games you're aware of that use Lua? I know > Grim Fandango and Baldur's Gate do, but not having the source available > -- you get the idea. ;) Not really :-( On the Lua pages there is a link to `HZ' which is an Allegro + Lua game. Although incomplete, some source is available, and the author has some interesting ideas about a "Visual representation" system (although I think it's a little overboard). Phew! You can tell I like scripting languages; I go off and write huge messages like this :-) If you have any questions, contentions or tips of your own, I'd love to hear them. Peter -- tj...@ps... - http://www.psynet.net/tjaden/ "There are no passengers on spaceship Free Software - we are all the crew." |