Extending Games With Lua 55
RealDSmooth writes "2old2play.com has a nice article up about extending World of Warcraft, Neverwinter Nights, and other games using Lua, a light-weight programming language made specifically for enhancing and extending games. It goes into some great details about what's available today, and where Lua is heading in the future."
Honestly... (Score:4, Funny)
Re:Honestly... (Score:2)
javascript
web-pages (excusable if the author is German, but I doubt it)
Baldures Gate
Neverwinter nights
RPG game
develope
user-interaction
to add flare, and fun (two mistakes within three words!)
The sad thing is that the article is nearly devoid of conten
Umm, no, not specifically for extending games (Score:5, Informative)
I've been working with Lua off and on for a while. I have to say that it is pretty darn cool. It is really easy to embed, really easy to extend, and really lightweight (about 90k or so). The language is very simple, but still supports a lot of advanced programming concepts like closures.
Off-Topic: Apostrophe Abuse (Score:3, Funny)
Re:Off-Topic: Apostrophe Abuse (Score:5, Funny)
For the love of the sweet sweet Jebus, I hope nobody is.
Re:Off-Topic: Apostrophe Abuse (Score:1, Funny)
Heh heh heh. Why do I never have mod points when I needs 'em?
Re:Off-Topic: Apostrophe Abuse (Score:1)
Don't you mean "whose edit'ing that site?"
Dawn of War (Score:1)
Re:Dawn of War (Score:3, Funny)
Re:Dawn of War (Score:2)
Google up the demo.
Oh, and I didn't get any sound. No video either. Hmmm. But I'll give 'em credit for size of the screenshots, I hate checking out a game's site and getting small images.
Re:Dawn of War (Score:1)
Oh and don't be fooled by the labelling, "Normal" difficulty means "Damn Easy".
Re:Dawn of War (Score:2)
Major downside is that the single player game is exceedingly short. They're just about to ship an expansion, Winter Assault, on the 20th. It'll add a bunch of single-player content, as well as another p
Um, yeah. Not so much. (Score:2, Funny)
Turned me off from doing any scripting for WoW completely.
lua operators or, and are cool (Score:1, Informative)
so instead of
PHP: doSomething(isset($a)?$a:-1);
you can do:
Lua-like: doSomething(a or -1)
This removes the redundancy in the php statement.
I felt the embedding of lua might be kind of hard, it looked like programming postscript to me
Re:Um, yeah. Not so much. (Score:2)
Not really well researched article (Score:4, Informative)
LUA was used for scripting in Baldur's Gate series however.
BioGeorg
Pretty lousy article... (Score:4, Informative)
Aside from the fact that it appears to have been written by somebody whose teachers apparently overlooked the usage of the apostrophe when teaching him English, the article didn't really say all that much. Reading the summary, I was expecting some details about Lua itself, or maybe even some information about where it is headed in the future. All the article pointed out was that Lua was being used in some games. ...... Real informative.
But seriously, Lua's a great language. Full lexical scoping and first-class functions alone give it insane flexibility and power, and its table data structure is implemented very well. In general, Lua is one of the most well-thought-out languages I've ever seen; its creators have taken great pains to get all of its functionality into it while still maintaining a low profile (the stand-alone interpreter takes ~150KB of space) without resorting to kludges or hacks, and these efforts have paid off. I wouldn't think of using anything else to extend a program.
How About Scheme? (Score:3, Insightful)
``I wouldn't think of using anything else to extend a program.''
I'd just like to propose Scheme as an alternative to consider. Scheme has all the characteristics you applaud: great design, immense flexibility, and low footprint. Comparing Scheme to Lua:
- Scheme is a Lisp dialect, and, as such, uses s-expressions (basically lists, think lots of parentheses). Some people find this annoying, but it makes the syntax very regular and eas
Python? (Score:1)
Can some more knowledgable people post some pros/cons of using python for this, like issues with the byte-compiling?
Re:Python? (Score:2)
Ooops..Linky (Score:3, Informative)
Re:Ooops..Linky (Score:2)
I'm working on an open-source game with a few other people, and we're using Python as the main language, with bottlenecks to be rewritten in C/C++ as necessary. A powerful Python scripting interface will be very simple to implement.
Re:Python? (Score:3, Informative)
Could make for some neat mods. I'm hoping we'll see some kind of Master of Magic game come out of it.
Re:Python? (Score:4, Informative)
It takes a lot of work to rip out all that dangerous stuff and convert Python into a vessel appropriate for running untrusted code. Because any game with a scripting engine will be modded, untrusted code is a given.
Tcl (Score:2)
I have to say that Tcl is pretty good for this kind of thing too, although it is certainly bigger than Lua. It has sandboxes and multiple interpreters that you can control from both C and Tcl itself. You can also do threads, if you want. And the language is also pretty easy to learn for newcomers, like most scripting languages - especially considering t
Lua's sandboxing (Score:3, Informative)
Both of those apply. As Lua is fully reentrant and tiny, you can have any number of Lua VMs active concurrently in a program, and they're all naturally disjoint from each other.
In addition, Lua execution is inherently sandboxed with respect to the operating system because the base interpreter provides no system functions at all, and so it can affect only
Re:Lua's sandboxing, Tcl (Score:2)
You do m
Re:Tcl (Score:2)
Python, when embedded, runs in a single global state, IIRC. With Lua, you can create any number of separate Lua states which are effectively their own sandboxes, and then run scripts in them as you choose.
Re:Python? (Score:1)
Re:Python? (Score:2)
While many platforms include their own solution (Zope, for example) no-one seems to have released an officially dedicated distribution for restricted code. To my knowledge, Stackless has the same weakness.
Re:Python? (Score:1)
Re:Python? (Score:1)
Python, although nice, was not designed for this kind of use.
Re:Python? (Score:2)
Re:Python? (Score:2)
Re:Python? (Score:1)
MISLEADING ARTICLE!!! (Score:3, Interesting)
Wrong bitch!
Lua is *not* a language that was specifically made for enhancing games. True, it has a great use in enhancement and extension of games (in fact I use it in my game [allacrost.org]), but it is used in MANY pieces of software outside gaming. Here is proof. [lua.org]
For the bastards who are too lazy to click the link, here's a sample of the projects that use Lua (outside of gaming)
- Automatic configuration of network devices
- Heart Institute Monitoring Network
- CPC4400 Embedded Switching Platform
- Horus Alarm monitoring software
Unreal script is an example of a language designed specifically for games (or just a game in this case). Lua is not one of them. I would like to encourage the editors to check their submissions over thoroughly and stop mis-educating the Slashdot crowd. Of course, that's probably as likely to happen as Apple is to announce that they're switching back to PowerPC. We can hope, but it probably won't do no good.
Re:MISLEADING ARTICLE!!! (Score:1)
Game Development with Lua, other projects (Score:4, Informative)
However, Lua is used for other things [lua.org], includinge the ion [cs.tut.fi] window manager, the SciTE [scintilla.org] editor, the Elinks [elinks.or.cz] text webbrowser and more.
Lua is simple, functional, and ideal for games (Score:4, Informative)
The entire manual that explain the whole language as well as the C embedding interface and the optional standard libraries is probably less than 100 pages printed. The source code is around 10,000 lines of C code, I believe.
Performance was also particularly impressive provided you know what you're doing. If you're new to functional programming, you might want to read up a bit. Also, it is a good idea to have experience with recursion and other such elementary topics.
Overall, I couldn't believe how easy it was to build Lua into my little project and I doubt I'll ever take a look at another scripting language because Lua is just that good.
The scheme I chose to use for my project is that it reads in all the Lua files in a directory and using the game engine's simple API (in Lua), different scripts add things like ships or new weapons. This allows the player to write a quick script for a new weapon (e.g. a rail gun), drop the script in a directory, start the game, and then use that weapon. There's basically no overhead. I think that's pretty cool and encourages people who don't know how to make an entire game to still have a fun time extending the game by themselves.
mangband/tomenet (Score:3, Informative)
Changes at Runtime = Nice! (Score:2)
Of course, it also coddles a bit of laziness on the design side, so if you're not c
Game Monkey (Score:2)
Seemed nice.
I knew it! (Score:2)
I spent a couple months scripting scenes for the Hero6 project. I don't know if the project is still active anymore, but the building of the game was heavily centered on LUA scripts that made event calls to the game engine, which I think was written in either C or C++. It was an excellent approach, and LUA was perfect for the job; it made development very simple and easy.
I Love Lua (Score:4, Informative)
I've embedded Lua into all sorts of things. Never really finished any of it, but I did embed Lua into the BUILD engine to replace the game code written in C. I've also been working on embedding it into Quake 3 Arena to do similarly, though unfortunately real life is getting in the way of doing much there. Lua is great because you can make what you want with it. It has no builtin functions, so it's completely up to the embedder what gets included. The bundled coroutine library is very useful in games, too. It doesn't even have an object model of its own, meaning that you are free to invent one based on the simple structures it provides.
The adventure game Grim Fandango was based on Lua, as was the latest Monkey Island game. Lua gets everywhere. It's in text editors, web servers, games, your shell... you name it. It's probably somewhere on your computer right now, hidden inside some application.
um, not quite (Score:2)
Lua's cool and all (and BioWare has used it for the Baldur's Gate games and the underrated MDK2), but it's not in NWN or NWN2.
In other game scripting news, Freedom Force and its sequal use the delicious Python [python.org].
useless article (Score:2)
Lua is just an interpreted programming language right? So you still need to create bindings from the game to the Lua environment. How difficult is that to do? How does Lua compare to using Python (for example) as script language? What makes Lua so great? Nothing about that in TFA, just some examples where it's used.
Some more information would be nice (Score:1)
"Some games can be extended with Lua."
Wow! Cos, like, I'd never noticed any of my WoW addons using Lua, and never opened any of the files in curiosity. No...
Anyway. Anyone who actually uses Lua out there? What's a good site with a tutorial on how to develop an addon, or just an intro to the language? Sure, I can google, but with an article like this I'd expect a little more info for the 'hardco