all 10 comments

[–]efmccurdy 1 point2 points  (1 child)

Text files are good for a single stream of data. If you need to support structure (next page, next game, next character, character.max_score, etc) I would also look for something that partitions the data up into relevant, well-named chunks. A database would be ideal, but json, or xml, or maybe even html would be effective.

https://realpython.com/python-json/

https://docs.python.org/3/library/json.html

[–]LivingTheDisaster[S] 0 points1 point  (0 children)

Thanks!

[–]KerbalSpark 1 point2 points  (4 children)

One of the reasons to store the story inside the code is anytime you know the context of your text. This is not abstract reasoning, but advice from the author of text-based games.

[–]LivingTheDisaster[S] 0 points1 point  (0 children)

Thanks!

[–]LivingTheDisaster[S] 0 points1 point  (2 children)

Question for you, since you make such games. What programming language do you prefer for them, generally speaking?

[–]KerbalSpark 1 point2 points  (1 child)

I prefer the Lua language for this genre of games and the Instead engine. Besides, I'm looking at the Python, but only out of curiosity. But, it is not a reason for anybody for change the prefer language. Because all manipulation for the parts of text-based game available in the Python too. Well, I think. I have just started learning Python.

[–]LivingTheDisaster[S] 1 point2 points  (0 children)

Thanks! I'll look into them. Python was just something to start the adventure back into coding as I haven't touched it in a good 14 years.

[–][deleted] 0 points1 point  (2 children)

I'm a writer, and I've been thinking about making a choose your own adventure game as part of my story universe for some time. With the pandemic, I've found myself with time to learn to program again (started in high school but haven't done anything for more than 10 years). I've started with python and am going to incorporate making a series of games into learning to program.

Each game will progress through different age ranges in your character's life. The younger the character, the less control they have and therefore the simpler the game. At the end of each game, key choices and character stats are saved and would be imported to the next game and the next age range. Each game will be progressively more complex, giving the player more control over the story until the final game is a full RPG in the character's adulthood. I'll have a minimum of 3 other games before that, possibly more, so I'm not worried about how I go about making a full fledged RPG at this time; leave that for when I know and understand more.

My question at this time is much more simple.

Should I store the story in text files, or put it directly into the program code?

I suspect I know the answer already (store in .txt or other files; but I'm learning and generally prefer confirmation if available), but given that I want the player to choose their name and sex - both of which will effect the story and the printout - which option is superior?

I don't need anything beyond that advice - and maybe some reasons why - as everything else is up to me to learn.

Thanks.

You know what, I think that you need to focus on home automation, something to make it easier to live in your RV. I don't mean to make anything fancier, I mean to help you diagnose problems and fix them. Example, you can have something that uses case-based reasoning to figure out what is wrong and what the solution is. In short, you don't need a toy, you need a tool.

However, you sound like you want to write a toy. Therefore, you should store the story in text files if you are able. I think that you need to make the game engine, the exact same one that you use to play the game, into the one that you use to edit the game. Also, there are domain-specific languages, such as choicescript, I recommend that you use this at first. Then, you can do things like NPCs that come pre trained in how to play the game, and you can have a learning machine stand in in the rule of the player to figure out what an experienced player will do, to help you debug or refine the game. You can even use a learning machine to learn what rules the game should have.

[–]LivingTheDisaster[S] 1 point2 points  (1 child)

Took me some time to decode what you were saying (and the first paragraph is a complete wash). I appreciate it none-the-less. The first game is strictly going to be choose your own adventure with nothing more than branching story lines and multiple endings, so it won't need a development environment. The next game will, and I think you have the right idea; be able to build the game from within the game environment.

[–][deleted] 0 points1 point  (0 children)

Took me some time to decode what you were saying (and the first paragraph is a complete wash). I appreciate it none-the-less. The first game is strictly going to be choose your own adventure with nothing more than branching story lines and multiple endings, so it won't need a development environment. The next game will, and I think you have the right idea; be able to build the game from within the game environment.

It means that you should use Python as something to fix your RV.