lua vs. python vs. vbscript

Started by
13 comments, last by skillfreak 20 years, 9 months ago
LUA . Python . VbScript I'm going for one that is best suited for game programming on a few different levels. a) Speed? b) One which most closely models unrealscript. ie. (I’d like to use classes or structures and script pointers.)? b1) is unrealscript faster than these above? c) Is there another scripting language that would work great but I haven’t heard about? Thanks, Andy I don't really want to hear about how I should profile them, though your prob right. I'm looking for experience and opinions from those who have used them or anyone else who has anything of interest. Thx +! [edited by - skillfreak on June 18, 2003 5:02:31 PM]
Advertisement
a). Lua and Python are about on par, depending on what operations you do a lot. There most likely isn''t enough difference to make either stand out. VBScript, at least when I was working with it, was dog slow.

b) Lua and Python can both handle classes and script pointers. Lua''s a bit more geared towards being a "metaprogramming" language, that is, allowing you to introduce constructs not explicitly defined by the language itself.

b1) Dunno. Probably slightly faster.

c) I''ve heard good things about Ruby and Tcl. You might want to check them out.

You seem very concerned about speed. Remember that, in any scripting language, speed should not be a major concern. Since you should only be doing high level stuff in scripts, there''s little need for tightly optimized inner loops.

How appropriate. You fight like a cow.
As was already said VBScript is slow. I''d stay away from it. I''ve had good results with Python. I''ve heard (as someone else already said) TCL is also good. I would take a look at each (TCL, Python, Ruby, etc) and see which best fits your project needs and your style, which one you''re most comfortable with.
Which of them has the most painless integration with, say, C++ data? I''d like to be able to pass game data to the script for read/write; which hooks up the best?
Thanks for your replies.
Unreal seems to interface their engine via scripts.

I would like to do the same thing and am leaning toward lua. Would creating a game in script work?

--everything in game is script--
Ie. Say I wanted to create a rocketlauncher.

and following a hl function structure i may do something like
function PrimaryFire()
{
rocket = SpawnObject( "rocket" ); // this is another script
rocket.pos = GetPlayer().pos; // just for simplicity
PlaySound( "rocketfire" ); // play sound
}
this is just an insanly basic etched out func.

Is this a bad idea for game speed (are CPUs fast enough?)
Is this how unreal tourney works?

Much thanks,
Andy

[edited by - skillfreak on June 18, 2003 10:19:58 PM]
quote:Original post by skillfreak
Thanks for your replies.
Unreal seems to interface their engine via scripts.

I would like to do the same thing and am leaning toward lua. Would creating a game in script work?

--everything in game is script--
Ie. Say I wanted to create a rocketlauncher.

and following a hl function structure i may do something like
function PrimaryFire()
{
rocket = SpawnObject( "rocket" ); // this is another script
rocket.pos = GetPlayer().pos; // just for simplicity
PlaySound( "rocketfire" ); // play sound
}
this is just an insanly basic etched out func.

Is this a bad idea for game speed (are CPUs fast enough?)
Is this how unreal tourney works?

Much thanks,
Andy

[edited by - skillfreak on June 18, 2003 10:19:58 PM]


This is how Tribes2 (Torque) does it, so I thikn it''s certainly fast enough.
---------------------http://www.stodge.net
I personally use &#106avascript (well, with few additional features)... Can't really tell you how it compares to those other languages you talked about though, since I never tried to embed them.

http://www.mozilla.org/js/


[edited by - mputters on June 19, 2003 3:56:47 AM]
If you are really concerned about speed, VBScript should probably be ruled out. It''s OK for embedding in normal applications, but I''m not sure if it would be a viable choice in a game. LUA and Python are both excellent choices however, and many games use these already. There are also many other languages worth looking into (google: embeddable scripting languages)

and now for your questions:

a. Speed shouldn''t really be a problem. Use C++ for all the time critical code, and make sure the way you interface C++ and your scripting language is efficient.

b. Python natively supports object-orientedism, but LUA can easily simulate it with tags.

b1. Not sure about this one.

c. Here are a couple off the top of my head: Ruby, TCL, SeeR, Small, Guile .. hmm can''t think of anymore. There are many more out there, be sure to search!

good luck
I like Python a lot. You can download ygame, which is the Python gaming library. It also has support for OpenGL. However, Lua is also very good. I have been around Python for all kmy scripting, so I would have to reccomend Pytohn over Lua.
And try using Perl. Or make your own scripting language.

Scott Simontis
Engineer in Training
Have a nice day!


[edited by - Village Specialton on June 19, 2003 4:26:35 PM]
Scott SimontisMy political blog
Regarding your b1 question. Unreal uses it''s own virtual machine to interpret it''s scripts. The thing is that it''s specificaly designed for that particular engine, and tightly integrated, which makes it pretty fast. I''m sure it''s well optimized as well, and so I''d say it''s probably faster than standard Lua or Python. However, Python(and Lua?) allows you to compile your code to bytecode, which can make it run slightly faster. Using that, I guess you can get some decent speed out of it. Pyhon is faster than Lua AFAIK, and it has a big number of additional libraries you could use. Lua on the other hand has significantly smaller memory footprint than Python(it''s not as massive), so it really depends on what you need. Also, pay attention to the syntax...

I hope this helps
-----------------------------------------------------It's better to rule in hell than to serve in heaven.------------------------------------------------------Ivan

This topic is closed to new replies.

Advertisement