Python Text Based Adventure Game Tutorial!

preview_player
Показать описание
This video shows you everything you need to know to create a full text based adventure game in python of the 'choose your own adventure' style!!

We begin with how to print commands and prompts into the terminal window for a user, then show you how to get user inputs and how to decide what your code does next.

The only limits to what you can create with Python text games are whatever your mind can imagine! This is a great project for beginners and if you're ready for more in depth game tutorials be sure to check out the rest of the channel!!

Check out my personal channel for more fun science content!

Love the content on this channel? Feel free to support me on Patreon!

Thanks for watching, don't forget to like and subscribe, and check out the channel! Good luck with your projects!

TIMESTAMPS:
00:00 Intro and Demo
2:29 Your First Inputs and Outputs
6:38 Making Decisions
9:40 Nesting For Loops
14:20 Take it to the next step!
Рекомендации по теме
Комментарии
Автор

You could have used a directed graph to hold the story, and objects, with edges connecting the nodes and acting like doorways. You could use a Finite State Machine to keep track of the user's choices, and how they modify game state and achieve game goals. The text adventure you wrote couldn't save state or load state, because it doesn't use the Command Design Pattern. This is a nice beginner tutorial about conditionals and strings!

brookestephen
Автор

I actually have a few little preview videos of my Open World Text Adventure on this channel. Been in development for 6 years. Haven't uploaded anything new yet but it's still being heavily worked on. It's set in Medieval Times with crafting, mining, fishing. Pretty much anything you can dream of doing in a Text Adventure. I also make my own Music in Famitracker. Python works great for this kind of development.

adventuresoftext
Автор

See this video actually taught me something about how python works in general and how to program the if/elif lines. Good practice. Other videos just show you step by step tutorials instead of explaining what the actual code means and how it works like you've done here. With coding it's better to get the general idea of how it works if you're trying to learn it. Otherwise you're just copying someone else's code or game

dakotafrazier
Автор

Great tutorial! I was wondering, since nested if statements could get cumbersome after too many, what would be the best option to avoid nesting too deeply?

I had a thought to make a list of the different areas/scenes and just go to that whenever the prompt allows. For example, in your example I would create area_list = [jungle, desert] and for example, if answer is in that, you go to a different part of your code that has that instead of a nested if statement.

Does this work and would that be a good alternative to nested loops?

hisuianarcanine
Автор

This is a great video. I would love to turn this into a story version as I have some creative stories I ha e written

rosembermorales
Автор

Thanks for posting this! Its going to be a great help for a project for what I have to do for class. I want to set up an inventory mode for items in the rooms that i go into. Whats the best way to do that?

Steadyrock
Автор

How to make something like, go back button, or go back to previous question or descision? Wich command should I use in Python?

ForTheSuperEarth
Автор

In games, if the text message is very long, the developer breaks up the text by requiring the player to click "Continue" or press a button to proceed with the text. What code would be needed for this basic adventure game if I wanted to use a space character as an input?

Example

Text message: Is the text book wrong?

*player presses spacebar and presses enter*

Text message: It's wrong.

tristenflores
Автор

What exactly does the \ do. If you would have printed the same line with out the \ wouldn't it have done the same thing?
I recently started learning python and I'm kind of working on my first choose you own adventure game. My problem is I keep wanting to increase the complexity. Adding item and stats and all that. Very hard to keep it super simple lol.

umbrashadowgaming
Автор

Hey man thanks for uploading this, this is my first project and but it seems like this will be much more bigger then i had realized. So i need to implement a save and load mechanic and since this is my first project i don't really know how to. Can you help?

Gramps
Автор

Is there a way to create empty lines between filled lines? I would like to avoid a text that is too narrow as it makes it harder to read.

Flowermoond
Автор

Instead of quitting how would we program a retry option that would restart them at the first choice (after their name)?

onionbro
Автор

can u do a more complex version where the player can recive damage from fight of by faling

enfysgreen
Автор

So I don't like the way it quits on any input that doesn't match the string, would it not make sense to have the input decision running in a while loop so it doesn't just end the adventure if they accidentally mistype? If yes how would I do that.

weemanling
Автор

What's the easiest way to set this up in a GUI so the text appears in actual text boxes and not a console

shotgun
Автор

I am currently writing one due to my childhood dreams associating with this tower. It uses ASCII images too.

I have tried one previously which was based on Granny's Garden also uses ASCII art.

mrunixman
Автор

So you only need if else and for loops to make an text based adventure game?

ManyDog
Автор

Why does when I open my Python, it looks more like Command Prompt? My Phyton looks different than yours. There is no File, Edit, View, etc

flipperflapper
Автор

What happens if they input something wrong i.e pick jungle or desert and they pick lake?

SirSkyro
Автор

I'm currently working on an escape room game with 3 choices using lists. I keep coming up with an issue where two options give one way then the next right after for the else statement. I don't know how to fix it. I'm a beginner and it's just in one area. Could you perhaps look at my code and see what I could be doing wrong or any suggestions on how to fix it?

KayLa-vvkj