Author Topic: Is there a vim or equivalent for mud use?  (Read 4709 times)

Offline FallenTree

  • BFF
  • ***
  • Posts: 476
    • View Profile
Is there a vim or equivalent for mud use?
« on: March 17, 2013, 08:26:55 PM »
I found it astonishing to still have to use "ED" to do any sort of in game editing.

Offline Camlorn

  • Friend
  • **
  • Posts: 76
    • View Profile
Re: Is there a vim or equivalent for mud use?
« Reply #1 on: March 17, 2013, 10:28:39 PM »
By no means as advanced as Vim or the like, dead souls has a charmode editor.  If you connect via telnet or something else that properly sends all keystrokes to the mud, dead souls can apparently give you something notepad-ish.  Personally, though, just use ftp--at least for yourself.

Offline quixadhal

  • BFF
  • ***
  • Posts: 619
    • View Profile
    • A Waste of Time
Re: Is there a vim or equivalent for mud use?
« Reply #2 on: March 17, 2013, 10:48:00 PM »
While there was a project to merge in a vi clone (vile, I think) to the TMI-2 mudlib, ages ago... the problem remains the way the driver is written.

While you can enable charmode in telnet, most people still don't find the performance adequate, because the driver only processes user input once per loop, in which time it's also running lpc code.  As a result, even on a LAN, you'll find keystrokes in charmode tend to have much more latency than you'd expect.

It's not even entirely a problem of threading.  Suppose you multi-thread the I/O so keystrokes appear in the buffer as quickly as possible... you STILL have the issue that your lpc code only runs every so many times a second.  So any editor written in lpc will still be laggy.

One solution would be to allow the driver to fork a real editor, with all the security issues that brings.  So far, nobody has wanted to tackle this, as it still entails temporarily linking the socket descriptors directly to an editor process and then restoring them when it exits.

For now, the kludgy way is to have your MUD client track your current directory, and when you type "vi file.c", it actually ftp's the file down, invokes your editor, and then ftp's it back up.

Offline FallenTree

  • BFF
  • ***
  • Posts: 476
    • View Profile
Re: Is there a vim or equivalent for mud use?
« Reply #3 on: March 18, 2013, 12:29:09 AM »
hmm. I guess you can probably do it by connecting stdout/stderr with a external process.

Isn't that the way PACKAGE_EXTERNAL is implemented?

Offline FallenTree

  • BFF
  • ***
  • Posts: 476
    • View Profile
Re: Is there a vim or equivalent for mud use?
« Reply #4 on: March 18, 2013, 12:49:22 AM »
looks like this could work Without security in mind:

on some efun invocation.
1) driver create a chroot and runs busybox-static
2) driver mark a user's channel to be "externalized", which is processed separately in another thread that directly feed into/from into bash's stdin/stdout.
3) on bash exit or some magic key sequence ( \n~. ? ) ,  mark the user channel to be not externalized anymore so it will receive normal mud information.

in that busybox user can basically do everything as the mud-driver user on the server. 

Looking at how PACKAGE_EXTERNAL (unix stream socket)  is implemented I think this may be done even without 2) / 3), just run it through socat  would be enough.

busybox-static basically gives you anything.  even have a vi.

Offline quixadhal

  • BFF
  • ***
  • Posts: 619
    • View Profile
    • A Waste of Time
Re: Is there a vim or equivalent for mud use?
« Reply #5 on: March 18, 2013, 03:30:47 AM »
The thing is, for security reasons, you don't WANT to give out everything. :)

While chroot is fine for editing a single file, I'm sure most of us need to have multiple files available when creating new stuff.  Ideally, you'd want to hack a version of vim/vile/elvis/etc, so it uses the mud's security system to determine read/write permissions to files in the mudlib hierarchy, and doesn't allow access to anything OUTSIDE that hierarchy.

A chroot would lock it down to the mudlib, but without using the mud's security, you have to either limit it to only the file specified at launch, or the whole mudlib (a security hole for non-admins).

I wouldn't bother with an escape sequence... if you're spawning an external editor, whatever messages you have can wait until you exit it.  It's too hard to ensure the display can be restored properly.

Offline FallenTree

  • BFF
  • ***
  • Posts: 476
    • View Profile
Re: Is there a vim or equivalent for mud use?
« Reply #6 on: March 18, 2013, 04:15:42 AM »
well.. I'm not sure how yours mud are operated. in all chinese muds,  there is only  admin and non-admin .   admin already have read-write access to all files.  (no one bother to lock it down, anyway) .

I think by simply having a busybox environment is already immense useful, I will give it a try right away.  we can worry about the details later.

Offline quixadhal

  • BFF
  • ***
  • Posts: 619
    • View Profile
    • A Waste of Time
Re: Is there a vim or equivalent for mud use?
« Reply #7 on: March 18, 2013, 05:28:34 AM »
I would guess chinese muds are in the vast minority, in this regard anyways.

MOST LpMUD's I've seen have several tiers of immortals, ranging from a simple builder who can only code things in their own workroom, to someone in charge of a single domain, to a full blown admin who effectively has shell access.

Sure, games run by 1 guy are common these days, but certainly not the best model to use for design decisions.

Take a look at the existing mudlibs.  It's a pretty common thing to promote someone to wizard, let them build stuff in their workroom and submit it for approval.  Once they get comfortable, and the admin team is comfortable with them, they get assigned to a domain to work on that material under supervision.  If they're good, they might then get their own domains to create and have others work under them.

It seems unlikely that a successful MUD would just have every builder get full access to everything.  That's just asking for mistakes to cause horrible damage, or for someone's hurt feelings to spell disaster when they nuke or corrupt everybody else's stuff.

EDIT:  That said, go ahead and see if you can make it work.  It'd be a very handy tool for admins in any case, and a proof of concept for a future direct editor for everyone else. :)

Offline wodan

  • BFF
  • ***
  • Posts: 434
  • Drink and code, you know you want to!
    • View Profile
Re: Is there a vim or equivalent for mud use?
« Reply #8 on: March 18, 2013, 10:20:33 AM »
You really want to edit files on your own computer for the best user experience, so web editors, mudclients with built in file transport and editors are probably the best way to go, the best option based on popularity (where it works, which seems to be getting less usual) editor with built in ftp support.

Offline quixadhal

  • BFF
  • ***
  • Posts: 619
    • View Profile
    • A Waste of Time
Re: Is there a vim or equivalent for mud use?
« Reply #9 on: March 18, 2013, 09:26:30 PM »
I would guess part of that is the lpc ftp daemon not really fully supporting active-mode ftp, which used to be a PITA before state-preserving NAT routers were common.  Also, I bet some ftp clients don't fully do PASV mode either.

It might not be a bad idea to do a little testing and see what ftp clients actually work well with what mudlibs.  I know I used to use ncftp, and would probably script vim to use wget or something.

In fact, maybe a small perl/python/ruby ftp client to do get/put would be worthy of inclusion, since users could hook that into their editors and know it works with the mudlib they got it from?

(How's that Discworld distribution coming? *grin*)

Offline FallenTree

  • BFF
  • ***
  • Posts: 476
    • View Profile
Re: Is there a vim or equivalent for mud use?
« Reply #10 on: March 19, 2013, 03:11:54 PM »
it's 21 centuries and we are still talking about FTP ?   being unsecured it is, you should at least uses SFTP for that.

Anyway, there are reasons remote editing is useful, you are not always in your quarter with all your software.

Offline quixadhal

  • BFF
  • ***
  • Posts: 619
    • View Profile
    • A Waste of Time
Re: Is there a vim or equivalent for mud use?
« Reply #11 on: March 19, 2013, 05:36:29 PM »
Implementing ftp in LPC is annoying enough...  You really want to push your eval tick limit by trying to do ssh/sftp?

And if you use an external agent (wu-ftpd was popular back then), it has to be taught how to authenticate against the MUD player system, and respect permissions from it (despite the chinese, who apparently run everything as root). :)

Wodan, do you happen to have a set of vim macros that are known to work with Discworld's ftp server?  I was going to try to write ones, but it occured to me that at least a couple of your devs must be non-emacs folk. :)

Offline FallenTree

  • BFF
  • ***
  • Posts: 476
    • View Profile
Re: Is there a vim or equivalent for mud use?
« Reply #12 on: March 19, 2013, 06:04:45 PM »
you mistook my words.  I am still talking about running something in external mode  and relying message directly to/from user to that external program.

I suddenly have a great idea of how permission problem can be solved : You never simply never edit file directly :

1) you call efun(file)  in lpc,  driver checks permission to read, if passed, copy it to a secure place like MUDLIB_ROOT/tmp/yourname/
2) launch the external program  that chrooted to that directory.
3) after external program exit(you save and exited the editor) .  driver check permission to write, and copy it back overwriting the file.

bonus point : driver also create a lock during your edit so others couldn't cause conflict.

Cheers.

Offline chaos

  • BFF
  • ***
  • Posts: 291
  • Job, school, social life, sleep. Pick 2.5.
    • View Profile
    • Lost Souls
Re: Is there a vim or equivalent for mud use?
« Reply #13 on: March 19, 2013, 06:55:04 PM »
Good God, people.  Screwdrivers for screws, not cheese graters.

Offline FallenTree

  • BFF
  • ***
  • Posts: 476
    • View Profile
Re: Is there a vim or equivalent for mud use?
« Reply #14 on: March 19, 2013, 06:57:49 PM »
Yes , I totally agree,that is why I brought this up.   there is absolutely no reason to reimplement mature software in LPC to use it. we should simply have a way to enable MUD interop with other stuff.

That's the correct way to go forward. I'm sure lots of interesting would happen if you can utilize existing service, library and stuff. (for example, want to grab something from web but have no http client library?) no problem, call wget !