Choice of scripting engine. .?

Started by
3 comments, last by dfranklin 22 years, 10 months ago
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."
"All you touch and all you see is all your life will ever be."
Advertisement
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
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".
>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."
"All you touch and all you see is all your life will ever be."
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).
_______________
Jester, studient programmerThe Jester Home in French

This topic is closed to new replies.

Advertisement