Advertisement

Python or Lua

Started by January 02, 2004 03:15 PM
30 comments, last by QzarBaron 20 years, 9 months ago
Is there a list of commercial games that use ''standard'' scripting languages (say Lua or Python) and what language they used?
quote: Original post by Anonymous Poster
Is there a list of commercial games that use ''standard'' scripting languages (say Lua or Python) and what language they used?
No. We know of certain games'' uses of scripting languages through post mortems written by their developers (typically for Game Developer magazine, and then published on GamaSutra a while later).
Advertisement
I''ve got more experience with Lua than with Python, but I do have experience with both, and my personal take on the situation is that Lua is the easier for the non-programmers. More relevantly, my brother-in-law--a complete programming newb who is trying to learn the basics by writing scripts for my game--agrees with me.

In many meaningful respects, Python and Lua are virtually the same. Dynamically typed, making strong use of "tables", syntactically similar. The whitespace requirement of Python confuses him, and he finds the clear and unambiguous end keyword of Lua to make more sense than the whitespace.

The list manipulations for Python, while far more powerful than anything Lua provides, are what intimidates him the most. Python provides a lot of operations for dealing with lists that Lua frankly does not have (at least, not in 4.0 which I use. I have seen no major enhancements in this regard for 5.0, however). I like the flexibility these operations provide, but I can view them with a programmer''s eye. The non-programmer might find them confusing.

Python does have a larger base of useful goodies available all over the place, but a lot of what is available may be irrelevant to embedded game scripting.

These issues aside, the practical difference between the two is slight enough as to hardly be a factor in my opinion. I''d say, go with what you know. If you know neither, flip a coin.

Josh
vertexnormal AT linuxmail DOT org

Check out Golem: Lands of Shadow, an isometrically rendered hack-and-slash inspired equally by Nethack and Diablo.
quote: Original post by Anonymous Poster
Is there a list of commercial games that use ''standard'' scripting languages (say Lua or Python) and what language they used?


I know that Eve Online uses Python and I''m pretty sure that NeverWinter Nights uses Lua
Why not use python and write some python modules in C/C++ using boost:ython? I think that would be the easiest approach and give you the best results. You still get the speed of C/C++ and your program will be easier to read since it will all be written in python.

Now if I could just follow my own advice...
here''s some sample python scripting code to help you with your decision It uses Boost:ython and the Python ''very-high-level'' api.

http://urbanhunting.com/~dustin/katana2/script.cpp
http://urbanhunting.com/~dustin/katana2/internal.py
http://urbanhunting.com/~dustin/katana2/example.py
Advertisement
The Python23.lib file is only 175kb. This is the core Python Language. Python itself is tiny. A lot of people will think that Python is huge because of it''s gigantic module library (which, btw, is 100% optional).

daerid | Legends | Garage Games | Spirit | Hapy | Boost | Python | Google
"Doomed to crumble, unless we grow, and strengthen our communication" - Maynard James Keenan, Tool
daerid@gmail.com
quote: Original post by daerid
A lot of people will think that Python is huge because of it''s gigantic module library (which, btw, is 100% optional).


Except for the built-in modules which are compiled into the interpreter. For example, on my system

>>> import sys>>> print sys.builtin_module_names(''__builtin__'', ''__main__'', ''_codecs'', ''_hotshot'', ''_locale'', ''_random'', ''_weakref'', ''array'', ''audioop'', ''binascii'', ''cPickle'', ''cStringIO'', ''cmath'', ''errno'', ''exceptions'', ''gc'', ''imageop'',  ''imp'', ''itertools'', ''marshal'', ''math'', ''md5'', ''msvcrt'', ''nt'',  ''operator'', ''pcre'', ''regex'', ''rgbimg'', ''rotor'', ''sha'', ''signal'',  ''strop'', ''struct'', ''sys'', ''thread'', ''time'', ''xreadlines'',  ''xxsubtype'', ''zipimport'') 


Which is pretty decent for 175k

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” — Brian W. Kernighan (C programming language co-inventor)
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
quote: Original post by Anonymous Poster
Is there a list of commercial games that use ''standard'' scripting languages (say Lua or Python) and what language they used?


On Lua.org is a small list of free and commercial games/apps that utilize lua (Direct Link).

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

There is no easy answer, it really depends of a lot of things.

Python is a little bigger, so for you should be careful on PS2/GC, but it can ( and it _is_ ) be used on these consoles.

I have more experience with Python (created two commercials and, sadly, aborted PC games with it ).
But I used Python mainly to code the GamePlay part, so it was used by developpers, not by designers.

Python offers is really easy to use, clean, far more OO than C++, developpment is really quicker.

The big advantage of python is that it is used a lot in the world : you find books, tutorials, libs, debuggers, ...
So perhaps Python has a better chance to stay than Lua...
But who knows ???

This topic is closed to new replies.

Advertisement