Legacy GM Text files, included files and working_directory

Hi,
I'm working on something with a lot of dialogue which I'd like to store in external text files.
I still find the sandboxing a bit confusing and don't fully understand the documentation on it all.
Not sure whether to have the game create the file and populate it itself or include a premade txt file.
 
B

bojack29

Guest
Its up to you really. The filesize is smaller without the included textfiles. So long as you store the text files in the proper location everything should work just fine.

You will probably have an easier time building the game with the dialogue saved inbound within the system itself. I can't imagine working with tons of external text files. That would seem to be a HUGE headache.

Perhaps maybe a 1d array for each character for its dialogue? Just an idea.
 
A

Aleksandar Gavrilovic

Guest
There is no way to write to included file, as far as I know. When you save any file, it goes to %localappdata%
 
Its up to you really. The filesize is smaller without the included textfiles. So long as you store the text files in the proper location everything should work just fine.

You will probably have an easier time building the game with the dialogue saved inbound within the system itself. I can't imagine working with tons of external text files. That would seem to be a HUGE headache.

Perhaps maybe a 1d array for each character for its dialogue? Just an idea.
As someone who has almost exclusively worked in RPGs for the past ~8 years, having a 1d array for each character and its dialogue sounds so much more painful. Tons of external text files is how many commercial PC RPGs handle large amounts of text. Off the top of my head, I remember the original Fallout having text data files for individual parts of the game. It's a lot more convenient than it sounds.


As far as how GM:S's sandboxing, the way you would accomplish this is by creating your text files externally, and then drag it into the "Included Files" section. If you want to open a particular text file, you would use "file_text_open_read("game_text.txt");". You don't have to add "working_directory" or anything of the sort, since it's considered part of the game file.
 
B

bojack29

Guest
Youd have to write a real consistent way for this.

But then I ask you, how on earth would you do something like this for portable? Is such a thing even possible?
 
Youd have to write a real consistent way for this.

But then I ask you, how on earth would you do something like this for portable? Is such a thing even possible?
file_text_* functions are universal. They work on all publicly documented exports. Or, at least, the helpfile doesn't say otherwise. I know it specifically states that file_bin* functions don't work in HTML5, so I would assume that is an outlier.

As far as the original post goes, creating text files beforehand and sticking them in the Included Files seems to be what's recommended by the GM:S helpfile.
 
S

sparksinfinite

Guest
I also write .ini files (for stats in my case) and include them into the Included Files Folder (cannot be modified during runtime).
Included Files are great for data organization!
Tip: Always check if these files are really there (once included) and not just a 'ghost' in the resource folder (so do sometimes backup). This happens to me time to time ...

Btw I do both, I include a file in the IDE and also allow to use the same files externally (in the app folder). If the game finds the file in the app folder it uses this one instead of the Included one (file_exists).
That way you can also edit stuff on runtime if you want to, and if you are happy with the results you just copy the file in the app folder into the Included Files.
 
So what you're saying is, premade included file is the way to go? I'll give that a shot.
And if I'm understanding correctly, you have the included file as a sort of default file, but the game checks for a similar file in the appdata folder first?
 
S

sparksinfinite

Guest
Not sure if it's THE way, it really depends one how you like to work.
For me, I will always use this ini/txt approach for Gamemaker. I guess many developer store such data not in classes / objects but in external files like XML or JSON?

When your game becomes bigger, data management gets almost more important than anything else. A good readable and accessible file (where you don't have to mess code) will save your time and happiness.

And yes, you understood correctly, that's the way I do it. The app file is like a temporary one where I can test stuff (but I have to place it there before of course).
 

Yal

šŸ§ *penguin noises*
GMC Elder
I'm seconding the included files functionality, it's a lot more convenient than it first seems. You can double-click files in the resource tree to edit them with your preferred editor, and they're kept as parts of the project folder so you can't forget where you put them. It's almost no extra work to have external music files and create them via audio_create_stream() and it speeds up loading times considerably, too (which is the main thing I use external files for currently).
 
Top