(Partial) Text Adventure Questions

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
JGAberrance
Prole
Posts: 6
Joined: Sun Aug 28, 2016 5:43 pm

(Partial) Text Adventure Questions

Post by JGAberrance »

Hello everyone!

This thread concerns some of my difficulties in finding a starting point with developing a game idea.

I'm new to programming in general but have some understanding of the structure and way it works. I am uncertain however, on where exactly to begin with programming my game.

I choose to do a partial text adventure because I felt it would be a good way to capitalize on something I am already a little proficient with, writing, while using UI elements and static character portraits to play around with for the learning experience and make things more interesting.

The UI itself is very simple. I could draw them in Love2D simply using love.graphics.rectangle commands as they are simply rectangles with a 2px border. I'm unsure however, if that it is even a good idea to use Love to render them or use sprite sheets for something so simple. The UI consists of 1 always present narration and conversation box, with 2 additional windows I would like to slide in from the left and bottom of the screen. These additional windows include a attribute window and branch window that includes various paths the player can pick between.

I'll drop some UI samples with dummy text done in Photoshop so you can see for yourself.

All 3 Main Windows
Image

Dialogue
Image

Narration
Image

Basically what I'm asking for is this:

If you were designing such a game, what would be your first move? As a person who has a hard time figuring out where to even begin, some simple guidance could help me greatly.

I've looked for libraries that might include features I could find useful but I'm not even sure what to look for. Though watching folk make platformers and SHMUPS and the like has given me some ideas on how I might write some code to make the windows I need, I'm not even sure if doing them as I suggested earlier is even a good idea or if there are some alternatives I'm not yet aware of.
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: (Partial) Text Adventure Questions

Post by airstruck »

I'd worry about the game mechanics first before worrying about the UI too much. In particular, I'd be thinking about how to store the dialog trees and branches. Maybe internally you'd have something like the table of contents for a book, except instead of chapters you'd just have short passages, each with their own unique name. Then you can attach branch options to each passage, which link to other passages by name. The branch options will each need a function associated with them that can alter state (inventory/stats) and choose one of a set of possible next passages based on state checks.

It might be interesting to write the core game mechanics in pure Lua, and get it playable in the terminal, and then build the UI stuff on top. This would let you focus on game mechanics without worrying about the final UI at all, and when you're ready to build the UI, it will naturally have a good separation from your "story engine" (so if you want to do another game later, you could build a completely different style of UI on top of the same engine).
JGAberrance
Prole
Posts: 6
Joined: Sun Aug 28, 2016 5:43 pm

Re: (Partial) Text Adventure Questions

Post by JGAberrance »

I hadn't even thought to do that. That's a good idea, and more important than figuring out the UI right now. Thank you!

So I need some way to store text, with no formatting for now I suppose? or can you format text displayed in a terminal?

The passages would be need to be paragraphs requiring user input to print the next paragraph until you reach one that requires the player to choose a branch. On top of everything you noted, I think I might be able to try and construct something that can do that. Figuring it out might take me awhile though.

Thanks for the advice. I'm always open to more if you or anyone think they can point me in a good direction!
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: (Partial) Text Adventure Questions

Post by airstruck »

JGAberrance wrote:So I need some way to store text, with no formatting for now I suppose? or can you format text displayed in a terminal?
Hmm, I hadn't thought about formatted text. There are ANSI escape sequences, but I don't remember whether Windows has decent support for them. You could use your own formatting markup that gets translated into ANSI escape sequences if you feel like it, or just ignored in the terminal version and used only in the final Love version.
The passages would be need to be paragraphs requiring user input to print the next paragraph until you reach one that requires the player to choose a branch.
Or, the "next paragraph" thing could actually be a branch, where there's only one option to choose from and no checks are done. Then you could give those "next branches" interesting labels like "go on," "you don't say?" and "fascinating!"
Thanks for the advice. I'm always open to more if you or anyone think they can point me in a good direction!
I'm interested in hearing some other ideas too. What you're planning sounds a little different from a normal text adventure, and more like one of those LucasArts type of games (but with a text interface). It sounds like it could be fun, will be interesting to see what you come up with.

Here's a quick sketch of how I imagine the scenes and branches looking. You might have something different in mind, but maybe this will give you some ideas.

Code: Select all

defineScene('troll encounter', function (scene, game)
    scene.text = [[ You see a troll, blah blah blah. What do you do? ]]
    scene:createBranch('Ignore it.', function ()
        game:setScene('ignore troll')
    end)
    scene:createBranch('Run away!', function ()
        if math.random() + game.player.speed < 0.5 then
            game:setScene('flee troll failure')
        else
            game:setScene('flee troll success')
        end
    end)
    if game.inventory:find('stick') then
        scene:createBranch('Whack it with your stick.', function ()
        if math.random() + game.player.strength < 0.5 then
                game:setScene('whack troll failure')
            else
                game:setScene('whack troll success')
            end
        end)
    end
end)

defineScene('ignore troll', function (scene, game)
    scene.text = [[ You try to ignore the troll, but it won't go away. ]]
    scene:createBranch('Oh well.', function ()
        game:setScene('troll encounter')
    end)
end)

defineScene('flee troll failure', function (scene, game)
    scene.text = [[ You try to flee, but the troll corners you. ]]
    scene:createBranch('Oh shit!', function ()
        game:setScene('troll encounter')
    end)
end)

defineScene('flee troll success', function (scene, game)
    scene.text = [[ You run away from the troll. ]]
    scene:createBranch('Whew!', function ()
        game:setScene('some other scene')
    end)
end)
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: (Partial) Text Adventure Questions

Post by raidho36 »

I wouldn't recommend to a beginner getting all wrapped up in functional programming. It has its uses but in a video game it will probably result in clusterfuck of a source code, as airstruck was so kind to demonstrate. What's worse, as a beginner you may end up doing things you don't really understand (yet), resulting in confusing and frustrating experience and very little progress being done - until you learn it all. Plain procedural programming is much easier to learn, you can in fact come to grips with it nearly immediately.

For this kind of game I would rather used WebKit based solution, because it's adequate at rendering your stuff, but so much more powerful in terms of text handling, immensely so.
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: (Partial) Text Adventure Questions

Post by airstruck »

It guess it might be too much of a learning curve, but then again it might not; it's hard to know how quickly anyone will grasp any particular concept. I've noticed that people new to programming, who don't have any preconceived ideas about how to do things, often grasp things pretty quickly.

More quickly, for example, than people who barely know enough to scrape by, but still denounce any thinking they're unfamiliar with as being "hipsterish" or "over-engineered" or "not creative" rather than admit to themselves that they don't actually know everything, and make an effort at educating themselves.

In any case, trolls can be very persistent, and they'll probably be more difficult to get rid of than outlined in this sketch. That being the case, I am disappointed to learn that my example code is already such a clusterfuck; surely it won't scale very well. I'm very much looking forward to seeing your brilliant procedural solution; perhaps once you reveal your wisdom to us we can all benefit from less troll encounters.
alloyed
Citizen
Posts: 80
Joined: Thu May 28, 2015 8:45 pm
Contact:

Re: (Partial) Text Adventure Questions

Post by alloyed »

I would second the html5 idea: while love can do rich text/layouts, the browser is already purpose-built for it, and by default a lot more people will be interested in trying your game if they don't have to leave their browser to do it.

for what its worth, javascript is not that different from lua, so you won't be starting 100% from scratch if you've already invested some time in learning love.
JGAberrance
Prole
Posts: 6
Joined: Sun Aug 28, 2016 5:43 pm

Re: (Partial) Text Adventure Questions

Post by JGAberrance »

Airstruck's suggestion has already been repeated by a few personal friends I asked for help from so I'm inclined to stick with what I've been getting comfortable with for the past few days rather than move on to yet another working environment.

I understand the advantages of html5 but I'd rather not get into the details of why I avoided it initially and still avoid it today.

Regardless, thank you for the continued input and interest. I may end up going to html5 if my situation with Lua/Love becomes a "clusterfuck" but so far I feel like I'm making progress for once so any other advice concerning getting a working Text Adventure going in Lua/Love would be appreciated.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: (Partial) Text Adventure Questions

Post by raidho36 »

You got me curious; what is that thing about html5 that makes it a bad choice to you?
JGAberrance
Prole
Posts: 6
Joined: Sun Aug 28, 2016 5:43 pm

Re: (Partial) Text Adventure Questions

Post by JGAberrance »

raidho36 wrote:You got me curious; what is that thing about html5 that makes it a bad choice to you?
That's not why I opened this thread and I'd rather not start a debate. Sorry.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 4 guests