Scripting Languages

Started by
21 comments, last by cnirrad 22 years, 1 month ago
Just go for COM and ActiveX Scripting (or .NET hosting if you want to be fancy schmancy). Much easier in the long run -- if someone wants to use their preferred scripting language then they just have to install an appropriate ActiveX control.
char a[99999],*p=a;int main(int c,char**V){char*v=c>0?1[V]:(char*)V;if(c>=0)for(;*v&&93!=*v;){62==*v&&++p||60==*v&&--p||43==*v&&++*p||45==*v&&--*p||44==*v&&(*p=getchar())||46==*v&&putchar(*p)||91==*v&&(*p&&main(0,(char**)(--v+2))||(v=(char*)main(-1,(char**)++v)-1));++v;}else for(c=1;c;c+=(91==*v)-(93==*v),++v);return(int)v;}  /*** drpizza@battleaxe.net ***/
Advertisement
I''d have to second the nomination for python. Python is very slick and well supported. You can find lots of online tutorials and actual books on it. It also comes with a very useful set of libraries.
a Word on COM + ActiveX, its only supported in Windows, be 100% sure you want your game to run on nothing but Windows before taking that option, or well be prepared to do a lot of porting afterwards.

Checked LUA, seems great, C like syntax, object support, small and portable out of the box, no strings attached, I think thats the way to go, have to do some more checking though

quote:Original post by Kwizatz
Never heard of Lua, will give it a try, after giving up embeding PERL, I decided to go with TCL, get the ActiveState implementation if interested, its simple both to program and embed, but it is more suited to work with C than C++.

anyway, good luck!



I'm using TCL for my game engine's embedded interpreter. It works great. I had to jump through a couple of hoops to make my command extensions (written in C) work with C++, but it was mostly painless.

If anyone's curious, TCL somewhat resembles LISP, but with a lot fewer parentheses ;-)

[EDIT] Sorry for the double post.


Edited by - DaTroof on March 7, 2002 12:30:42 PM
Post Extant Graphical MUD
I cant speak for the other scripting languages mentioned here, but using the SpiderMonkey java-script engine is real easy, and you can compile scripts on program initilization.

It really isnt much harder than calling
JSScript* scriptPointer = JS_CompileScript(char* script, a few standard params) as soon as possible and then JS_ExecuteScript(scriptPointer,..standard params..) when the script is needed. Better than a pure interpreter anyway.

Defining native functions that are exposed to the script, is also very easy, but i dont think its possible to check very well for number of passed arguments and their type before its too late.

Also java-script is a pretty good scripting language, the syntax is simple but is reminiscient(spelling?) of Java/C/C++.

And no, im in no way affiliated with the people who made it

Edited by - ziphnor on March 7, 2002 3:56:13 PM
I''m in need of a scripting language suited to a text-based rpg. Anyone who''s played around with MOO will know what kind of capabilities I want. Any recommendations? At the moment I''m looking at Python because it''s OO and (supposedly) plays nice with C++.

-----------------------------------
"It''s groin-grabbingly transcendent!" - Mr. Gamble, my teacher, speaking of his C++ AP class
-----------------------------------"Is the size of project directly proportional to the amount of stupidity to be demonstrated?" -SabreMan
compiled script are better than interpreted since they are faster, and has a smaller size.. i personally dont like the idea of linking native functions using a table since its not practical and harder to code. i prefer compiled script (virtual assembly) so the VM function can be created just like normal assembly i.e. via interrupt. parameters are stored in stack.

''compuphase small'' is a good and fast scripting language, but not easy to implement native functions because it uses dynamic-typed variables. normal typed variable are faster and easier to code.

my recommendation for building your own ''c'' style scripting lang. is by using Gold Parser, quite efficient but not easy..

(phew.. always anonymous)
quote:Original post by Ziphnor
It really isnt much harder than calling
JSScript* scriptPointer = JS_CompileScript(char* script, a few standard params) as soon as possible and then JS_ExecuteScript(scriptPointer,..standard params..) when the script is needed. Better than a pure interpreter anyway.


Hi Ziphnor,
I started out investigating spidermonkey... I got the interpreter into my code and compiled without much fuss. But, when it came time to expose my objects I became frustrated by the manner in which they force you to wrap the java-script classes around your classes. Did I miss something or are you not exposing classes to the interpreter?

I was sold on using Spidermonkey because of the language itself and how easy it is for non-programers to pick it up and write script... so the only thing I have to solve before moving back to the monkey is how to expose my objects (or rather the API that I want the script writers to use).

Thanks,


Dave "Dak Lozar" Loeser
Dave Dak Lozar Loeser
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."--anonymous
I decided to go with a handle based system.

For example(in AI script)

getNearestEnemy() returns a handle(integer) to the nearest hostile game object. The script language can then call for example setTarget(myHandle, getNearestEnemy()) etc.

You can also expose factory methods to the script, that can construct objects on the native(C/C++) side, but only recieving a handle to it.

Forgot this: Performance wise, a handle system is also pretty smart because it means there is less conversions going on between the native and script side. Sending alot of data between the 2 is expensive.

Edited by - ziphnor on March 8, 2002 4:49:27 PM

Hi!

If i want to use python - do i have to open the source of my game ?

I interpret the "open source definition 1.9" in the way that i have to publish the source of my commercial projects to be able to use python.

McMc
----------------------------My sites:www.bytemaniac.com www.mobilegames.cc

This topic is closed to new replies.

Advertisement