It's all in your head, Part 9

The only place you'll ever hear the truth
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Postby xander » Tue Feb 12, 2008 2:31 am

!

IV has an impressive audience. ;)

xander
Mas Tnega
level5
level5
Posts: 7898
Joined: Sat Mar 02, 2002 11:54 pm
Location: Edinburgh
Contact:

Postby Mas Tnega » Tue Feb 12, 2008 10:02 am

It really does.
User avatar
Chris
Introversion Staff
Introversion Staff
Posts: 1172
Joined: Sat Nov 25, 2000 7:28 pm
Location: Cambridge, UK
Contact:

Postby Chris » Tue Feb 12, 2008 1:02 pm

Stiill, could I ask you some questions about your usage of Lua?

Specifically id love to know if you used lua in a class based way with objects, methods, inheritance etc through metatables, or if you just used it by passing in object pointers to all your functions with no real OO programming.

Id also love to know if you ran a single Lua instance for the whole game, or if you created seperate Lua instances for each game object, or some other method.
mb108
level0
Posts: 2
Joined: Wed Feb 13, 2008 3:44 pm

Postby mb108 » Wed Feb 13, 2008 3:51 pm

Here's an example of embedding stackless Python in C++, using Boost.
http://svn.python.org/view/stackless/sa ... iew=markup

I love the idea of the concurrency, etc of stackless Python, but I do like the "simple, lightweight" Lua approach... might be more practical.

Keep us posted on what you guys end up using/why. I'm a beginning dev wondering if I can get some of my less-technical cohorts to help with logic by giving them a scripting language.
ToxicFrog
level1
level1
Posts: 10
Joined: Sun May 02, 2004 7:40 am

Postby ToxicFrog » Thu Feb 14, 2008 12:05 am

mcnicholls wrote:I had breifly forgotten about stackless, but i would think it is perfect for this kind of project. Coroutines would allow you to create a lot of game objects that all run concurrently.
Although i was reading a little about lua and it seems it supports coroutines as well. Is that true?

It is (at least, Lua 5.x does; I haven't used 4.x or earlier versions). See the overview and library reference.

Chris Delay wrote:Lua requires the C++ programmer to directly manipulate a shared stack to communicate with your scripts, which is analogous to programming while sitting on a pile of volatile explosives while spiders crawl over your body.

Granted that talking directly to the stack isn't exactly hugs and kittens, but I don't think it's that bad. And it follows the general Lua approach of giving you small, flexible building blocks rather than prefab solutions - the stack API is simple and consistent, which makes it easy to write higher-level functions which abstract whatever you need to do with it into a more comfortable interface. I believe there's already some C++ libraries that do just this, in fact.

As far as OO in Lua goes, it's kind of a love/hate thing for me. On the one hand, you can roll you own, which means pretty much whatever object system maps most naturally to the project, you can do it, and often pretty easily. On the other hand, you have to roll your own, so there's no consensus on how a Lua object system should work and it means you can't just plonk down and start writing objectified code like in (say) Python.
On the whole, though, I prefer it. It usually doesn't take long to write yourself an object system, and I find the added flexibility is well worth the requirement to do so.
_xavieran
level0
Posts: 2
Joined: Thu Feb 14, 2008 12:24 am

Python FTW!!!

Postby _xavieran » Thu Feb 14, 2008 12:45 am

After 5 years of being a heavy uplink fan, I have finally registered!

Chris:Python is not actually that scary when it comes to syntax...
The whitespace syntax can seem strange,but is only natural...
After all,You've been putting indentation in your code for years now,haven't you? ;)
I don't myself have any knowledge of embedding python in C or C++ so I can't really give you any info there...

Because I program in python and not lua,I am obviously in support of it,but you choose what feels natural...
Also LUA was designed for game scripting...

What will the pricetag for subversion be?

P.S.Any GNOME users can check out my Uplink metacity theme...http://gnome-look.org/content/show.php/Uplink+GTK+and+Metacity+Theme?content=75180
P.S.S.I put the license under proprietary so that people would know that Introversion still has all rights over the content...
Chris:Please don't sue me... :oops:
brog
level1
level1
Posts: 22
Joined: Fri Jun 22, 2007 10:11 am

Postby brog » Thu Feb 14, 2008 1:56 am

Clearly no existing language is good enough for SUBVERSION; you must first create your own. Only then can SUBVERSION emerge in its most sublime state of perfection.

There's good precedent for this sort of thing; Donald Knuth wanted to write a book on compilers, but he felt there was no adequate introduction to the basics of computer science necessary as a prerequisite, so he had to write The Art of Computer Programming first (three and a bit volumes so far, all massive, and no end in sight).
Darksun
level5
level5
Posts: 6461
Joined: Sat Dec 07, 2002 7:08 pm
Location: 127.0.0.1

Postby Darksun » Thu Feb 14, 2008 1:13 pm

brog wrote:There's good precedent for this sort of thing; Donald Knuth wanted to write a book on compilers, but he felt there was no adequate introduction to the basics of computer science necessary as a prerequisite, so he had to write The Art of Computer Programming first (three and a bit volumes so far, all massive, and no end in sight).


Oblig. xkcd

Image
skull13
level3
level3
Posts: 340
Joined: Sun Apr 16, 2006 10:51 pm

Re: It's all in your head, Part 9

Postby skull13 » Sat Feb 16, 2008 6:58 pm

Chris wrote:Lua is the next contender. Lua is also used by some fairly impressive commercial games, including SimCity 4, World of Warcraft, FarCry, Psychonauts and a ton more. Lua is relatively new compared to Python, and this does cause it some problems. The API is still changing and being rewritten yearly, meaning a lot of the documentation and examples on the internet are already out of date and refuse to work. In my experiments Lua has proved to be much simpler to embed in C++, however it is much more down to the wire – Lua requires the C++ programmer to directly manipulate a shared stack to communicate with your scripts, which is analogous to programming while sitting on a pile of volatile explosives while spiders crawl over your body. Fundamentally Lua is designed to be embedded and controlled by C++, whereas Python wants to embed and control C++ in itself. Lua also falls over itself when you start thinking about classes and Object Oriented programming – it can do it, but only through some tricks and hacks. When combined with a couple of extra libraries – Boost and LuaBind, Lua starts to become much more interesting, and takes on much of the power of Python.

Here’s an example Lua script, so you can compare. I find it to be more “readable” than Python, but that’s just a subjective opinion I think.
http://lua-users.org/wiki/SciteCleanDocWhitespace


Chris, I have played many games using Lua scripts, and while I find these feats to be impressive (It's how Excalibur: Morgana's Revenge put vehicles in one level, Vendetta Online uses them for impressive plug-ins) I have never tried making a game of this scale. (I tried to make text games in Ruby, but they all flopped) The point is, many, many people know Lua and you will probably get a much larger mod community if you use that. (Of course, this is based on my experiences, several games I play use Lua for mods, but I have barely heard of Python)
User avatar
shinygerbil
level5
level5
Posts: 4667
Joined: Wed Dec 22, 2004 10:14 pm
Location: Out, finding my own food. Also, doing the shinyBonsai Manoeuvre(tm)
Contact:

Re: It's all in your head, Part 9

Postby shinygerbil » Sat Feb 16, 2008 8:32 pm

skull13 wrote:I have barely heard of Python
I think you are in the minority there. ;)
Here is my signature. Make of it what you will.
Image
User avatar
Shwart!!
level5
level5
Posts: 1237
Joined: Sun Nov 12, 2006 1:36 am

Postby Shwart!! » Sat Feb 16, 2008 9:29 pm

I've certainly heard of both, but (at least from what I've seen) Lua seems to be more prevalent among strong modding communities.
I considered learning Python a while back, but never got around to it.
I suppose now my next programming language to learn will depend on Chris's choice. :)

Shwart!!
User avatar
shinygerbil
level5
level5
Posts: 4667
Joined: Wed Dec 22, 2004 10:14 pm
Location: Out, finding my own food. Also, doing the shinyBonsai Manoeuvre(tm)
Contact:

Postby shinygerbil » Sat Feb 16, 2008 9:56 pm

Lua definitely seems to be better known for gaming, but Python has a strong following in Linux circles, for example - a lot of software I download for Linux has some kind of Python integrated into it somehow.
Here is my signature. Make of it what you will.

Image
User avatar
Pox
level5
level5
Posts: 1786
Joined: Sat Mar 03, 2007 11:23 am
Location: Melbourne

Postby Pox » Sun Feb 17, 2008 1:00 am

Yah, LUA and Python have different applications - LUA is specifically designed for game scripting, so that's all the use it gets: Python is used for just about everything that doesn't need C/ASM-speed algorithms in the Linux world now, being a very flexible language. But it's also evil.
User avatar
KingAl
level5
level5
Posts: 4138
Joined: Sun Sep 10, 2006 7:42 am

Re: It's all in your head, Part 9

Postby KingAl » Sun Feb 17, 2008 3:28 am

shinygerbil wrote:
skull13 wrote:I have barely heard of Python
I think you are in the minority there. ;)


As a point of reference. I don't think the deciding issue will ever be popularity.
Gentlemen, you can't fight in here: this is the War Room!
Ultimate Uplink Guide
Latest Patch
User avatar
Pox
level5
level5
Posts: 1786
Joined: Sat Mar 03, 2007 11:23 am
Location: Melbourne

Re: It's all in your head, Part 9

Postby Pox » Sun Feb 17, 2008 7:31 am

KingAl wrote:
shinygerbil wrote:
skull13 wrote:I have barely heard of Python
I think you are in the minority there. ;)


As a point of reference. I don't think the deciding issue will ever be popularity.


Epic up arrows for LUA :shock:

Return to “Introversion Blog”

Who is online

Users browsing this forum: No registered users and 4 guests