Skip to main content

The Start of a Brand New Journey: Making a Text-Based Adventure Game in Python.

 

I felt like I was doing something wrong.

Introduction

Hello there, coders! 

It's been quite a while, I know. 

I took a small rest so that I could fully transition into a weekly schedule instead of a daily one, but now I'm here!

Today, I'm going to be talking about me starting out to make my first real project. 

I watched a few YouTube videos in my hiatus and realized I wasn't doing anything useful other than doing exercises, so I decided to start a project!

I'm a bit guilty of AI usage, because I used it to give me ideas for projects. It's not much of a big deal, but I felt like I had to mention it.

The Start

So when I asked it, it gave me an idea for a person exploring a mansion. 

So, I expanded on that by adding a bit of mystery and spooky into it, with the idea now being that a overtly curious child exploring a mansion. 

Little did they know, it was haunted!

First of all, I started a character introduction thing, with my program first asking the person's name and confirming it's their name.

By the way, I decided to split my project into parts so that I can work on one thing at a time, something I learned from the Harvard CS-50 course, which is actually free on YouTube!

This took an embarrassing 2 HOURS, but here's the code!

 

Python Code for a Text-Based Adventure Game

The Code. Surprisingly simple yet confusing for me at the same time.

Later, I made some story, where I just explained the plot of the adventure. Took like 300 lines of empty print("")'s.

Code in Python for a Text-Based Adventure Game

A whole lot of print statements. Also, a welcoming... welcome!

I don't know if this code can be optimized or not, so let me know in the comments if I could've made the code a few lines shorter!

After this, I took some rest, and decided to start the next part tomorrow!

The End of the Beginning

The day after, I got to work on an inventory system! The character's going to pack some things, so I made it!

What I thought of, is that I would save the choices of items in a list, as numbers, and there's no indication of the item's name.

This could definitely be improved but I decided to change it later.

I then limited the character's choices to only 3 instead of the items' amount, 5, so that the character had limited choices.

Excellent game design by me, thank you, thank you.


The Code. The user can just pick items more than once, and the user can type 33232323 instead of actually picking an item...


There are so many things that could be improved but I decided to write this blog first, and then improve on it later, so that I can tell you guys about my improvement!

Conclusion

Slowly but surely! I know that this will take a bit of time, so I know I have to be patient.

I'm hoping that I can finish these things before my next update, with them being:

- Review python, so that I don't forget everything I've worked towards.

- Finish the inventory system and change the numbers system to names

- Do a bit more work, and maybe add an obstacle for the character

In the end, I learned a whole bunch, and realized I definitely needed to revise my concepts. I also learned a bunch more about lists, and just game development in general (a load of YouTube videos!)

P.S. Thanks, everyone for a hundred views on my blog!

and with that,
signing off,
Stewie

Comments

Popular posts from this blog

The Beginning

  Coding was always something I was interested in. Introduction I used to be super interested in coding as a kid, because who wouldn't want to make games, create web pages? I obviously signed up for coding tuition when I was around 10, and just could not keep up at all. The teacher was fine, but I guess I just got bored trying to understand and remember the "functions". Recently, I decided to change this, by trying to learn coding again. I still have some basic knowledge for coding, for example loops, conditionals, data types, but other than that, I just forgot everything. After this, I found this incredible website called freecodecamp.org . If you're learning to code, which I think you are doing since you're reading this, you'll probably find this website to be incredibly useful. Other than that, I realized that, "I could probably help some future coding beginners if they saw a blog from a person learning to code." and I set up this blog. I really h...

A Complete Overhaul of My Text-Based CYOA Game in Python!

  Everything changed. Introduction Hello there, coders! Today, I'm going to be sharing my experiences with planning and coding a text-based CYOA game in Python! The Overhaul I overhauled everything. Why? Well, it all started when I felt some doubt about my game. I felt like everything was going alright, when I took a closer look, and saw that there was no CYOA elements in it whatsoever!  The problem with it, was the fact that you chose 4 items in the beginning, and the story unfolds right in front of your eyes. There was only one single choice in the entire game. This was why I started version 2, where the player wouldn't choose any items in the beginning and make the choices inside of the haunted mansion. When I got into writing the story, I just kept overcomplicating it with souls, and arrogant mansion owners, that I just decided to scrap it completely. There was also a version 3 but I completely forgot about it. I think I scrapped it since there were just too many choices t...

My First Prototype for my Text-Based CYOA Game in Python!

  I finished it! Introduction Hello there, coders!  I'm so happy to tell you guys, that I have finished the first prototype for my first game! It took around 5 weeks to finish my game, which could've been much lower only if I had been less lazy. By the way, my school has started again, so new posts might be slower, but I will continue uploading! Bug fixing I finished making the endings quite swiftly. It was just if statements. It wasn't really that hard. The hard part came, when I realized that my old enemy, being-able-to-choose-one-choice-again-and-again came back, and I had to get back to work. I tried fixing it manually, but then I decided to kill two birds with one stone, and made a function to optimize my code! This made me go down yet another rabbit hole. Functions If you can recall, functions are basically code that executes multiple lines of code.  There are also many functions built into Python itself. Functions, to me right now, are a bit tricky, as we can put v...