[MUD-Dev] How much should be offloaded to Scripting?
brianhook at pyrogon.com
Tue Feb 10 20:46:04 New Zealand Daylight Time 2004
On Tue, 10 Feb 2004 18:05:16 -0500
Dan Larsen <mortinmonikt at hotmail.com> wrote:
> Now, my question is this. How much of the game should I offload
> onto my scripts, versus hard-coding it in the server?
Well, that depends on what you want, right? The more you have in a
dynamic scripted environment the more customizable the game is by
non-programmers, and you should be able to do "hot fixes" by
dynamically reloading scripts on the fly.
> Basically, my server could be totally ignorant of what a 'room' or
> an 'actor' or the command 'say' is.
I have three layers in my back end:
scripting + server + database
The database is PostgreSQL, and the server (aka "kernel") directs
traffic between the script system and the database.
Scripting is responsible for all logic in the game.
The database stores all the stuff you'd expect, rooms, item
instances, templates, doors, spells, containers, etc.
The kernel talks to the DB on behalf of the script, however it does
have knowledge of the basic structure of key scripted objects. The
reason for this is that I didn't want the script to be dependent on
the actual choice of database. The kernel acts as an abstraction
layer. The kernel is also responsible for accepting TCP connections
and marshaling and routing network traffic.
I could have easily written this so that the scripting code itself
generated SQL queries to an ODBC driver and also made the script do
the sockets, etc. entirely, at which point the whole thing would
have been done 100% in script, and I think that's probably a valid
way to go.
In fact, if I had to do this all over again, I'd probably do that --
I balked mostly because I wasn't familiar enough with the scripting
language originally (Lua) to get into a comfort zone for that.
Anyway, the system I have in place works very well. Lua is fast and
garbage collects, and I only trap into the kernel for low level
stuff that Lua doesn't natively support (there are contributed Lua
socket and SQL libraries that I could have used instead of writing
> This saves the scripting language from having to parse, and
> doesn't cost much flexibility, but it is limiting in some ways.
Do you have reason to believe that the scripting language is gating
MUD-Dev mailing list
MUD-Dev at kanga.nu
More information about the MUD-Dev