[MUD-Dev] Scripting languages
Mark 'Kamikaze' Hughes
kamikaze at kuoi.asui.uidaho.edu
Sun Jun 29 17:39:30 New Zealand Standard Time 2003
Sun, Jun 29, 2003 at 05:24:54AM -0700 in
<20030629122454.70443.qmail at web21308.mail.yahoo.com>, sanxion
sanxion <sanxion2002 at yahoo.com> spake:
> On the topic of scripting languages does anyone have any
> experience with scriping languages coupled to a java mud server?
While not for a MUD, I wrote my own scripting language, Minimal, for
the first version of Hephaestus:
In Hephaestus 2, I dropped Minimal, and adventures are written in
Java. I give access to the Java API, but put it in a security
sandbox so people can't write trojan adventures. It works in this
case because adventure writers need to be somewhat technical, but
not everyone is going to be happy with writing Java code.
There's four approaches to doing scripting in Java.
1) Interpreted. Writing interpreters in Java is very easy, but
it's not very fast. I'm a bit of a freak, I guess, having written
several little language interpreters in Java, but it's one of the
easiest languages to write good interpreters in.
2) Pseudo-compiled. Write scripting code in a custom language,
then convert that into Java statements, run the Java compiler to
produce bytecode, and load the classes. You get speed, total
control over security, and a fairly easy development process.
This is the solution used by Mike Cowlishaw's excellent NetRexx
3) Compiled. If you're really hardcore, you can try writing a
compiler to produce bytecode and then load those classes. I do
not recommend it, because it has no advantages over the
pseudo-compilation process, and it's non-trivial to make legal
class files. Leave that to javac.
4) Use an existing scripting language, like Jython, Beanshell, or
Jacl. These tend to be very slow, but it's the easiest drop-in
solution, and in the case of Jython, Jacl, and many other language
emulators, you get a well-known language. See
for a list of 165 languages already implemented in Java. Surely
one of them will be useful.
If you're going with 1-3, I'd recommend getting a copy of _Building
Parsers With Java_, by Steven John Metsker, to deal with the parsing
<a href="http://kuoi.asui.uidaho.edu/~kamikaze/">Mark Hughes</a>
MUD-Dev mailing list
MUD-Dev at kanga.nu
More information about the MUD-Dev