I’m trying to make a multiplayer interactive fiction game. I’m using fyrevm as a Glulx interpreter, which has support for multiple different text channels so that gives me quite a bit of support for receiving different types of information from the glulx game. I’ve built a front end which can take inputs from two different players, but there are two big problems I need to solve.
Switching the perspective between different players.
I’ve written an action that allows me to change characters in the game, however it only works if the other character is visible. Maybe there’s a simple way to fix that?
zzBecoming is an action applying to one thing. Understand "zzbecome [something]" as zzBecoming.
Carry out zzBecoming:
if the noun is not a person:
say "You can't become something inanimate.";
otherwise if the noun is the player:
say "You're already yourself.";
otherwise:
say "You become [the noun].";
now the player is the noun;
try looking.
Updates from other players.
If two players are in the same room, and player 1 takes an action, player 2 should be prompted with the action that player 1 took. For example, if player 1 types “take the apple” player 2 should see something like “David took the apple.” This is the approach I’ve started with for this:
A person has a text called the current activity. The current activity is usually "standing about".
After taking a thing (called the item):
now the current activity of the player is "taking [the item]".
Every turn:
repeat with obj running through people:
if obj is visible and obj is not the player:
say "[obj] is [current activity of obj]."
It seems like I’m going to have to write an after rule for every possible action, which seems like a lot. Is there a way to trim down the amount of work that takes, something like "After performing an action: now the current activity of the player is “[action-ing] [the item]”? And can someone point me towards a list of all possible actions so I can make sure I do them all correctly? Or any thoughts about how to do this better?
To make a command that doesn’t require visibility, make it apply to “one visible thing” (yes this is truly horrible terminology but we’re stuck with it—“one thing” means “one touchable thing” and “one visible thing” means “one thing that doesn’t need to be touched”) and put [any thing] in the Understand line.
For your reporting, you can have other people carry out actions, and the standard library has ways of reporting on those already built in.
How do I trigger the reporting? The approach I’m using now is person A enters a command, then I issue “become personb” to switch so that the second player can make an input. Then I need to trigger the reporting here so that what person A just did is narrated from the perspective of person B.
This is fascinating. I’ve been thinking of ways to do this, too. I wrote a two-player Inform game that will be in the upcoming ParserComp, and I did it with 2 separate games that “talk” to each other using codes that are relayed between players. It’s just a little proof-of-concept to see if anyone likes this kind of thing. I can see a LOT of potential for the way you’re doing this, and I can’t wait to see the finished product.
Yeah I thought about doing it with two separate game engines too, but it seems like it might too easy to have some bug where the states of the two worlds drift away from each other.
I have not seen Guncho before, that’s really cool. I’ve been digging through the source code a bit, it looks like they use an older version of FyreVM (TextFyreVM) but it looks like a real pita to get it to run. The website is a ghost town too. I’ll keep digging thru the source code but if there’s anyone around who has some knowledge on how the multiplayer aspect of it works, please let me know.
So the problem is that by the time you switch, the Report rules have already run so person B never sees anything.
You could switch earlier (in an After rule, for example), but then person A wouldn’t get anything instead. The problem is that a report rule will either be run for the actor doing it, or for the person witnessing the actor, but not both.
I wonder if you can switch and then re-run the report rulebook with the same action, but I don’t know how, or even if you can untangle the action rules and re-play a stage.
This little snippet illustrates what’s going on - any actions will be reported as being done by the other person, because I switch in an After rule. It’s actually quite interesting to see things like examine Tim from the outside!
"Untitled"
Laboratory is a room.
Ben is a man. Ben is in the laboratory.
Tim is a man. Tim is in the laboratory.
The player is Tim.
After doing something:
If the player is Tim:
Now the player is Ben;
otherwise:
Now the player is Tim;
Continue the action.
Interesting. The VM I’m using has a feature for sending text in different channels to the app, if I could update the reporting rules to output both sets of text at the same time to different channels, I could use that in the app to display the correct thing for the correct person.
That would do it. You want to have both the report and report someone rules to fire and send the output appropriately. There must be a way to do that, but it may require more I6 knowledge than I have.
I’m willing to dig into I6 if I have to. But first I’m going to try modifying the report stage rule. The standard rules say when the rulebooks get followed so I bet I could modify this:
A specific action-processing rule (this is the report stage rule):
if within the player's sight is true and action keeping silent is false,
follow the specific report rulebook;
to be something like this:
A specific action-processing rule (this is the report stage rule):
if within the player's sight is true and action keeping silent is false,
follow the specific report rulebook;
now the player is the observer;
select a different fyre channel;
follow the specific report rulebook;
now the player is yourself;
Really nice, that works perfectly in my little toy game (https://7hbghpq9.play.borogove.io/). I unlisted the original report stage rule to avoid getting some output twice, like:
>jump
You jump on the spot.
You jump on the spot.
Now as iBen:
Tim jumps on the spot.
Laboratory is a room.
Ben is a man. Ben is in the laboratory.
Tim is a man. Tim is in the laboratory.
The player is Tim.
To swap players:
If the player is Tim:
Now the player is Ben;
otherwise:
Now the player is Tim;
Continue the action.
The report stage rule is not listed in any rulebook.
A specific action-processing rule (this is the new report stage rule):
if within the player's sight is true and action keeping silent is false,
follow the specific report rulebook;
swap players;
[select a different fyre channel;]
say "Now as iBen:";
follow the specific report rulebook;
swap players;