RunLife in a multi-player real-time context

Dear community,-

I’m trying to solve one of the couple remaining problems I’ve got with a ruby mud server which relies on an adapted port of the Inform 6 parser, verb routine library, grammar, and English language definition modules.

Mostly, I think I have everything behaving well enough, except RunLife. I still can’t figure out how to deal with the return value of RunLife.

Every situation where RunLife is invoked in the Inform verb subroutines library – Tell, Kiss, Attack, Answer, Ask, Show, ThrowAt, etc. – seems to be incompatible with any sort of interruption, or return value of true from the RunLife function, in a multi-player context.

It seems to me, because of the nature of real-time programmatic events, that nearly every action that an individual actor takes must be de-coupled from any actions taken in response by a NPC. That is, every Life response case must be its own independent event, and the precipitating actions may not be halted, rolled back, or undone simply because a NPC’s reaction routine returns true, signifying that a NPC has a response coded and available. Once the actor takes an action, that’s it – it has been done, and it is up to the rest of the world to determine how to respond.

So instead of

>show coin to thief The thief swipes the coin from your hand. One would have

[code]

show coin to thief
You show the coin to the thief.

The thief swipes the coin from your hand.

[/code]Does anyone have any thoughts on this? So far I am considering doing away with all routine terminations from RunLife, and have RunLife register a callback to execute on the completion of the actor’s action.

A hard problem, obviously. If you set up callbacks between actions, you’re bringing in the possibility of infinite loops, deadlocks, all that fun stuff.

The I6 library’s model is very loose about “when an action is actually complete”. Code could change the game state in any stage of the action, and the difference between “decided not do that” and “tried but failed” is entirely up to the game author. (I7 tries to systematize this, but I think it only partially succeeds.)

Plus, it has plenty of nested actions in other contexts than RunLife. (Implicit take, actions that proxy to other actions, etc.)

So, if you want to go with this independent-actions-of-independent-actors model, you’re going to wind up drilling out a lot of the I6 library and rethinking it.

Alternatively, take the lazy way out and leave the nesting the way it is. As long as you don’t insert time delays (e.g. in the thief’s response), there’s no real-time problem.

I’ve coded a bit of heritage checking into the event system to mitigate feedback cycles. It isn’t perfect, but it’ll help.

This is very interesting to learn. Of course I would like to incorporate I7 into the system eventually, but it’s pretty far along on the roadmap.

The implicit takes seem to work pretty well so far, and don’t seem to have much impact on event boundaries, yet. So far I’ve also been able to wrap proxied actions inside of new events with apparent success, so that seems to be a world designer concern, though a very important one.

That’s what I’m afraid of, and why I came here for consultation. :slight_smile: I guess I’ll just experiment in a branch and see what happens.

Unfortunately, this is exactly how I realized this was something I needed to deal with. :slight_smile: Thank you very much for your insights, zarf. You’re always extremely helpful.