TinyMux Ideas
January 18th, 2006Recently, I’ve been active in discussions involving TinyMux regarding the implementation of PHP in the server. It got me thinking on other languages that would work as well, if not better, in such an environment.
First a bit of context.
For those of you who don’t know, TinyMux is a “Multi-User eXperience”, an offshoot of an old internet game called a MUD. The basic idea is not unlike that of a MMOG, except they’re typically text-based, and don’t have (usually) thousands of players attached - the most I’ve seen in my experience has been about 120 players. You move around by typing simple commands, such as “look” to look around the “room” you’re in, and can interact with the “environment” as much as the builder built into it.
Mux is an object-based system with inheritance. What this means is, you create an object with a command, and it starts out its life as a literal tabula rasa. It has no properties, no description - it’s a chunk of ephemeral existence. Einstein would argue that it’s spooky, I suppose. From there, you “describe” the object (what someone is given when they “look” at the object), give it some basic properties, and - if you know what you’re doing - program functionality into it using MUSHCode. MUSHCode is a simple programming language that can do things such as make “noises” in the room, dispense in-game “cash”, or in some extreme cases, generate a character “sheet”. The inheritance part only means that you can then create a second object, and set its “parent” as the first object. You now have a copy of the original, but you can now modify it, including the properties that were set on its “parent”. It will “inherit” anything you don’t change from the “parent”, meaning you can now have two ATM machines in your game - one for each in-character bank network.
MUSHCode is great for what it does, and it’s been a point of contention whether it needs to be improved or not - in some cases, individuals believe that if you want MUSHCode improved that badly, change the “hard code” - essentially modifying the server software that manages the Mux. For some this works - for others, it doesn’t.
The current proposal on the floor is adding a couple of new functions within MUSHCode that allow someone to execute PHP code on objects and rooms (which are essentially giant objects). This means a potential for cleaner-looking code, extremely flexible functionality, and the ability to make complex, custom functions for an object. I’ve already played around with this, and have created a simple stub that’s only missing the connecting piece to the PHP interpreter. In the process of this, I realized the difficulty in doing this with the current mux code. Brazil’s done a lot of work on the code over the - decades!? - and it’s always improved. But the server simply doesn’t have the architecture to add scripting languages within it, at the moment.
During my research into embedding PHP into software, I started looking into embedding Python into Mux. I found that LOTS of newer video games on the PC platform have already started to use Python for an internal “scripting” language. Python is a “pragmatic” language. This means that the language syntax is structured in such a way that what you tell it to do, it does. Here’s an example:
def MobAttack(target):
target.health -= MobObj.calc_damage(target)
Because everything in Python is an object, you can do all SORTS of neat things if you embedded it in a Mux, or made it the object-language.