Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Text Based Adventure Game Question
Started by carnivoreboar Dec 31 2018 05:56 PM

20 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

carnivoreboar

[GLOBAL: userInfoPane.html]
carnivoreboar
  • Observer

  • 2 posts
  • Corona SDK

Hello,

 

I'm a complete newbie here, but am interested in building a text based adventure game like "Lifeline" or "I am Innocent". Is this possible using Corona? Is there a tutorial for building something similar? Are there similar games built with Corona already that I could see?

 

I apologize in advance if this has been asked already, I tried searching the forums but had trouble finding answers. 

Thanks!



[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,463 posts
  • Corona SDK

1. Yes.  It is absolutely possible.  I have one in progress.

 

2. Is there a tutorial?  No.  

 

There is not a lot to making this kind of game.  That is, it is not a technical challenge.  The big difficulty is in making it easy to edit the story content and to test it.   This is especially true if there is significant branching.


  • carnivoreboar likes this

[TOPIC: post.html]
#3

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,463 posts
  • Corona SDK

Here is a video of my story engine (made with Corona).

 

In the video I show the 'chat story' test which is actually a copy of the story 'The Game' from Hooked.

 

The second half of the video is a branching test with variables and flags to enable 'options' as the story progresses.

 

 


  • Michael Flad, StarCrunch and carnivoreboar like this

[TOPIC: post.html]
#4

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 428 posts
  • Corona SDK

I've also thought about creating text-based games from time to time, but my plans haven't yet made it to full production. I believe that there is a niche market for these kind of games and a good text-based game would find its audience.

As usual, that's some neat looking engine, Ed! My approach to creating a game like this on Corona was probably similar to @roaminggamer's. I built the entire game around what I call "story blocks". These story blocks were all located under a table in a separate file that the engine loaded. I added a snippet of the story block code below.
 

local story = {

	[1] = {
		txt = {
			{"narrator", "The lock breaks as you slam the door behind you."},
			{"narrator", "You are in a room with a staircase leading down and rusted iron door in the far right corner."},
		},
		to = {
			{"Go down the stairs",2},
			{"Try to open the rusted door",24},
			{"wait in the room",101},
		},
	},

	[2] = {
		txt = {
			{"narrator", "As you make your way down the stairs, you hear banging at the door you just slam shut."},
			{"narrator", "You've made it all the way down, but it is too dark to see anything."},
		},
		to = {
			{"Try to search for a light switch",3},
			{"Hide in the darkness",7},
		},
	},

	-- ... etc.

}

The way that I made it to work was for the engine to load a specific story block, e.g. block #1. Then, it would look at the txt table. It would create a text display object for each entry in the txt table. Each entry contained the text type, which was used to format the text, and then there was the text string itself. This made it easy to give different characters different styled dialogue and to make them distinct from the narrator, etc.

Then, the to table included the options that the player could select. First, there was the string that the player would be shown and secondly there was the story block's number that the player would be taken to.

In my current (frozen) version, there are also systems for inventory, character stats, and party management. It's really as roaminggamer said, the difficulty lies in making it easy to test and edit. In my version without those fancy management systems, it was easy to just tell the engine to jump to a specific story block, because I knew that the player couldn't have made it there another way. With the more complex management systems, I had to create a switchboard to toggle certain options on and off, etc.
 


  • carnivoreboar and roaminggamer like this

[TOPIC: post.html]
#5

schroederapps

[GLOBAL: userInfoPane.html]
schroederapps
  • Contributor

  • 451 posts
  • Corona SDK

I’ve also started (and stalled) my own text-based adventure game. In my case, it was a visualized adaptation of a Twine game. Though I didn’t have time to do it, coming up with a way to take a Twine file or export (perhaps with a limited set of supported features) might be a great way to go if you could make it work. That way the editing could leverage Twine’s more mature environment, but the building of the mobile app could be handled in Corona - and you could make custom flourishes that really make it pop. Wouldn’t need to be Twine specifically either. If there is an interactive fiction platform that exports to JSON, that would be half the battle right there. There have to be other I.F. products besides Twine, right?

[TOPIC: post.html]
#6

schroederapps

[GLOBAL: userInfoPane.html]
schroederapps
  • Contributor

  • 451 posts
  • Corona SDK

With everybody talking about Bandersnatch, now’s a good time to get out I.F. games - strike while the iron is hot and all that. 😀

[TOPIC: post.html]
#7

StarCrunch

[GLOBAL: userInfoPane.html]
StarCrunch
  • Contributor

  • 779 posts
  • Corona SDK

There have to be other I.F. products besides Twine, right?

There's Yarn, too.  :) (yarn-test seems to use JSON, but looks like more than an afternoon's port.)

 

I posted erogodic in a thread some time back, though it was just something I had recently seen at the time.

 

For the more ambitious, zarf and curiousdannii both have all kinds of heavy-duty IF fare. Doing anything with that might be a bit much, but I'd recommend following some of their links. (Also Emily Short and others whose names escape me.) I got rabbit-holed into this material a few years back during some totally unrelated research.  :D (Twine- and Yarn-style GUIs are actually a small part of the results, though altogether it's something more akin to Unreal's Blueprints. I've actually been trying to revamp this into something presentable--and more importantly, reusable--lately.)


  • schroederapps and carnivoreboar like this

[TOPIC: post.html]
#8

schroederapps

[GLOBAL: userInfoPane.html]
schroederapps
  • Contributor

  • 451 posts
  • Corona SDK

Holy cow @starcrunch - Yarn is exactly the sort of thing I was thinking of. It has a nice "export to JSON" functionality, and looks like it can ingest Twee files from Twine - so if you prefer to use Twine to actually compose your game flows, you can just use Yarn as a sort of middleman JSON exporter. I can see how I can build a nice little parser to interpret the exported JSON in a Corona app - but I suspect that it would be difficult to make a "one size fits all" module for this, as I imagine that we'd all want to handle branching paths in our own way. But your link may have rejuvenated my stalled project, as I think using Yarn as an interpreter may really speed up some of the tediousness that made me push it aside a few months ago. :)

 

And what a pedigree on that one! "Night in the Woods" (near the top of my backlog) and "Knights and Bikes" (something I'm very much looking forward to)! 



[TOPIC: post.html]
#9

StarCrunch

[GLOBAL: userInfoPane.html]
StarCrunch
  • Contributor

  • 779 posts
  • Corona SDK

@schroederapps Awesome, glad to hear it. I looked at it once before and got scared off, but do think it would bring a lot to the table. Obviously from what Ed and XeduR have already posted there's more than "one size", but maybe they have some thoughts on the way to go?

 

I wonder if @ponywolf didn't have an approach as well. Something's niggling in my mind, maybe from the space RPG?



[TOPIC: post.html]
#10

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 428 posts
  • Corona SDK

Yarn looks really enticing, but it is only a dialogue editor. In terms of dialogue, it pretty much does everything that I was doing, but in a much nicer way and with an intuitive GUI, not to mention that keeping track of everything and editing dialogue becomes a lot easier with Yarn. Having the ability to export JSON also seems like another win.

I'll have to get better acquainted with Yarn to see what it can do, but it would seem that all of the logic would have to be inserted into a single string, so we'd have to write our own parser (or copy from others). So, I'm at the same point as @schroederapps and I agree with him that finding the "one size fits all" solution might be difficult. However, creating some general level parser that others can build upon should be easy enough.

Thanks for the links @StarCrunch.



[TOPIC: post.html]
#11

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 428 posts
  • Corona SDK

Well, I've played around with Yarn as I said I would and now I've begun working on a cool little project that could be of interest to some.

I'm working on a, well, something of an engine, to load and run the JSON exports from Yarn out of the box. My goal is to make all of the game elements such as dialogue and their logic, as well as characters, inventory and variables, etc. manageable from within Yarn, so that editing and keeping track of everything can be done from one location.

For now I've created most of the individual systems, but I still need to tie everything together as well as create the systems for conditional dialogue, etc. I'll probably have something to share next week. 


  • schroederapps and StarCrunch like this

[TOPIC: post.html]
#12

ponywolf

[GLOBAL: userInfoPane.html]
ponywolf
  • Contributor

  • 257 posts
  • Corona SDK

@starcrunch

 

Yeah, I've played around with making an importer for Twine in Lua/Corona....

 

http://twinery.org/

 

Basically so we could have decent dialog branching in our games. The XML file format is pretty easy to understand and supporting a subset of the commands for "option 1, 2 or 3" could be pretty simple.

 

Not a huge priority for me, but I'd be happy to send someone the code of what I was working on if they want to take it over.



[TOPIC: post.html]
#13

SGS

[GLOBAL: userInfoPane.html]
SGS
  • Corona Geek

  • 1,943 posts
  • Corona SDK

Bandersnatch was an interesting test but I doubt it will gain traction... Not sure people want to think whilst watching TV.



[TOPIC: post.html]
#14

schroederapps

[GLOBAL: userInfoPane.html]
schroederapps
  • Contributor

  • 451 posts
  • Corona SDK

@SGS fair point. I talk a good game about Bandersnatch but truth be told I still haven’t watched it yet for exactly what you describe - when I crash in front of the TV at the end of the day I just want to passively consume. But I’ll get around to it one day. And I am still psyched about the potential to work Yarn into my gamedev workflow.

[TOPIC: post.html]
#15

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 428 posts
  • Corona SDK

Just a quick update on my little project.

I've finished the parser for Yarn's JSON files. I'll also look into adding the possibility of importing Twine's JSON exports so that the user can use either software to create their stories.

I'll be releasing this as a free plugin, probably within 1-2 weeks, and I'll be creating a new post better describing it then. The short version of how it works is that the user gives the plugin a node to load and then the plugin breaks the node down line by line, after which it will determine which information to return from the node, for instance,
 

-- Example node
---------------
<if $inventory.money >= 120 and ($characters.player.charisma >= 7 or $characters.Sally.loyalty >= 6)>
    $Sally: You are lucky that I like you.
<else>
    $Sally: No way.
<end>
[[Leave|Path 3]]

The plugin goes through the conditional statement and checks if it is true. If it is, it will return Sally's first response. If not, it'll return the second response. Anything outside of conditional statements will always be returned. The returned information will always come back as arrays, making it easy to decide what to do with the information. For instance, the code above would return two arrays:
{ "dialogue", "Sally", "You are lucky that I like you." }, and { "link", "Leave", "Path 3" }.

Due to this structure, the user isn't tied to the plugin's style or anything. Also, as I already mentioned in my previous post, all of the nodes, as well as variables, etc. can be managed from Yarn (and probably Twine soon as well), making it easy to keep track of and edit everything in one location.



Oh! And most importantly, if you guys have something specific that you'd want the plugin to be able to do, then please let me know and I'll see about including it in the plugin.


  • StarCrunch, roaminggamer and sporkfin like this

[TOPIC: post.html]
#16

schroederapps

[GLOBAL: userInfoPane.html]
schroederapps
  • Contributor

  • 451 posts
  • Corona SDK

@xedur I look forward to seeing your plugin! I started noodling a bit with my own (non-plugin-ized) parsing tool specifically for Twine 2, whose interface I prefer to Twine 1.4 as well as Yarn - but Twine 2 doesn't support JSON exports, and only kicks out HTML, even for the source file. So the parsing is a little trickier, but so far it's working. One thing I like is that instead of simply pointing to a Twine text file inside of my project folder, I can optionally specify a path to the HTML file outside of my project that Twine reads/writes - if I'm opening the project in the simulator, it compares the current text file against the Twine HTML original, and overwrites it if there is a delta, enabling me to simply make edits in Twine, refresh the simulator, and have a new text file with the changes ready to go in my project folder. I imagine making that feature "one size fits all" might become a bit of a nightmare, but it's working well for me in my Mac-only environment.

 

Looking forward to seeing how you approached things! :)



[TOPIC: post.html]
#17

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 428 posts
  • Corona SDK

I actually found Twison for Twine 2, a story format that outputs JSON files. It's nowhere as fancy as what you described, but by using it pressing "Play" in Twine simply presents an ordinary JSON table that takes about 5s to copy and paste to a JSON file in my project folder, which my plugin then loads. Thanks to Twison, it took me only about 5 to 10 minutes to integrate Twine's JSON output to my plugin.

I still fully agree with you that the one size fits all - solution doesn't exist, which is why my plugin will output the "bare minimum", giving its users full access to do whatever they want with their projects. 

Currently, the plugin supports using conditional statements to check which paths/nodes are available. It also supports viewing and editing variables and styles declared within Twine 2 or Yarn, as well as checking how many times a path/node has been visited. But, more on this later. I'll probably need to create a brief sample project to demonstrate all of its uses. :D



[TOPIC: post.html]
#18

schroederapps

[GLOBAL: userInfoPane.html]
schroederapps
  • Contributor

  • 451 posts
  • Corona SDK

Oh! I may have to check out Twison - it’s nice to feel clever and all, but I’d rather not re-invent the wheel. 😂

[TOPIC: post.html]
#19

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 436 posts
  • Corona SDK

@carnivoreboar - look what you started!


  • XeduR @Spyric likes this

[TOPIC: post.html]
#20

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 428 posts
  • Corona SDK

The funny thing is that he only posted once to ask the question and hasn't been online for 10 days or so at this point. :D Seems like @schroederapps and I got inspired too heavily by the idea alone. :D



[TOPIC: post.html]
#21

carnivoreboar

[GLOBAL: userInfoPane.html]
carnivoreboar
  • Observer

  • 2 posts
  • Corona SDK

@sporkfin and @XeduR too true, I posted and ducked out... I’m a complete newbie and wasn’t following the thread well.

I asked the initial question to see if corona was a good option for the type of app I wanted to create. I was mainly widdling down my options to study. I GREATLY appreciate all of your responses! They were very helpful!


[topic_controls]
[/topic_controls]