Making a scripting language for Irlicht?
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
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
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
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.roxaz wrote:scripting engines are sooooo slowwwww.....
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)
oh ok, you got me, im *OWNED*steveth45 wrote:Python is ugly? Heres a chunk of C++ from ISceneNode.h:
Here would be the equivalent code in Python:Code: Select all
core::list<ISceneNodeAnimator*>::Iterator ait = Animators.begin(); for (; ait != Animators.end(); ++ait) (*ait)->drop();
Which one is uglier?Code: Select all
for anim in Animators: anim.drop()
this is exactly why i said that python is uglyBlindSide 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 But its getting to me slowly...
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
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
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.
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
+--------+
steveth45
+--------+
-
- Posts: 81
- Joined: Sat Sep 09, 2006 6:46 am
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).
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
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