Game scripting languages

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
d3jake
Posts: 198
Joined: Sat Mar 22, 2008 7:49 pm
Location: United States of America

Game scripting languages

Post by d3jake »

Hello all!

Currently in the game I am working on, I have a statemachine, rudimentary event system, the ability to read the parameters for createDevice() out of a config file, additionally a teammate added in code so that settings in the config file can be overriden by commandline operators and not much else... My game is aiming to be a 6DoF FPS similar to the Descent series. The series hasn't had any major improvements in several years, so my team is aiming to create a new game, perhaps not in name to avoid copyright issues...
On the side I've been using irrBullet to sort out physics. For testing I've basically torn one of the irrbullet examples apart and figured out how to make things work. Before I integrate physics into my game I want to get my attribute loader in place, to load physics values for objects and not have to hardcode values.

Starting with the beginning I've tried to plan out the structure of my game to the best of my ability to ensure that I reduce the number of times I have to tear out code to do it right. In fact, I ended up planning for five days before starting any code (not doing nothing but planning mind you...) This has gotten me to the current state of my game. I'm proud of the current state of my game, although my methods may not be the best in the world.
All of this talking has finally gotten us to my question! yay!
As I said, I've been planning everything and when I got to thinking about scripting I had to sit down and figure out what would possibly be using scripting, and this is what I came up with: Note Sheet [LARGE IMAGE]
Looking at this made be realize that I haven't got clue one as to where to start with scripting. I've heard of many languages, and I've seen many articles, but none have been the "general outlay" of how the scripting should best be laid out.
In addition, I've heard good things about languages line Angelscript, python, Lua, swig, but the best thread that I saw that talked about them was this one: http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=19356 and I'm concerned that it's outdated.
Are there any good resources for learning about scripting? Are certain languages better for certain types of scripting than others? Does anyone know of good examples of working game implementations of these languages?
The Open Descent Foundation is always looking for programmers! http://www.odf-online.org
"I'll find out if what I deleted was vital here shortly..." -d3jake
Nalin
Posts: 194
Joined: Thu Mar 30, 2006 12:34 am
Location: Lacey, WA, USA
Contact:

Post by Nalin »

Well, one of the first things you should do is decide what language features are acceptable, and which ones aren't. For example, AngelScript is an object oriented language very similar to C/C++ that is also statically typed. Lua is a dynamically typed language with a very unique syntax, and heavily revolves around the use of tables. In Python, scope is determined by whitespace. An extra tab or a space in front of a line could cause errors in your code.

You should first evaluate the type of scripting languages you would be comfortable with, then look at how easy they are to implement in your project. The sirrf project is a good place to start for learning AngelScript implementation, as it includes bindings for Irrlicht's basic classes (although, it is a little old, so the bindings aren't complete.) Boost.Python, part of the Boost library, makes it easy to bind C++ classes to python.
DtD
Posts: 264
Joined: Mon Aug 11, 2008 7:05 am
Location: Kansas
Contact:

Post by DtD »

In addition to AngelScript mentioned above. There is Game Monkey http://www.somedude.net/gamemonkey/ it is very nice. I would highly recommend it. Game Monkey is easier to learn and get set up, AngelScript is harder to learn and get set up but is easier to bind once you learn. I also experienced better community support with GameMonkey.

~David
Kojack
Posts: 67
Joined: Sun Jan 20, 2008 2:39 am

Post by Kojack »

Falcon is another fun one to have a look at.
http://www.falconpl.org

It's base syntax is very similar to Lua, but it has a ton more stuff (like functional and oo programming).
_maxim_
Posts: 54
Joined: Thu May 27, 2010 11:05 am
Location: Russia
Contact:

Post by _maxim_ »

FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

Also v8 from google, its a great and easy to use scripting engine (which i replaced my use of angelscript with).

I also wrote a small primer/helper function for people interested in v8 :

http://blog.owned.co.za/?p=205

There is also game programming gems 6, which compares a good handful of scripting engines and why to use each.
willywilly
Posts: 3
Joined: Fri Jun 04, 2010 7:02 am

Post by willywilly »

FuzzYspo0N wrote:Also v8 from google, its a great and easy to use scripting engine (which i replaced my use of angelscript with).

I also wrote a small primer/helper function for people interested in v8 :

http://blog.owned.co.za/?p=205

There is also game programming gems 6, which compares a good handful of scripting engines and why to use each.
Thanks 1000x. Your blog post is exactly what I looked for. :D You now have one more reader.

In case anyone else is interested: http://code.google.com/p/v8-juice/ helps to embed V8 into your application.

Edit:
Also check this out: http://shootout.alioth.debian.org/u32/b ... &lang2=gcc
You can compare all kinds of scripting languages in case speed is of essence for your game.

My experience is that LUAjit should be easiest to implement and very,very fast. Gamemonkey is close second, but it is rather old and unmaintained if I remember correctly. With python, you can do absolutely everything right out of the box, of course, but is a little slower and may slow your startup time down a little bit (maybe 5 seconds). Please take all of this with a grain of salt. You should maybe try some of those languages to check the syntax and how to bind them to C++.

I personally just like JavaScript better and in case HTML5 games ever take off, this is pretty future proof.
d3jake
Posts: 198
Joined: Sat Mar 22, 2008 7:49 pm
Location: United States of America

Post by d3jake »

The information above is appreciated!

The next question that comes to mind is this: I've heard that scripting languages can speed development dramatically, at least in the realm of multiplayer gametype and\or level scripting. Also, using straight C++ seems like a logical choice, nothing more to set up, just create a uniform API, and away you go. How would you make the argument for using a scripting language, and the correct code to allow it to talk to C++, instead of using straight C++?
The Open Descent Foundation is always looking for programmers! http://www.odf-online.org
"I'll find out if what I deleted was vital here shortly..." -d3jake
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

The big advantage of scripting comes in that you can change what the program does without having to recompile it. This makes it far faster, and usually far simpler to find what you want to change.
ChaiRuiPeng
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

Post by ChaiRuiPeng »

scripting languages are slower because they are a second layer of abstraction and not as "real" as lower level languaging.

it is easier for humans to read

but computer needs to execute script every logic/whatever tik and figure out what it means in lower level terms.

however we have powerful computers today so sppeed issue of scripting languages is not a big as problem as before.
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

That's not entirely true. Most scripting languages allow you to compile the script so the program can parse and execute them much faster.
DtD
Posts: 264
Joined: Mon Aug 11, 2008 7:05 am
Location: Kansas
Contact:

Post by DtD »

Scripting languages might compile to byte code, but this is not native code and is inheritly slower. However, this is becoming less and less of an issue as computers get faster and scripting languages get more optimized.

Also, I was surprised to see I posted in this topic, from the grave!

~Pathogen David
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

I'd recommend pawn it is really fast ( is said to be faster than lua JIT), small in size (fits into about 27kb or even smaller), and is easy to integrate.
It is used for amxmodx(scripting for hl1 engine game servers, and maybe others) project tough I think they modified it a bit.
Also theres SA-MP which is GTA san andreas multi-player modification.
There may be other cool projects using it tough I don't know any.
You can take a look at my attempt to write a "tutorial" for it in my signature, tough I think I made some mistakes, but if you need help I will try or you could look at the manual which explains every detail of it.

Also I have tried python, It gives you more control out of the box but also is a lot harder to use(like distribution).
Working on game: Marrbles (Currently stopped).
_maxim_
Posts: 54
Joined: Thu May 27, 2010 11:05 am
Location: Russia
Contact:

Post by _maxim_ »

serengeor wrote:Also I have tried python, It gives you more control out of the box but also is a lot harder to use(like distribution).
what is distribution problem?
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

_maxim_ wrote:
serengeor wrote:Also I have tried python, It gives you more control out of the box but also is a lot harder to use(like distribution).
what is distribution problem?
Well I had problems to get it to run on other machines, it usually requires them to get the same version of python, ect. I haven't done anything lately with it so I can't really remember right now.
Working on game: Marrbles (Currently stopped).
Post Reply