0 votes

I am developing a quiz-based game. You can say it's like the popular "Who Wants to be A Millionaire". So there will be bunch of questions and answers which are basically plain texts (around 700 questions)

What is the best way in GDscript to store that questions. Shoud I store it in a plain .txt file then load it to my game and parse it? if like so? how do I do it in GDscript? I came from Java background so that's how I usually deal with text-based "resources". Or there is a special node for handling it?. I mean if Godot already has feature for it, why should I work hard to
reinventing the wheel.

Thanks in advance

in Engine by (38 points)

1 Answer

+1 vote
Best answer

I think json is the best choice.
A dictionary with it allows you to manage questions and their multiple answers in simplest way.


by (1,484 points)
selected by

Thanks for pointing me out. Have you got any good tutorial on json in Godot?

Json support boils down to functions in Dictionary: http://docs.godotengine.org/en/latest/classes/class_dictionary.html?highlight=json, combined with File you can load and save it from disk: http://docs.godotengine.org/en/latest/classes/class_file.html

I wrote a simple example here: https://godotengine.org/qa/6491/read-%26-write

That's very kind of you. Thanks, I have managed it to work.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.