Room Based choice-based Game Engine

One thing I noticed about choiced-based games is that they don’t have the ability to -Link- Back to a previous room or another map, or to update their description when an object is picked up the way something like Tads 3 or Inform can. At least not that I know of from brief brushes with them.

Something I want to do is create a large open world, where you can move back and forth between rooms similar to Tads 3 but via links (so only what you want to show, shows), and in each room is a character who remains there during the duration of the scene. But where the only way you interact within that world is via Menu Options. Where only items that are important to moving the story are listed, and to which you can interact with characters who pass by in the story using a similar option Menu.

So basically “Scenario/Scene” based, with the option to move from one room to another.

Example:

[code]You’re in a dusty old room, a robot sits on a desk, you want to talk to it.

  1. Talk to Robot
  2. Open Desk
  3. Leave Room

2
You open the Desk and see an array of items.

  1. Take Item.
  2. Examine Item (etc)
  3. Close Desk

3
You close Desk and are back in the room.

  1. Talk to Robot
  2. Open Desk
  3. Leave Room

3
You leave the room and go East. You are in a waiting room, one door leads outside. A woman stands here.

  1. Talk to Woman
  2. Go outside.
  3. Go back to room

3
You try to go back to the room, but the woman stops you.
“Where are you going, everyone is waiting for you outside.”

  1. “Etc.”
  2. “Etc.”
  3. “Etc.”
    [/code]

I’m not even sure if the game I’d want to create would require creating objects or not, or just scenarios within the story. And if creating and using objects might give me more control, like “If this was done, change description of X to…”

What I do know is that traditional IF uses commands. But that Choice-Based games have an ease in navigation while at the same time are limited to “Scenario-only” and are more like choose your own adventures.

To use such a game engine, the only way to go back to the room would be to write another scenario/room after it was written, creating multiple versions of the same room every time the player was allowed to go back, rather than simply link back to the room and show how it was changed.

To get any of the Game Engines: Tads 3, Twine, etc. to do what I’d wanted it to do I’d have to work-around the original audience it was designed for. With my goal being to take what I like from Tads 3 & Commercial RPG games + Choice of games, and merge them. For example, IF has the option of creating large open worlds, and NPCs and choices like the games I love. However Choice of Games makes it easier to navigate without defining actions and having a lot of programming skills, and removing the need to ‘type’ words out, instead you just dial or type in a single # to show your action.

The reason why I’ve been looking at choice based games is because I can’t both write and focus on hard-core programming and have decided that I want a game engine that doesn’t need me to program a lot, like Twine. Vs. Tads 3 in which the problem I’ve come up with is having to wear a programmer’s hat. Using choices limit the need to create individual objects, while at the same time make it more accessible to an audience I’d like to target. And yet the options available to me restrict what I can do.

What would someone recommend that I do?
-Do they know how to convert or modify Tads 3’s system into a more Menu like system.
-How to take Undum or Twine and use it like Tads 3 with it’s rooms, but menu-choices?
-Would I have to suck it up and create my own engine using something like C# or Javascript?
-Or could I get away with modifying even lightly an existing one?

Do you mean that Twine can’t return to previous rooms or dynamically update object/room descriptions? Because I’m pretty sure I have played Twine games that were able to do this. Eidolon was Twine, wasn’t it? The beginning of it was in a house you could explore pretty freely, IIRC. WTWLA also had returning to previous rooms and updating descriptions.

You can absolutely loop back with Twine - just use the Twine nodes like a room map. See Candlesmoke or Xenobabysitter.

It’s a little complicated creating a “world model” in Twine with objects that can be picked up, an inventory display, and so on, but it’s not impossible.

I don’t mean you can’t loop back, Twine is made up with links, so I imagine you can just put a link back to the place you were in, my problem is in part it’s point and click system and lack of inventory etc. Also most of the Twine I’ve read including what was suggested is very much book like, makes me feel like I’m reading, vs. Regular interactive fiction which makes me feel like I’m reading only what I have to (I’m weird, don’t want to read a book but fine with reading a room description). I know I can fix that in Twine easy, but this means I don’t read a -lot- of Twine perse.

Where you can’t type in >1. and go from there. My other problem is like what Sequitur mentioned wanting to have a world model and not knowing how to do that within the confines of Twine (i.e not knowing how to tamper with the engine).

Is there any recommendation on how to do this with Twine?

To navigate I want to use numbers and have the option to input those options. And to remove the highlight and [highlight] feature, if I did use Twine.

Alternatively I’m still open to other systems such as with TADS 3, Undum, etc!

Quest has a world model, and supports links - you can remove the command bar entirely.

In Twine, the way to do it would probably be to use Sugarcube (Or anything in Twine 1) so you can write custom macros, then write a fairly elaborate custom macro to write a paragraph about the contents of a room. This macro would pull macros for writing a paragraph about each item in the room (With links to pick up, examine, and so on). You’d need to customise the template to add an inventory bar. Then add the “room content” macro to every passage that is a room.

Alternatively you could have the room contents be a passage and include that passage, but since you’d need to figure out what’s in the current room, I woudln’t recommend it; it might work if your game has a limited number of objects, such that the room contents passage can contain the descriptions of all of them along with an if statement to check if they’re in the present room (With each object in the game being an actual JavaScript object in the game state that points to a passage by one of its properties).

Thanks for the explanation about how to use Twine to do that Sequitur. It sounds a bit complex for me in relation to what you said earlier, “Complicated, but not impossible.”

Quest sounds perfect, I just looked into example games and I like it a lot. My only question is where Quest games can be hosted? I’m going to explore how to remove some features on my own but from what I’ve seen it’s amazing.

And I hear it’s a great way to learn programming as well so I can get comfortable working with something like that a little bit too for some of the things I need, created and prototyped quick. Heck I can even prototype a game and decide to code it later. It looks easy and simple, so I will try this.

Can Quest be hosted on a regular website, and played offline, or does it always require an internet connection?

You can play games offline with the downloadable version of Quest. For hosting on a website, the simplest thing would be to upload to textadventures.co.uk and use an IFRAME.

Alternatively you can convert the game to JavaScript using github.com/textadventures/quest-js - then you can host the result anywhere, and it will work offline in a browser. It’s a little rough and sometimes it fails to convert things, but if that happens let me know and I’ll fix it.

I recommend having a look at Tiny Text Adventure. Have not seen much posted about it here since the author announced it a few years ago. I backed the sequel on kickstarter. It isn’t really an engine, but it is open source, so you should be able to rip out the original content and replace with your own.

It is a choice-based game, but based on a (simple) world model. You can use items from your inventory or pick from a list of location-specific actions, sometimes depending on the state of the world:

github.com/julianchurchill/text-adventure

Some example data (SPOILERS):
github.com/julianchurchill/text … _clock.txt

Not sure if he edits it in that form or if it is generated? Anyway it looks action-based rather than object-based, so he enumerates all the possible things that can be done and what the effects are (including “from location X you can exit to location Y” for movement. I think. Was a while since I looked closer at the code.

EDIT: Actually on a closer look I am not so sure if that is the game data or some kind of walkthrough or test-case. Not easy to tell. There are some other text-files around there that might be world-models as well. :blush:

EDIT2: This is the actual world model file describing all the locations and items and interactions with NPCs etc:
github.com/julianchurchill/text … ontent.txt

I saw on his github he also has a project for implementing his text-adventure enging in js, so it might work on non-Android platforms as well now or in the future.

For something more oldschool the Fabled Lands gamebooks is exactly that: open world rpg as a gamebook, on paper. It works very well. You could have a look at the desktop version FLApp. Actually FLApp is also open source, so it could be used to make new games. Each location is an xml file that describes what can happen at that location and what items you find etc. It isn’t quite as much of a world model as TTA has though, it is more about hardcoded text, but there is inventory management and (usually) free movement around a world between location-nodes rather than navigating a story between story-nodes.

flapp.sourceforge.net/

You could also look at the engine I used for porting Clod’s Quest.

textadventures.co.uk/games/view/ … of-zivulda

It does require coding Javascript directly.

If I’m understanding what you’re asking for correctly…with functions in Twine I think you can get a pretty close replication to what you need, without needing to create any custom macros. “visited(string, string…)” lets you, in your example, treat the passages within Twine act more or less as "rooms.’ You can also use “visitedTag” that could roughly parallel the use of “regions” in Inform. (So, e.g., tagging multiple passages as “swamp”). You can also track the number of turns a player has taken with “turns()”

People have done a lot of cool things with inventories–I’d check out Hallowmoor, although that’s very customized. I haven’t worked too much in Sugarcube but that might be worth checking out as well as it has a lot more built in functions. Finally, this post on Javascript arrays might be helpful. The nice thing about Twine is that you USUALLY don’t have to reinvent the wheel. Anyway, hope this helps.

glorioustrainwrecks.com/node/5034

I’m super late to the party, but here’s how to do inventories in Twine 1.x (or Twine 2.x with the Sugarcube story format: strugglingwithtwine.blogspot.ca/ … ntory.html

(If you’re using another story format in Twine 1.x, you have to replace every instance of ‘state.active.variables’ in the the below code with ‘state.history[0].variables’. If you’re using another story format in Twine 2.x… then none of the following is likely to be helpful at all. That said, Sugarcube is my personal favourite.)

And so, here’s some annotated JavaScript code that will work out-of-the-box if you put it in your “Edit Story JavaScript” in Twine 2.x when using Sugarcube, or a script passage when using Sugarcube in Twine 1.x:

[code]// Begin Inventory Macros
// Originally posted by F2Andy at http://strugglingwithtwine.blogspot.ca/2014/03/handling-inventory.html
//
// Instructions:
//
// 1. In a passage, check if there’s an item in the inventory…
// …if not, give the user the option to link to a passage that adds it to inventory:
// <<if $inventory.indexOf(“An Unsigned Note”) == -1>>There is a note here. [[Pick up the note.]]<>
//
// 2. In a passage, check if there’s an item in the inventory…
// …if so, give the user a choice to progress to a new passage:
// <<if $inventory.indexOf(“The Golden Key”) == -1>>[[Unlock the door.]]<>
//
// 3. To add an “Inventory” link in your sidebar menu, create a passage named “StoryMenu” and in it, create a link to your inventory’s passage: [[Inventory]] or [[Backpack]], say.
// Create a passage named “Inventory”, and in it, write something like the following:
// <<if $inventory.length == 0>>You are not carrying anything.<>You are carrying:
// <> <>
// <>

// A helper function for the following macros.
window.getInv = function() {
return state.active.variables.inventory;
}

// Starts your inventory. You need to call this once at the start of your game in order to make the inventory work.
// Usage: Place <> in your StoryInit passage. Don’t have a StoryInit passage? Make one.
macros.initInv = {
handler: function(place, macroName, params, parser) {
state.active.variables.inventory = [];
}
};

// Add an item to your inventory:
// Usage: <> or <<addToInv “a smooth rock”>>
macros.addToInv = {
handler: function(place, macroName, params, parser) {
if (params.length == 0) {
throwError(place, “<<” + macroName + “>>: no parameters given”);
return;
}
if (state.active.variables.inventory.indexOf(params[0]) == -1) {
state.active.variables.inventory.push(params[0]);
}
}
};

// Removes an item from your inventory
// Usage: <> or <<removeFromInv “a smooth rock”>>
macros.removeFromInv = {
handler: function(place, macroName, params, parser) {
if (params.length == 0) {
throwError(place, “<<” + macroName + “>>: no parameters given”);
return;
}
var index = state.active.variables.inventory.indexOf(params[0]);
if (index != -1) {
state.active.variables.inventory.splice(index, 1);
}
}
};

// Display the inventory as a list: Rock, Paper, Scissors
// This can go in any passage, but the best spot would be your [[Inventory]] passage.
// Usage: <>
macros.inv = {
handler: function(place, macroName, params, parser) {
if (state.active.variables.inventory.length == 0) {
new Wikifier(place, ‘nothing’);
} else {
new Wikifier(place, state.active.variables.inventory.join(’,’));
}
}
};

// Display the inventory as a series of links to passages with the same names.
// This can go in any passage, but the best spot would be your [[Inventory]] passage.
// Usage: <>
// If those passages don’t exist, the links will be broken.
// There is a line break after every item in the inventory.
macros.invWithLinks = {
handler: function(place, macroName, params, parser) {
if (state.active.variables.inventory.length == 0) {
new Wikifier(place, ‘nothing’);
} else {
new Wikifier(place, ‘[[’ + state.active.variables.inventory.join(’]]
[[’) + ‘]]’);
}
}
};

// Empty the inventory entirely.
// Note: This is not like “dropping” an object; they are not added to the current room/passage. It just erases them all entirely.
// Usage: <>
macros.emptyInv = {
handler: function(place, macroName, params, parser) {
state.active.variables.inventory = []
}
};
// End Inventory Macros[/code]