General feedback on room scripting

I think I relayed this to @Accipiter in one way or another but it’s in here just so I have my thoughts noted in a single place.

Overall it works. great!

Debugging scripts is painful, though. Here are the things that stand out a lot.

Uploading a new script requires lots of typing, or going up the history and replacing a sizeable chunk of text. It’s just not fun especially when you upload them a lot while iterating. You could have a bot for that, but having a simple http post would be so much better. of course, that requires figuring the auth for it all too.

No way to debug script steps. With only a desc available to the script you end up wishing for some log() option. It is doable my making a log script and posting things to it, but that creates more boilerplate. In fact, 3/4 of my test scripts are supporting boilerplate now, which creates one more issue.

As I discussed it with @Accipiter, his point for script source is for mods to be able to do the safety code review. With what I’ve seen so far I could argue that any reasonably complex script would contain enough boilerplate for it to be hardly readable, especially given that it’s generally better to minify it to improve on the submission process. With no facility to include extra files, this boilerplate ends up copied over and over.

I know this is going to get better over time but i think making the scripting UX is very important. Few people will bother running their assemblyscript code through a c preprocessor because that’s the only way to include common things into a build

1 Like

Thanks for the feedback!

As both you and @Kelmi argue, it is quite easy to obfuscate. And being able to review code shouldn’t really be a required skill for moderation.

So, I will backtrack on this one. Scripts shouldn’t require to be “readable”.
It is better and easier to moderate the effects of a script, such as it sending rude or hateful describes, or trying to prevent normal gameplay.

When I mentioned the ‘reviewable’ argument was when asked if I could allow upload of precompiled .wasm-files. But allowing pre-compilation (as opposed to the current server-compiled solution) has other cons as well, especially when it comes to the control of what debug information is included in the wasm-file.

One main thing that I would wish to do, is using source maps to provide improved stack-traces. With pre-compiled wasm-files, this would not be possible unless you also upload those source-maps files.

Yes. We should have logging.
We currently have error logs. If we expand that log to allow different levels, info, debug, trace, error, then that could cover it, right? Maybe we could use the console namespace to keep it familiar?

Yes, we need a way to allow import of custom modules for boiler-plate code and class definitions. I yet have not come up with a good way to structure it, though. Should custom modules be stored on player level? Should the whole realm have some sort of global package management, where anyone can add custom modules?
I still need to figure this out.

Yes. This was the first version, focusing on just getting the script engine out there. Hardly NO focus on UX (except the Mucklet Script dev environment).

I still think the easiest, and most valuable approach, is to improve the Mucklet Script dev environment, rather than focusing on in-client scripting UX.

I could try to provide the API calls to allow us to extend the dev environment so that we can:

  1. have multiple roomscripts structure in the same repository
  2. allow roomscript deployment:
    npm run publish // Uploads all changes to Wolfery using username/password credentials, 
    
  3. listen to roomscript logs:
    npm run logs --follow // Listen and display new log entries for any script in this repository
    npm run logs --tail=10 --script=XXXX // Display the 10 last log entries for a specific script
    

But I think the client also needs some rudimentary UX script editor still.

Arguably, if I upload a compiled wasm I know what I’m doing and I don’t need handholding. That said, I see no issue with uploading the source map alongside the pre-built wasm if the script owner wants to have all the details.

We currently have error logs. If we expand that log to allow different levels, info , debug , trace , error , then that could cover it, right?

We don’t need all of that, we only need a facility to bubble up the messages to the script owner. A ring buffer of the last X messages that you can see is good (as long as I’m not forced to see all the source along with it over and over lol), roomscript log follow/unfollow to make logging interactive and message the owner immediately is even better. The specific naming and levels should not be part of the spec, IMO. I’d point you at some well-designed wasm interfaces again for the reference, but you have all the links :slight_smile:

Yes, we need a way to allow import of custom modules for boiler-plate code and class definitions.

This is going to be tricky. You’re effectively making an npm of wolfery with all the same issues that plague it. While I won’t say this is a wrong approach, I will say that it’s a monumental effort and you shouldn’t spend your time on it yet, because local-first tooling going to win anyway, because

I still think the easiest, and most valuable approach, is to improve the Mucklet Script dev environment, rather than focusing on in-client scripting UX.

Is pretty much correct. You can make a nice scripting environment inside wolfery, and ultimately it is a reasonable goal as it lowers the barrier for people to script things. At the same time, you are effectively building a mini-ide and a web-based compiler and package manager. It’s a lot of things for little gain. Instead, focus on the APIs. If you have a well-defined API to upload a script and tail the logs you can use it in a cli tool and in you potential future web editor.

I’ve seen the examples of both in the wild, especially around the crypto where people have to make good UX to keep on the hype. Given the current complexity of writing the room scripts I’d say the most important bit is to reduce friction. Here’s how you can reduce friction:

  • npm run publish is 10/10 problem solver because you don’t have to deal with the wolfery commands to reupload the code and it allows you to stay in your emacseditor of choice
  • npm run logs --follow allows you to keep on what’s happening with the script without having to fiddle between the char interaction and reading debug logs in the same browser tab

at that point, npm run publish-wasm that uploads the binary straight on will make things faster (because I already compiled the code locally anyway) and has all the benefits of pulling in external deps and doing the code splitting as you wish. It also allows you to write scripts in rust and that’s what we all here are after.

To sum it up: focus on the interfaces. You can figure the management APIs for cli and that tells you how to interact with them via an editor (even if that’s a standalone apieditor.wolfery.com). Let the developers write crazy things and come to you and tell you where your internal API is lacking and then you’ll know which internal bits to fix next.

And the wasm advice is still: think of your APIs as if you were writing them in C. If they are well-defined on the low level it’s easy to make bindings to the high level language, AS or whatever. You can automate most of that too. But if you think too high level then your API might be non-obvious (remember the chat where you explained me that init is called once in the script activation, not runtime? it’s confusing because that’s generally not how wasm modules are structured). I pointed you at proxy-wasm before, here’s the zellij plugin api which is also nice to work with. See how it’s structured. Events, commands and pipes are all similar to what you’re trying to do in here.

True, true.
Should probably try some way of open a webpage to the login page, and then store the access token to use as credentials. Mmm… Not sure how to do that. But it should probably be a much safer way.

My biggest issue with room scripts is their lack of ability to create any private message.
Having something that can work “desc” is nice, but most muds I’ve ever been on allow scripts roughly the same actions any “user” level entity could access.
Writing and debugging the scripts really doesn’t feel hard. But storing variables and thinking about how one should do such is annoying as marshaling things in and out of the script’s properties for memory is tedious the first time.

I like how the scripting work, though the help inside the client could be better. While the info on github is more than enough, (And lets be honest, the client source code is really easy to read to.) It’d probably be nice if help roomscript was a bit more verbose.
It’s probably a lot for folks who having been coding for years. Assembly script is a bit weird when it comes to languages.

1 Like

Thanks for the feedback!

Yes. We need a private sort of “describe”, don’t we? Yes. Yes we do.

It would then behave similarly to a whisper - only able to target characters in the same room.
I can imaging the styling being a mix between describe and whisper, with a label telling who received it.

What should be call it? privateDescribe?
What should the label say? For whispers, we have:

Whisper to Accipiter Nisus

But what about private describes?
I think, in the room script, it would be:

Room.privateDescribe("Only you can see this.", [ char.id ]);

Room scripting is still in its very early stages.
The first version out now is mainly just to test if AssemblyScript/WASM is even a plausible solution. Also to try out if the decentralization of scripts and the way they communicate by posts works.

Many improvements is expected to come.
Maybe not in next release (I focus on a few other things there), but the release after that should see scripting improvements!

1 Like

For this purpose, I plan to have “character scripts”. It would be similar to “bot scripts”, but would rather be written with AssemblyScript and running on the server.

So, instead of having the room impersonate a character, you’d have a separate script controlling the character, who can listen to post messages from the room script, if needed.

Though, I plan to allow current bot-script to send/receive posts from room scripts too.

Character scripts would definitely solve that whole issue. That sounds rather perfect. I’ll be looking forward to such!

Private describe would allow for the creation of a board game like object in the room.
I’d wanted to make such, but found with only having access to a describe one is rather limited to total information games. (As there is really no way to let someone know what their hand is in say poker or something.) A private desc would be wonderful.

That would be nice!
And I can totally see how scripts, later on, can also generate .png images that can be used as room pictures (for now) or object pictures (when we have objects… like a chess board).

But server-side scripting is still in its infancy.
And right now - room scripting is broken!
I am working on tracking down the bug.

This is worthless to the majority of supporters who have no coding experience.

Right now, it surely is not useful even for coders! But it is just the start.

I can share one thought that I have, that is part of how I imagine non-coders and non-supporters to benefit too. (It is an extract from a DM I wrote to @Kookierhondje)

One thought that I’ve been playing with in my head together with the idea of in-game items (objects that has names/description/image that can be passed over to others) is that:

what if supporters could “imbue” items with a room script, which they can give to someone else to use, and it could be added to some “room slot” (like gems that are added to weapon slots in other games). So, instead of having to be a coder to create a door lock, you could have a friendly supporter create an item for you which you could put in a “room slot” to get the functionality.

It is a very unfinished thought that probably needs a lot of consideration, especially on the security part. But I kind of enjoy the thought.

Coders may code stuff for others (including non-supporters) to use.

1 Like

I tried this, receiving a room from a supporter interested in the Academy build with a test script (my goal: to add noises, which I used to great effect on a SpinDizzy build of the Creatures world).

The script worked. However, it is not possible to list or remove scripts as the room owner; only supporters have the command bundle. (Of course, I imagine a builder could do this too.)

You also don’t know exactly what the script does, whereas by comparison on a MUCK the code is available (if you can read MUF or MPI); it’s just access to submit such code to a shared (realm) repository is restricted - usually on a technical capability and trust basis.

Incidentally, this wouldn’t need full listen capabilities, just knowing that a character spoke, which would be a more palatable variant of listen if we don’t know the code. (You can do it without even that but then it just spews noises without activity which is usually not desired.)

Yes, that is true. I have a choice to either:

  1. simply disable scripts when the owner of the room is someone without supporter perks,
  2. or I’ll allow supporters to “gift” scripts, but enable someone who is not a supporter to still be able to activate/deactive/delete/rename/view room scripts, but not create/edit.

And between these two, I like 2. the most.
So, that one is what I think I’ll go with. Especially if I were to do the “room script object slots” thingy.

And as for malicious scripts, listening in to rooms - I still think this issue will be resolved once scripts can register custom commands. In such case, they don’t need to listen, but you can still trigger them with commands such as:

turn on radio

… as oppose to having the script listen for:

pose turns on the radio.

1 Like

I agree that 2 is nicest, and it would likely further the use of such scripts. One alternative or addition that I thought of would be for it to be something builders are authorised to do for ‘public’ building (perhaps the same for transparent exits and/or instance rooms, as they offer a common benefit). Of course that could introduce some friction into the process, and while it maybe provides a benefit for the realm, it doesn’t offer a material return for the tinkerer. :smirk_cat:

This’d certainly help e.g. the fluff dispenser planned for the cloakroom; I was suggesting it more for the ‘noises’ case which is in the (unusual?) situation of having to listen for activity, just not the details of it (assuaging some concerns). (Though from an IC perspective, perhaps it’s not surprising if school is monitored…)

In that case, being able to set data per-room while sharing a script between rooms (attached to an area) would also make sense, as specific noises and their delay/chance are likely to differ between rooms, but the script doesn’t need to. The alternative being to have configuration embedded with the script, which seems inefficient and unwieldy to maintain (if you have 25 rooms, an update means 25 uploads? 25 server VMs?). I saw you have area and realm scripts on the roadmap, just something to consider for them.

I’d still love the option to gift people supporter. Either one time or recurring. Just ways to contribute to wolfery even more. :slight_smile:

5 Likes