Scripting language choice

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.

Which scripting language would you prefer?

AngelScript
5
6%
Lua
29
37%
Python
22
28%
Game Monkey
7
9%
Squirrel
7
9%
Other
8
10%
 
Total votes: 78

SiriusCG
Posts: 58
Joined: Tue Feb 14, 2006 1:05 am

Scripting language choice

Post by SiriusCG »

After searching through the forums, I've been unable to find any scripting language support for Irrlicht. After many months of preparation, decisions and working out our content pipeline, etc, my friends and I are ready to start a serious game effort.

Really, we are... no really! I mean it! 8)

All we see as lacking in Irrlicht is a decent scripting language. The Apocalyx Engine uses Lua and AngelScript to a great advantage for in-game programming and external configuration scripting. We would like to do the same for Irrlicht. Our efforts will be shared with the Irrlicht community upon completion in keeping with the spirit of Open Source.

Our basic criteria:
1. Must be compilable in both Windows and Mac OS X. Linux is a plus but not necessary.
2. Must be a stable, decently featured language.
3. Would like to be able to embed it in Irrlicht code using standard calling conventions consistent with C/C++.

Currently we're considering Squirrel as a front runner as it would allow us to leverage our knowledge in both the Irrlicht Engine and extending IrrEdit. But Squirrel is not a final choice yet.

Any constructive points of view, suggestions or opinions are welcome. We would appreciate knowing *why* you would prefer one language over another and if you've had any experience using it in a game enviroment. 8)
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Remember that Irrlicht is a 3d engine, not a full game engine. The GUI could perhaps benefit from script support, but if you want to do serious GUI work then you might be better with something like CEGUI anyway.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
SiriusCG
Posts: 58
Joined: Tue Feb 14, 2006 1:05 am

Post by SiriusCG »

Remember that Irrlicht is a renderer, not a game engine.
True enough, but most of the elements are there to be welded into a game engine framework, which is what we intend to do. Scripting is an integral part of that effort... We want to be able to move part of the game logic into external scripts for prototyping, testing and debugging without having to go through the usual "write, compile, run" cycle...

Currently I can see no reason why we can't interface to the existing GUI built into Irrlicht ie: calling up a "text window" to enter or mod a running script...
Last edited by SiriusCG on Tue Feb 20, 2007 3:59 am, edited 1 time in total.
kornerr
Posts: 245
Joined: Thu Jul 06, 2006 9:57 am
Location: Russia, Siberia, Kemerovo
Contact:

Post by kornerr »

Lua, because it's small, easy and easily embeddable (with LuaBind + Boost).
Open Source all the way, baby ;)
OSRPG
messen
Posts: 25
Joined: Tue Aug 29, 2006 2:51 pm
Location: Agalon
Contact:

Post by messen »

Hi!

I use psl by Steve Baker, 'cause it is easy to me.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Fair enough, but let's be clear that this is scripting for your game, not for Irrlicht per se.

Oh, and another vote for lua. ;)
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
SiriusCG
Posts: 58
Joined: Tue Feb 14, 2006 1:05 am

Post by SiriusCG »

but let's be clear that this is scripting for your game, not for Irrlicht per se.
Ah, I see your point... Quite right. Scripting would be part of a game framework... :wink:
Frodenius
Posts: 64
Joined: Sun Aug 29, 2004 11:24 am
Location: Germany/Frankfurt
Contact:

Post by Frodenius »

yet another one for lua ;) its easy, free (os) and its name is beautiful!
worst programming style ever seen...
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

It's also fairly portable; I got a (modified version) running under BREW, which is pretty much the worst case scenario.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

I'm a big fan of python, although I've never used it for games. I think it's main limitation is the annoyance of mixing tabs and spaces, but other than that it's great. It's power comes from the mix of paradigms and huge number of things it can do out of the box, and also from the masses of code already out there.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

Have you tried IrrLua? :)
-------------------------------------
IrrLua - a Lua binding for Irrlicht
http://irrlua.sourceforge.net/
SiriusCG
Posts: 58
Joined: Tue Feb 14, 2006 1:05 am

Post by SiriusCG »

Have you tried IrrLua?
Yes, I looked at it a bit. However, using IrrLua is not quite what I wanted to do. Using IrrLua, I still ended up typing a lot of the actual Irrlicht commands and parameters... I didn't see any great benefit as it was a small step to just program the application in Irrlicht and native C++.

The Apocalyx Engine uses a Lua binding that greatly simplifies coding. Here's a snippet setting up a Quake model, a sky, lighting and an avatar:

Code: Select all

----BSP INITIALIZATION----
function BSP_init()
  showLoadingScreen()
  ----CAMERA----
  setAmbient(.2,.2,.2)
  setPerspective(60,3,12000)
  local camera = getCamera()
  camera:reset()
  empty()
  ----SKYBOX----
  if not fileExists("DemoPack0.dat") then
    showConsole()
    error("\nERROR: File 'DemoPack0.dat' not found.")
  end
  local zip = Zip("DemoPack0.dat")
  local skyTxt = {
    zip:getTexture("skyboxTop2.jpg"),
    zip:getTexture("skyboxLeft2.jpg"),
    zip:getTexture("skyboxFront2.jpg"),
    zip:getTexture("skyboxRight2.jpg"),
    zip:getTexture("skyboxBack2.jpg")
  }
  local sky = MirroredSky(skyTxt)
  setBackground(sky)
  ----SUN----
  sun = Sun(
    zip:getTexture("light.jpg"),0.25,
    0.0, 0.2588, 0.9659,
    zip:getTexture("lensflares.png"),
    5, 0.2
  )
  sun:setColor(0.855,0.475,0.298);
  setSun(sun)
  ----EMITTER----
  local fireImage = zip:getImage("smoke.png")
  fireImage:convertTo111A()
  local fireTexture = Texture(fireImage)
  fireImage:delete()
  shotEmitter = Emitter(5,.1,3)
  shotEmitter:setTexture(fireTexture,1)
  shotEmitter:setVelocity(300,0,0, 0)
  shotEmitter:setColor(1,1,1,1, 1,.5,0,0)
  shotEmitter:setSize(22.5,22.5)
  shotEmitter:setGravity(0,0,0, 0,0,0)
  shotEmitter:setOneShot()
  shotEmitter:reset()
  addObject(shotEmitter)
  shotEmitter:hide()
  fireTexture:delete()
  ----BSP----
  if selectedLevel < 0 then
    bsp = zip:getLevel("maze.bsx",2.5)
  else
    local pak = Zip("pak0.pk3")
    bsp = pak:getLevel(levelNames[selectedLevel],2.5)
    pak:delete()
  end
  bsp:setShowUntexturedMeshes()
  bsp:setShowUntexturedPatches()
  showTransparenciesFlag = false
  useFastRenderingModeFlag = false
  bsp:setDefaultTexture(zip:getTexture("bricks.jpg",1))
  setScenery(bsp)
  ----MODELS----
  flyModeActive = 0
  runModeActive = 1
  isWalking = 0
  isRotating = 0
  linkTransform = Transform()
  legs = 5   ---> LEGS_IDLE
  weapon = zip:getModel("gun.md3","gun.jpg")
  avatar = zip:getBot("wrokdam.mdl",1)
  avatar:pitch(-1.5708)
  local startX, startY, startZ = bsp:getStartingPosition()
  avatar:move(startX,startY,startZ)
  avatar:move(0,0,0)
  avatar:getUpper():link("tag_weapon",weapon)
  avatar:setUpperAnimation(4) ---> TORSO_STAND
  avatar:setLowerAnimation(legs)
  addObject(avatar)
  setListenerScale(32)
  local shotSound = zip:getSample3D("shot.wav");
  shotSound:setVolume(255)
  shotSound:setMinDistance(8)
  shotSource = Source(shotSound,avatar);
  shotSource:getSound3D():stop()
  addSource(shotSource)
  local runSound = zip:getSample3D("run.wav");
  runSound:setLooping(1)
  runSound:setVolume(255)
  runSound:setMinDistance(8)
  runSource = Source(runSound,avatar);
  runSource:getSound3D():stop()
  addSource(runSource)
You don't see any of the underlying Apocalyx engine C++ code... This allow rapid prototyping... and I think it would allow new programmers to access Irrlicht features in a simpler, less convoluted way. :wink:
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

If you do choose Lua specifically, I recommend tolua++ for C++ bindings. It has a few quirks but it works quite well and is simple to use.

If you can't decide, there is always the SWIG project. http://www.swig.org
SWIG is a generic language binding tool.


Supported Languages
The following scripting languages were supported in the final SWIG 1.1 release.

* Tcl 8.0 and newer versions.
* Python 1.5 and newer.
* Perl 5.003 or newer.
* Guile 1.3.4 and newer.

The following languages are also supported in SWIG 1.3.6 onwards.

* Java JDK 1.1 and newer.
* Ruby.
* Mzscheme.

PHP support was added in SWIG 1.3.11.
Objective Caml (Ocaml) and Pike support was added in SWIG 1.3.14.
Support for C# and the Chicken scheme compiler was added in SWIG 1.3.18.
Support for Allegro CL and Modula-3 was added in SWIG-1.3.22.
Support for Lua, CLISP and Common Lisp with UFFI was added in SWIG-1.3.26.
Support for Common Lisp with CFFI was added in SWIG-1.3.28.
Support for R was added in SWIG-1.3.30.

If you create a SWIG binding, your project will be compatible with any of those languages.
-------------------------------------
IrrLua - a Lua binding for Irrlicht
http://irrlua.sourceforge.net/
Saturn
Posts: 418
Joined: Mon Sep 25, 2006 5:58 pm

Post by Saturn »

zenaku wrote:If you create a SWIG binding, your project will be compatible with any of those languages.
It is not so easy in practice actually. Your interface usually is much more bound to a single target language. Not all features are available for all targets (directors for instance) and at least we have quite a few typemaps, which are tightly coupled to the language they are for.

But nevertheless, SWIG is from all I've used so far the best scripting wrapper in terms of power and comfort. But probably not performance.


But for gaming purpose I'd also say one can't go wrong with LUA it is a proven solution and for that I wouldn't use swig. ;)
anoki
Posts: 58
Joined: Fri May 05, 2006 8:31 am

Post by anoki »

Python is a very professional language with great support.
It has a great structure and advanced. I think it would be the
best choice.
Post Reply