Archived

This topic is now archived and is closed to further replies.

dfranklin

Choice of scripting engine. .?

Recommended Posts

dfranklin    122
Hey folks, I know this sounds archaic and/or out-dated, but I''m working on a online multiplayer text-based RPG (please, don''t laugh yet). I''m planning on implementing some kind of scripting engine in this game, to be able to rapidly create or alter anything in the game. The engine will be a basic I was reading through some scripting-related files, when I stumbled across a quote from Henry Robinson - "...scripting languages in games can be sorted into several distinct categories: Interpreted, Byte-code based, and Core-code level." I realize that the core-code level does not seem to be a viable option for me, because I would have to reset the server everytime I wanted to add in a new DLL, which would not be very fun. However, I''m pondering the difference between adding support for an interpreted language, or a virtual machine to handle byte-code. Anyone mind enlightening me on the pros/cons of each and which one would be preferrable (I''m planning on an interpreted one, just hoping for some feedback from the smart folks over here). // Dan Franklin // df@nc.rr.com // "All you touch and all you see is all your life will ever be."

Share this post


Link to post
Share on other sites
Staffan    122
Support both.

Byte-code:
Pros: It''s much faster than interpreted text since you won''t need the lexer and the parser. I''d say it easier to optimize as well.
Cons: You have to compile the script before using it, and write a compiler to do it.

Interpreted text:
Pretty much the reverse of the above


"This album was written, recorded and edited at Gröndal, Stockholm in the year of 2000. At this point in time money still ruled the world. Capitalistic thoughts were wide spread. From the sky filled with the fumes of a billionarie''s cigar to the deepest abyss drenched in nuclear waste. A rich kid was a happy kid, oh..dirty, filthy times. Let this be a reminder."
- Fireside, taken from back of the Elite album

Share this post


Link to post
Share on other sites
Kylotan    9879
The two I''ve heard and seen good things about are Lua and Python.

Lua looks very flexible, although it also looks a little too low-level for me, and I reckon it might take a lot of work to get it running nicely.

Python looks less flexible to my uninitiated eye, but is fairly simple-looking, supposedly easy to embed, and is intuitive enough that some schools now teach it instead of Basic as a "beginners'' language".

Share this post


Link to post
Share on other sites
dfranklin    122
>Byte-code:
>Pros: It''s much faster than interpreted text since you won''t >need the lexer and the parser.

Maybe I''m mistaken, I thought I would need a lexer & a parser for byte-code, as well as an interpreted script.

>Cons: You have to compile the script before using it, and write >a compiler to do it.

This may cause problems if I have to compile first, because I need the changes implemented by the scripts to be available without having to reset the server. . .

What would be the benefits of implementing both of these? Use byte-code for the big functions, like an "attack" command, and use the interpreted script for spur-of-the-moment events?

// Dan Franklin
// df@nc.rr.com
// "All you touch and all you see is all your life will ever be."

Share this post


Link to post
Share on other sites
jesterlecodeur    122
In my mind, scripting engine is that

for compiled byte code:
// Create Time
wrote your code
compile
write on a file
// Run Time
execute byte code w/ virtual machine

for interpreted language:
// Create Time
wrote your code
write on a file
// Load time
compile the code to byte code
// Run Time
execute byte code w/ virtual machine

So the 2 option are the same. It depend just if you want to change some piece of code fast and often (interpreted language) or not.

If you have a lot of code, compile it before to minimise load time. If you have juste some ligne of code interpreted is better since you can change the code in easier way (but you need probably to restart you serveur in each case).

Share this post


Link to post
Share on other sites