Making a scripting language for Irlicht?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

I will give big-ups to Python. It's actually usable for serious projects. Did you know that Eve Online is written primarily in (a variant of) Python?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Wow I did not know that. I havent given python a try personally because it complains when you put tabs in the wrong place :lol: But its getting to me slowly...
ebo
Posts: 38
Joined: Sun Feb 19, 2006 5:39 pm

Post by ebo »

roxaz wrote:scripting engines are sooooo slowwwww.....
Always remember the 90/10 (or 80/20 depending on who you ask) rule: 90% of the time is spend in 10% of the code.

Implement those 10% in C++ for speed of execution and the rest in a scripting language of your choice. Nobody can deny it's much faster, easier and generally saver to use a scripting language. There are powerful tools to glue these together (for example: SWIG)
roxaz
Posts: 575
Joined: Tue Jan 23, 2007 8:35 pm
Location: LT

Post by roxaz »

steveth45 wrote:Python is ugly? Heres a chunk of C++ from ISceneNode.h:

Code: Select all

core::list<ISceneNodeAnimator*>::Iterator ait = Animators.begin();
for (; ait != Animators.end(); ++ait)
    (*ait)->drop();
Here would be the equivalent code in Python:

Code: Select all

for anim in Animators:
    anim.drop()
Which one is uglier?
oh ok, you got me, im *OWNED* :)
BlindSide wrote:Wow I did not know that. I havent given python a try personally because it complains when you put tabs in the wrong place :lol: But its getting to me slowly...
this is exactly why i said that python is ugly :P
evo
Posts: 96
Joined: Mon Jun 27, 2005 6:46 pm
Location: The Netherlands

Post by evo »

Scripting has disadvantages (mainly speed-loss) and advantages (mainly flexible run-time behaviour).
You have to work around the disadvantages. For instance don't call all scripts in every renderpass. Create a scheduling or triggering mechanism to run scripts at C++ level. Also you can call C++ funtions from a script for calculation intensive stuff.

And make optimum use of the advantages of scripting. I use them for all 'variables' in my game, like behaviour of characters, objects, determining if game milestones have been reached, etcetera.

In my opinion there is no alternative for scripting if you want to create a multi level game.

This my demo that I posted a while back using Squirrel Plus:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=15684
steveth45
Posts: 14
Joined: Fri Mar 03, 2006 2:42 am
Location: Eugene, OR, USA
Contact:

Post by steveth45 »

Well, I finished my game for PyWeek. I made a binding for Irrlicht using Boost::Python and then wrote all the game code in Python. The main game loop and all the per-frame update methods are Python. There is no performance issue using the scripts to update every frame. Currently the speed bottleneck is all the animation calculations that happen inside Irrlicht itself since there can be as many 50 or so animated models at a time being calculated. The only Irrlicht animator I am using is the delete animator on some particle effects. All the collision code and per-frame position and rotation updates are done in Python.

The game runs "out of the box" on Windows, as long as you have Python 2.5 installed. There are a couple dependencies to run the game in Linux. Here is a link to the game on Pyweek.org : http://www.pyweek.org/e/SDAFF/

Make sure to get version 1.3 and if you are using Linux, follow the instructions on that page to get the Boost and Audiere dependencies installed correctly.
+--------+
steveth45
+--------+
linkoraclehero
Posts: 81
Joined: Sat Sep 09, 2006 6:46 am

Post by linkoraclehero »

I've began work on a scripting language driven version of Irrlicht to allow quick development and deployment of Irrlicht applications to hopefully increase the fanbase by spreading it to people who don't know a damn thing about coding. At the same time, I will make a scripting deal for irrLicht that works like the XML parser except using compiled grammer files from Gold Parser (Because Gold Parser is the poop).
imjinc2k
Posts: 5
Joined: Mon Dec 25, 2006 6:14 am

Post by imjinc2k »

Battlefield 2 and 2142 use Python game logic and scripting. Using a language people already know, rather than writing your own, means your game can have a thriving modding community if you choose. Nobody wants to learn a homegrown pseudolanguage that they'll never ever, ever use again, and it's just one more thing to debug and maintain. Better to use an already robust, mature language and tailor your _API_ to non-programmers. Some great technical info on how Python hooks into Battlefield here: http://bf2tech.org/index.php/Main_Page

And as for rapid development? Let's look at the timeline:

Battlefield 2 - June 2005
BF2: Special Forces - November 2005
BF2: Euro Force - March 2006
BF2: Armored Fury - June 2006
Battlefield 2142 - October 2006
BF2142: Northern Strike - March 2007

$160 out of my pocket over 2 years, without having to build some million-dollar MMO cluster,... thanks to Python.

-Black Matt
Post Reply