[MUD-Dev] How much should be offloaded to Scripting?

Lars Duening lars at bearnip.com
Tue Feb 10 23:28:46 New Zealand Daylight Time 2004

On Feb 10, 2004, at 4:05 PM, Dan Larsen wrote:

> I'm working on a hobby game atm, text-based and driven by an
> object-oriented scripting language.  I'm sure I'm not the only
> one, but my scripting language is now up and running, as is the
> network layer of the server itself.

> Now, my question is this.  How much of the game should I offload
> onto my scripts, versus hard-coding it in the server?  If any of
> you are familiar with TADS (Text Adventure Development System),
> the language is comparable to that, which means I could implement
> my entire parser via script, as well as my world and interactions.
> Basically, my server could be totally ignorant of what a 'room' or
> an 'actor' or the command 'say' is.

> But does it make more sense, both architecture and
> performance-wise, to shift at least some of the logic to the
> server itself (written in C)?  For example, letting it parse and
> dispatch commands, the vast majority of which simply trigger
> script events.

I think the proper answer is "it depends": on the amount of
computation done, on the frequency of the calls, etc. To give a
definite answer, you'd have to run the server under a profiler.

That said, you can perform a pre-selection by rule of thumb: if a
certain action is computationally expensive and is called often, it
is a candidate for hard coding it into the server. Command parsing
for example is better put into the server such that it offers the
scripts a generic way to parse input into verbs & arguments;
however, the list of known verbs and the decision of what to do with
the parsed result is better kept on the scripting level.

Lars Duening; lars at bearnip.com
GPG Key: http://www.bearnip.com/lars/lars-duening.gpgkey
MUD-Dev mailing list
MUD-Dev at kanga.nu

More information about the MUD-Dev mailing list