Other languages for BGE? Lua?

Hello,

I wonder, is it possible - and/or anyone done it already - to use other languages than Python with BGE? I.e. BGE seems to be cool for fast prototyping by designers - and most designers I know prefer Lua than Python because Lua is still most widely used in professional engines for triggers and other scripts, so they know it already and that stuff… I’m not Python expert myself, how much work would be needed to allow use of Lua for scripts in BGE? Thanks in advance.

Cheers,
Andrzej.

I think its possible, but don’t worth :D.

Python is just great. It’s very easy to learn if you know any other language… if you master Lua i’m sure you’ll learn Python in a week and will love it.

Python is much better to integrate with a 3D package… that’s why not only Blender but also Maya and Houdini uses it. Lua scripting has future in gaming, but any noob can master it in 2 days (and it is more used to index files, make easily patcheable vars, etc. not a big future at all)… Python has future in animation (procedural animation, etc,) and it’s proving to be the most realiable language for that, because any experienced computer user can master it in 4 weeks and it’s very powerful, if you like math you’ll love python :D.

It’s just my opinion btw.

Short answer: much more work than it would take for any programmer to learn python :slight_smile:

Learning a new programming language after you already know some is very easy and fast. Python is specially intuitive and fast to understand. Getting familiar with it for an experienced developer is a matter of hours.

On the other hand adding a lua interpreter and api to the bge is close to not viable. You could use one of the many wrappers for embedding lua into python. So you could read lua scripts from your python code. But that wouldn’t be as close as fast as simply… learning python :slight_smile:

Not even python runs independently within the BGE.

Explain more plz,

You’re intriguing me Social :slight_smile:

Possible but wont be accepted.

For Blender 2.5 there was some possibility of supporting multiple languages through a unified, autogenerated api. But was rejected - think of the number of problems we have with python (users with wrong versions, having to include limited copies of it with blender, keeping up with changes in python) - then multiply that by the number of other languages you could support…
so no, and even if some dev codes it and submits a patch and says he’ll support - still no.

Well, I have nothing against Python in general, also not for plugins, or general scripting in 3D app, I agree it fits better than Lua there, but I was wondering only about game engine parts - where as you said it have future :slight_smile: Anyway - you said there are wrappers for using lua in python, any recommendations for something better than calling “lua script.lua” by some “system” command?

cheers,
Andrzej.

I’ve always wondered why programmers implement Lua for game scripting?
What advantages does it hold over Python? I know nothing about Lua :slight_smile: But love Python.

thanks in advance

@fobsta - well Lua-Python comparison for the game industry is something like 3Dmax-Blender comparison for the game industry :wink:

Id not make the max/blender – lua/python comparison…
Lua and python are much more similar, both are opensource scripting languages that can be integrated via C, so from a game engine perspective there isnt so much difference.

  • Lua is generally considered easier to integrate (smaller, lighter C/API)
  • While both obviously can be used to write apps in OR as an extension language…
    Python attempts to be more of a complete language, Lua is aims more to be an extension language-
  • Lua is much smaller then python, something like 55kb for Lua vs ~500kb for Python lib’s (excluding extensions that come with both).
  • Python uses reference counting which is more of a pain to manage from C (easier to get leaks), Lua uses mark and sweep (google for more info).

I can definitely see why people like Lua especially if they dont need so many of the features python has (buffer access, large library, complicated C api… every string unicode… blah blah)

Blender has python types defined in the C++ classes so doing the same with Lua would be fairly messy and clog up the code.

jesterKing (Nathan Letwory) did some experemental lua api for blender years back. nice enough but didnt go anywhere.

Thanks for the technical review ideasman42. I learned a lot from it about the differences.

What I meant was, that lua means for the developers is what max means for the artists in game industry, and not to comparison technically, anyway…it was good to know what is Lua an what is Python in GI.

In our company Lua is used only for describing world and character properties and defining some small functions like what particle effect will be spawned if some weapon is used, everything else is C. I know from our programmers, that Lua is very small, but very fast language and easy to integrate,. but cannot be used as standalone language.

It’s also good choice for consoles where resources are very limited, thus when game is released on many platforms, Lua is chosen for consistency - and because it’s known by many. Also lots of designers, that are non-programmers find it easier to create those world setups and triggers in lua than in anything else - it’s also most widely used, so it’s important point in CV of any designer. You mentioned - lua takes to learn 2 days, python 4 weeks to master by any CS, I agree. But what if Lua takes at least 4 weeks to learn by designer who never seen C or any other programming language, in such case by simple scale - python would take half year to master - it just have more syntax, more tools, bigger library, it’s more powerful - yeah, but lua is enough so why bother - from designer point of view. Anyway I use python myself (for Sage mathematics package, I’m still not expert though, merely simple user, i.e. I know syntax but I don’t “feel” it yet), I use many python apps like mercurial or such and I think it’s great language for scripting, but my designer friend not, that’s why such question arose. :slight_smile:

BUMP

I have very well understood the pros and cons of LUA and Python for using with the BGE, and I understand that (on the paper) it’s way more natural to use Python directly.

However, I have different requirements :
I’ll be using the BGE teamed up with another existing game engine, for specific purposes (I have peculiar needs).
That other game engine works with LUA, and is way too primitive to be adapted to Python.

So, my question is: Any clues on how to bind BGE’s Python with LUA?
Any solution is accepted :

  • A wrapper
  • A way to call LUA scripts from Python (I know it’s pretty much the same thing as a wrapper, I’m just trying to stimulate your imagination)
  • etc.

And since I know there are always g33ks hanging out there, a small proof-of-concept will be very welcome, if you feel like it.

For bridge between lua and python try lunatic-python (I don’t know why I cannot post links, it says it limits url count so just google it) - I think it should work quite well.