Python Forum
Feedback on a test adventure?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Feedback on a test adventure?
#1
This is a text-adventure style game based on The Stanley Parable. It's not done yet, but i was hoping to get some feedback before i finish.
# I want to add console later so import sys is here
import sys
import time
begin_the_game = True
while begin_the_game == True: # Could i just use while True: ?
    print('This is the story of a man named Stanley.\n') # I need a \n to make it more readable
    print("Stanley worked for a company in a big building where he was Employee #427. Employee #427's job was simple: He sat at his desk in room 427 and he pushed buttons on a keyboard. Orders came to him through a monitor on his desk, telling him what buttons to push, how long to push them, and in what order. This is what Employee #427 did every day of every month of every year, and although others might have considered it soul rending, Stanley relished every moment the orders came in, as though he had been made exactly for this job. And stanley was happy.\n")
    print("And then one day, something very peculiar happened. Something that would forever change Stanley; something he would never quite forget. He had been at his desk for nearly an hour when he realized that not one single order had arrived on the monitor for him to follow. No one had shown up to give him instructions, call a meeting, or even say 'hi'. Never in all his years at the company had this happened, this complete isolation. Something was very clearly wrong.\n")
    # Control is given to the player at this point
    console = input('> ')
    control = True
    while control == True:

        if console == 'wait':
            print('Shocked, frozen solid, Stanley found himself unable to move for the longest time. But as he came to his wits and regained his senses, he got up from his desk and stepped out of his office.\n')
            control = False
            control_left_room = True
            print("All of his co-workers were gone. What could it mean? Stanley decided to go to the meeting room; perhaps he had simply missed a memo.") # I want to add multiple sayings at this stage if i can get a saving mechanism. 9 total dialogues will be possible
            console = input('> ')
        elif console == 'close door':
            print("But Stanley just couldn't handle the pressure. What if he had to make a decision? What if a crucial outcome fell under his responsibility? He had never been trained for that! No, this couldn't go any way except badly.\n")
            time.sleep(5)
            print("The right thing to do now, Stanley thought to himself, is to wait. Nothing will hurt me. Nothing will break me. In here, I can be happy, forever. I will be happy.\n")
            time.sleep(10) # This game LOVES wait times
            print("Stanley waited. Hours passed. Then days. Had years gone by? He no longer had the ability to tell. But the one thing he knew for sure, beyond any doubt, was that if he waited long enough, the answers would come. Eventually, some day, they would arrive. Soon, very soon now, this will end. He will be spoken to. He will be told what to do. Now it's just a little bit closer. Now it's even closer. Here it comes.\n")
            time.sleep(1) # Without this, the game feels semi-rushed
            print("Congratulations! You got the coward ending.") # Don't know how to save yet, so this is reacheivable each time you play.
            # f = open('save_file', 'w') writes, but i don't know how to make it write what i want
            time.sleep(15)
            sys.exit(0) # The game will exit once an ending is acheived
        elif console == 'leave room':
            control = False
            control_left_room = True
            print("All of his co-workers were gone. What could it mean? Stanley decided to go to the meeting room; perhaps he had simply missed a memo.") # I want to add multiple sayings at this stage if i can get a saving mechanism. 9 total dialogues will be possible
            console = input('> ')
        else:
            print("I don't know how to do that.")
            console = input('> ')

    while control_left_room == True:

        if console == 'crawl out of window': # Add an else for unknown command
            print("At first, Stanley assumed he had broken the map, until he heard this narration and realized it was part of the game all along. He then praised the game for its insightful and witty commentary into the nature of video game structure and its examination of structural narrative tropes.")
            time.sleep(1)
            print("So, now that you're here, what do you think? Isn't this a fun and unique place to be? Why don't we take a minute just to drink it all in!")
            time.sleep(1)
            print("Okay I'm over it now. What do you think, are you sick of this gag yet?")
            console = input('> ')
            yes_no_out_of_window = True
            while yes_no_out_of_window == True:

                if console == 'yes':
                    print("Well, i don't know how to say this politely but you could literally just hit the X button in the top right of your screen and old time you want. Like right now! You could have done it just then!")
                    time.sleep(1)
                    print("Now would also be an appropriate time to quit! Any one of these points, and so many many more, all of them are appropriate! I'm enjoying what seems to be an internal conflict going on where you are literally unable to act on your own desires to restart the game.")
                    time.sleep(1)
                    print("So just to push the envelope, i'm going to try to make this as miserable as possible and we'll see how long you can maintain.")
                    time.sleep(2)
                    print("There once was a man named Stanley,")
                    time.sleep(2)
                    print("Who people considered so manly.")
                    time.sleep(2)
                    print("But the truth must be told,")
                    time.sleep(2)
                    print("He was not very old,")
                    time.sleep(2)
                    print("And was quite particularly gangly.")
                    time.sleep(2)
                    print("What Stanley liked most was buttons.")
                    time.sleep(2)
                    print("He pushed them like some kind of glutton.")
                    time.sleep(2)
                    print("He did it all day")
                    time.sleep(2)
                    print("In a meaningful way,")
                    time.sleep(2)
                    print("But his brain had long ceased to function.")
                    time.sleep(2)
                    print("Which is why he is in this parable,")
                    time.sleep(2)
                    print("And lives an an existance quite terrible.")
                    time.sleep(2)
                    print("And if you are strong,")
                    time.sleep(2)
                    print("And keep playing along,")
                    time.sleep(2)
                    print("You too will become quite unbearable.")
                    time.sleep(2)
                    sys.exit(0) # In case you were wondering, this is not an ending
                elif console == 'no': # Possibly add a time.sleep(0.5) between each print?
                    print("Ah, well in that case we'll continue! But now here comes the real question: What do you think would have happened if you had told me you wanted this to stop? Do you think it would have been particularly different?")
                    time.sleep(1)
                    print("Would i have taken this same idea but rephrased it superficially to fit that answer? Perhaps you never would have even though of it if i hadn't brought up the issue in the first place!")
                    time.sleep(1)
                    print("Oh, now think about it, will it be worth it for you to restart, and then come BACK here, just to do the other option? Cleary this whole gag takes some time, what if the other option is even longer! How long will you spend in total just to have heard all the narration!")
                    time.sleep(1)
                    print("Or - oh this is rich! - perhaps you've just played the othe roption and now you've come to see what happens in this one! So, what do you think, which choice was the better one?")
                    time.sleep(1)
                    print("Imagine if you had selected 'continue' on your first playthrough, how tantalizing it would be, not knowing what happens when you pick the other option. Indeed, you are one of the lucky ones.")
                    time.sleep(1)
                    print("Though if the other option is really miserable to listen to then perhaps you're not. In fact, i'm going to say that no one who's listening to this is lucky.")
                    time.sleep(1)
                    print("Well now i've built up the other option so much that i'm going to stop talking and leave you to your decision whether to come back here, continue with the game, or just sit here in this spot forever and ever. Cheers")
                    sys.exit(88888888) # 88888888
                else:
                    print("That isn't an option.")
                    console = input('> ')
        elif console == 'leave room':
            print("When Stanley came to a set of 2 open doors, he enetered the door on his left.")
            console = input('> ')
            two_open_doors = True
            while two_open_doors == True:

                if console == 'enter left door':
                    print('Stanley enetered the left door')
                    print('Stanley is in the hallway')
                    console = input('> ')
                    left_door_hallway = True
                    while left_door_hallway == True:

                        if console == 'enter broom closet':
                            print('Stanley stepped into the broom closet, but there was nothing here, so he turned around and got back on track.')
                            broom_closet_one = True # I may be spamming the while but it is the easiest way for me
                            while broom_closet_one == True:

                                if console == 'leave room':
                                    broom_closet_one = False
                                    console = input('> ')
                                elif console == 'wait':
                                    print('There was nothing here. No choice to make. No path to follow. Just an empty broom closet. No reason to still be here.')
        else:
            print("I don't know how to do that.")
Self-taught HTML, CSS, Python, and Java programmer
Reply
#2
This is the classic way for a beginning programmer to write a text adventure, and it is fraught with problems. The whole if/elif/then structure is very cumbersome, repetitive, and hard to scale up (expand).

A better way is to use a dictionary or other data structure that contains the information about the locations, and a single program structure that works its way through that dictionary. There is a link in my signature to a text adventure tutorial that shows you how to do exactly that. I would recommend reading that, and then trying to redo your adventure using that method.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
What are you testing?

Quote:console = input('> ')
This line should probably only be in your code once, instead of once every block. Ideally, you'd reorganize everything into a state machine. So each option would "know" what it's next options are, and the state machine will move to the new state each iteration. You can read more here: http://gameprogrammingpatterns.com/state.html
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Text Adventure Game Nave5 1 2,252 Mar-30-2020, 05:06 AM
Last Post: SheeppOSU
  Text base adventure game ForbNovak 12 7,402 Aug-29-2018, 03:11 PM
Last Post: Nwb
  My first 'GAME' It is a simple text adventure jackspendiff942003 3 3,843 Aug-08-2017, 10:22 PM
Last Post: jackspendiff942003
  Christmas Text Adventure OriginalCal 3 5,575 Dec-13-2016, 06:06 PM
Last Post: OriginalCal

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020